[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue May 25 21:35:52 UTC 2004


CVS commit by okellogg: 

findItem(id): Use UMLListViewItem::findItem().
loadChildrenFromXMI(): Use deepCopy() when re-parenting the existing
 listview item tree.


  M +15 -11    umllistview.cpp   1.100


--- kdesdk/umbrello/umbrello/umllistview.cpp  #1.99:1.100
@@ -410,6 +410,6 @@ void UMLListView::slotDiagramCreated( in
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 void UMLListView::slotObjectCreated(UMLObject* object) {
-        /* kdDebug() << "UMLListView::slotObjectCreated: ID is "
-                  << object->getID() << endl;
+        /* kdDebug() << "UMLListView::slotObjectCreated(" << object->getName()
+                  << "): ID is " << object->getID() << endl;
          */
         UMLListViewItem* newItem = 0;
@@ -563,6 +563,6 @@ void UMLListView::childObjectAdded(UMLOb
                 return;
         }
-        /* kdDebug() << "UMLListView::childObjectCreated: ID is "
-                  << obj->getID() << endl;
+        /* kdDebug() << "UMLListView::childObjectAdded(" << obj->getName()
+                  << "): ID is " << obj->getID() << endl;
          */
         if (!m_bCreatingChildObject) {
@@ -777,7 +777,9 @@ UMLListViewItem* UMLListView::findItem(i
         UMLListViewItem *temp;
         QListViewItemIterator it(this);
-        for( ; (temp = (UMLListViewItem*)it.current()); ++it )
-                if(temp->getID() == id)
-                        return temp;
+        for( ; (temp = (UMLListViewItem*)it.current()); ++it ) {
+                UMLListViewItem * item = temp->findItem(id);
+                if (item)
+                        return item;
+        }
         return 0;
 }
@@ -2228,5 +2230,5 @@ bool UMLListView::loadChildrenFromXMI( U
                                         }
                                 }
-                                else
+                                else if (parent != item->parent())
                                 { // The existing item was created by the slot event triggered
                                   // by the loading of the corresponding model object from the
@@ -2240,8 +2242,10 @@ bool UMLListView::loadChildrenFromXMI( U
                                   // listview item might be located in a user created folder.
                                   // Thanks to Achim Spangler for spotting the problem.
-                                        if (label.isEmpty())
-                                                label = item->getText();
+                                        /* kdDebug() << "UMLListView::loadChildrenFromXMI: Reparenting "
+                                                  << item->getText() << endl;
+                                         */
+                                        UMLListViewItem *newItem = item->deepCopy(parent);
                                         delete item;
-                                        item = new UMLListViewItem(parent, label, lvType, pObject);
+                                        item = newItem;
                                 }
                                 break;






More information about the umbrello-devel mailing list