[Uml-devel] KDE/kdesdk/umbrello/umbrello

Sharan Rao sharanrao at gmail.com
Thu May 17 11:54:35 UTC 2007


SVN commit 665608 by sharan:

fixes some bugs associated with classifierListItems in the ListView

Earlier, if a new attribute was added by right clicking on listview class and -> New attribute
any changes done to the attribute's name in the model ( in the properties dialog ) never reflected in the listview.

Also, fixed a probable memory leak in the function UMLListView::moveObject



 M  +21 -2     umllistview.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #665607:665608
@@ -1396,14 +1396,15 @@
         if (newParentType == Uml::lvt_Class ||
                 newParentType == Uml::lvt_Interface) {
             // update list view
+
             newItem = move->deepCopy(newParent);
             // we don't delete move right away, it will be deleted in slots,
             // called by subsequent steps
             //delete move;
-            UMLClassifierListItem *cli = dynamic_cast<UMLClassifierListItem*>(srcObj);
-            newParent->addClassifierListItem(cli, newItem);
+
             // update model objects
             m_bCreatingChildObject = true;
+
             UMLClassifier *oldParentClassifier = dynamic_cast<UMLClassifier*>(srcObj->parent());
             UMLClassifier *newParentClassifier = dynamic_cast<UMLClassifier*>(newParentObj);
             if (srcType == Uml::lvt_Attribute) {
@@ -1424,7 +1425,11 @@
                     newAtt->setType(att->getType());
                     newAtt->setVisibility(att->getVisibility());
                     newAtt->setInitialValue(att->getInitialValue());
+
                     newItem->setUMLObject(newAtt);
+                    newParent->addClassifierListItem( newAtt, newItem );
+
+                    connectNewObjectsSlots( newAtt );
                     // Let's not forget to update the DocWindow::m_pObject
                     // because the old one is about to be physically deleted !
                     UMLApp::app()->getDocWindow()->showDocumentation(newAtt, true);
@@ -1457,6 +1462,10 @@
                         newOp->addParm(newParm);
                     }
                     newItem->setUMLObject(newOp);
+                    newParent->addClassifierListItem( newOp, newItem );
+
+                    connectNewObjectsSlots( newOp );
+
                     // Let's not forget to update the DocWindow::m_pObject
                     // because the old one is about to be physically deleted !
                     UMLApp::app()->getDocWindow()->showDocumentation(newOp, true);
@@ -2145,9 +2154,19 @@
         return false;
     }
 
+    // make changes to the object visible to this umllistviewitem
+    connectNewObjectsSlots( newObject );
     item->setUMLObject( newObject );
     item->setText( text );
     ensureItemVisible(item);
+
+    // if it's a ClassifierListItem add it to the childObjectMap of the parent
+    if ( type==Uml::ot_Template ||type == Uml::ot_Operation
+         || type == Uml::ot_Attribute || type == Uml::ot_EntityAttribute ) {
+        UMLClassifierListItem* classifierItem = static_cast<UMLClassifierListItem*>( newObject );
+      static_cast<UMLListViewItem*>( item->parent() )->addClassifierListItem(classifierItem, item );
+    }
+
     m_bCreatingChildObject = false;
 
     //m_doc->setModified();




More information about the umbrello-devel mailing list