[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun May 23 06:45:02 UTC 2004


CVS commit by okellogg: 

loadChildrenFromXMI( ): Restore fix from Achim Spangler to insert listview
 items into their appropriate folders.


  M +17 -15    umllistview.cpp   1.99


--- kdesdk/umbrello/umbrello/umllistview.cpp  #1.98:1.99
@@ -2198,19 +2198,4 @@ bool UMLListView::loadChildrenFromXMI( U
                         case Uml::lvt_Actor:
                         case Uml::lvt_UseCase:
-                          /* check if UMLListViewItem with same nID is already created by
-                                // SLOT-EVENT from creation of corresponding UMLObject
-                                item = findItem(nID);
-                                if (item == NULL)
-                                { // All items should already exist - they should have been created
-                                  // by the slot event triggered by creation of corresponding object.
-                                  // This is done so that we can load foreign XMI files which do not
-                                  // have the umbrello specific <listview> info.
-                                        //FIXME: Item does not exist yet? It should.
-                                        kdDebug() << "UMLListView::loadChildrenFromXMI(): item "
-                                                  << label << " does not exist yet (?)" << endl;
-                                        item = new UMLListViewItem(parent, label, lvType, pObject);
-                                }
-                                break;
-                           */
                         case Uml::lvt_Class:
                         case Uml::lvt_Interface:
@@ -2243,4 +2228,21 @@ bool UMLListView::loadChildrenFromXMI( U
                                         }
                                 }
+                                else
+                                { // The existing item was created by the slot event triggered
+                                  // by the loading of the corresponding model object from the
+                                  // XMI file.
+                                  // This early creation is done in order to support the loading
+                                  // of foreign XMI files that do not have the umbrello specific
+                                  // <listview> tag.
+                                  // However, now that we encountered the real <listview> info,
+                                  // we need to delete the existing item: Its parent is always
+                                  // one of the default predefined folders, but the actual
+                                  // listview item might be located in a user created folder.
+                                  // Thanks to Achim Spangler for spotting the problem.
+                                        if (label.isEmpty())
+                                                label = item->getText();
+                                        delete item;
+                                        item = new UMLListViewItem(parent, label, lvType, pObject);
+                                }
                                 break;
                         case Uml::lvt_Attribute:






More information about the umbrello-devel mailing list