[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Feb 9 12:20:04 UTC 2006
SVN commit 507689 by okellogg:
sync with branches/KDE/3.5
M +2 -0 dialogs/classifierlistpage.cpp
M +4 -2 umllistview.cpp
M +34 -28 umllistviewitem.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classifierlistpage.cpp #507688:507689
@@ -21,6 +21,7 @@
#include "../enumliteral.h"
#include "../entityattribute.h"
#include "../object_factory.h"
+#include <kapplication.h>
#include <kbuttonbox.h>
#include <kdebug.h>
#include <klocale.h>
@@ -502,6 +503,7 @@
int wasAtIndex = m_pClassifier->takeItem(listItem);
if (wasAtIndex == -1)
return false;
+ kapp->processEvents();
peerIndex = -1;
UMLObject *o;
const Uml::Object_Type seekType = listItem->getBaseType();
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #507688:507689
@@ -2899,8 +2899,10 @@
bool UMLListView::typeIsClassifierList(Uml::ListView_Type type) {
if (type == Uml::lvt_Attribute ||
- type == Uml::lvt_Operation ||
- type == Uml::lvt_Template) {
+ type == Uml::lvt_Operation ||
+ type == Uml::lvt_Template ||
+ type == Uml::lvt_EntityAttribute ||
+ type == Uml::lvt_Unknown) { // used for enum literal
return true;
} else {
return false;
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistviewitem.cpp #507688:507689
@@ -538,7 +538,7 @@
// Sort the listview items by type and position within the corresponding list
// of UMLObjects. If the item does not have an UMLObject then place it last.
-int UMLListViewItem::compare(Q3ListViewItem *other, int /*col*/, bool /*ascending*/) const
+int UMLListViewItem::compare(Q3ListViewItem *other, int col, bool ascending) const
{
UMLListViewItem *ulvi = static_cast<UMLListViewItem*>(other);
Uml::ListView_Type ourType = getType();
@@ -549,72 +549,78 @@
if ( ourType > otherType )
return 1;
// ourType == otherType
+ const bool subItem = UMLListView::typeIsClassifierList(ourType);
+ const int alphaOrder = key(col, ascending).compare(other->key(col, ascending));
+ int retval = 0;
+ QString dbgPfx = "compare(type=" + QString::number((int)ourType)
+ + ", self=" + getText() + ", other=" + ulvi->getText()
+ + "): return ";
UMLObject *otherObj = ulvi->getUMLObject();
if (m_pObject == NULL) {
+ retval = (subItem ? 1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return 1 because (m_pObject==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (m_pObject==NULL)" << endl;
#endif
- return 1;
+ return retval;
}
if (otherObj == NULL) {
+ retval = (subItem ? -1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return -1 because (otherObj==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (otherObj==NULL)" << endl;
#endif
- return -1;
+ return retval;
}
UMLClassifier *ourParent = dynamic_cast<UMLClassifier*>(m_pObject->parent());
UMLClassifier *otherParent = dynamic_cast<UMLClassifier*>(otherObj->parent());
if (ourParent == NULL) {
+ retval = (subItem ? 1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return 1 because (ourParent==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (ourParent==NULL)" << endl;
#endif
- return 1;
+ return retval;
}
if (otherParent == NULL) {
+ retval = (subItem ? -1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return -1 because (otherParent==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (otherParent==NULL)" << endl;
#endif
- return -1;
+ return retval;
}
if (ourParent != otherParent) {
+ retval = (subItem ? 0 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return 0 because (ourParent != otherParentL)" << endl;
+ kDebug() << dbgPfx << retval << " because (ourParent != otherParentL)" << endl;
#endif
- return 0;
+ return retval;
}
UMLClassifierListItem *thisUmlItem = dynamic_cast<UMLClassifierListItem*>(m_pObject);
UMLClassifierListItem *otherUmlItem = dynamic_cast<UMLClassifierListItem*>(otherObj);
if (thisUmlItem == NULL) {
+ retval = (subItem ? 1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return 1 because (thisUmlItem==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (thisUmlItem==NULL)" << endl;
#endif
- return 1;
+ return retval;
}
if (otherUmlItem == NULL) {
+ retval = (subItem ? -1 : alphaOrder);
#ifdef DEBUG_LVITEM_INSERTION_ORDER
- kDebug() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return -1 because (otherUmlItem==NULL)" << endl;
+ kDebug() << dbgPfx << retval << " because (otherUmlItem==NULL)" << endl;
#endif
- return -1;
+ return retval;
}
UMLClassifierListItemList items = ourParent->getFilteredList(thisUmlItem->getBaseType());
int myIndex = items.findRef(thisUmlItem);
int otherIndex = items.findRef(otherUmlItem);
if (myIndex < 0) {
- kError() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return -1 because (myIndex < 0)" << endl;
- return -1;
+ retval = (subItem ? -1 : alphaOrder);
+ kError() << dbgPfx << retval << " because (myIndex < 0)" << endl;
+ return retval;
}
if (otherIndex < 0) {
- kError() << "compare(self=" << getText() << ", other=" << ulvi->getText()
- << "): return 1 because (otherIndex < 0)" << endl;
- return 1;
+ retval = (subItem ? 1 : alphaOrder);
+ kError() << dbgPfx << retval << " because (otherIndex < 0)" << endl;
+ return retval;
}
return (myIndex < otherIndex ? -1 : myIndex > otherIndex ? 1 : 0);
}
More information about the umbrello-devel
mailing list