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

Oliver Kellogg okellogg at users.sourceforge.net
Tue Aug 2 13:17:27 UTC 2005


SVN commit 442486 by okellogg:

CBUG:107347 - Address the second part of the PR about gratuitous use of
signals for updating the list view. This change reveals the need for
further design cleanups.


 M  +14 -9     classifier.cpp  
 M  +0 -6      classifier.h  
 M  +0 -8      umllistview.cpp  
 M  +0 -12     umlobject.h  
 M  +4 -1      umlwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifier.cpp #442485:442486
@@ -65,10 +65,6 @@
     return (m_BaseType == ot_Interface);
 }
 
-void UMLClassifier::signalChildObjectAdded(UMLClassifierListItem *childObj) {
-    emit childObjectAdded(childObj);
-}
-
 UMLOperation * UMLClassifier::checkOperationSignature( QString name,
         UMLAttributeList *opParams,
         UMLOperation *exemptOp)
@@ -212,7 +208,13 @@
         m_List.insert(position,op);
     else
         m_List.append( op );
-    emit childObjectAdded(op);
+    UMLDoc *umldoc = UMLApp::app()->getDocument();
+    if (!umldoc->loading()) {
+        // This adds operations at the listview. (Strangely, attributes don't
+        // need it.)    FIXME: Smells of hack.
+        UMLListView *listView = UMLApp::app()->getListView();
+        listView->childObjectAdded(op, this);
+    }
     emit operationAdded(op);
     emit modified();
     connect(op,SIGNAL(modified()),this,SIGNAL(modified()));
@@ -242,7 +244,8 @@
     // disconnection needed.
     // note that we dont delete the operation, just remove it from the Classifier
     disconnect(op,SIGNAL(modified()),this,SIGNAL(modified()));
-    emit childObjectRemoved(op);
+    UMLListView *listView = UMLApp::app()->getListView();
+    listView->childObjectRemoved(op);
     emit operationRemoved(op);
     emit modified();
     return m_List.count();
@@ -430,10 +433,12 @@
         for (UMLClassifierListItem *obj = m_List.first(); obj; obj = m_List.next())
          {  ....  }
          ****/
-        if (! obj->resolveRef())
+        if (! obj->resolveRef()) {
             success = false;
-        else
-            emit childObjectAdded(obj);
+        } else {
+            UMLListView *listView = UMLApp::app()->getListView();
+            listView->childObjectAdded(obj, this);
+        }
     }
     return success;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifier.h #442485:442486
@@ -434,14 +434,8 @@
      */
     bool hasAbstractOps ();
 
-    /**
-     * Emit the UMLObject::childObjectAdded signal for the given child object.
-     */
-    void signalChildObjectAdded(UMLClassifierListItem *childObj);
-
 signals:
     /** Signals that a new UMLOperation has been added to the classifer.
-     * The signal is emitted in addition to the generic childObjectAdded()
      */
     void operationAdded(UMLOperation *);
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umllistview.cpp #442485:442486
@@ -687,10 +687,6 @@
                 this,SLOT(childObjectAdded(UMLObject*)));
         connect(object,SIGNAL(attributeRemoved(UMLObject*)),
                 this,SLOT(childObjectRemoved(UMLObject*)));
-        connect(object,SIGNAL(childObjectAdded(UMLObject*)), // for operations
-                this,SLOT(childObjectAdded(UMLObject*)));
-        connect(object,SIGNAL(childObjectRemoved(UMLObject*)),
-                this,SLOT(childObjectRemoved(UMLObject*)));
         connect(object,SIGNAL(templateAdded(UMLObject*)),
                 this,SLOT(childObjectAdded(UMLObject*)));
         connect(object,SIGNAL(templateRemoved(UMLObject*)),
@@ -698,10 +694,6 @@
         connect(object,SIGNAL(modified()),this,SLOT(slotObjectChanged()));
         break;
     case Uml::ot_Interface:
-        connect(object,SIGNAL(childObjectAdded(UMLObject*)),
-                this,SLOT(childObjectAdded(UMLObject*)));
-        connect(object,SIGNAL(childObjectRemoved(UMLObject*)), // for operations
-                this,SLOT(childObjectRemoved(UMLObject*)));
         connect(object,SIGNAL(modified()),this,SLOT(slotObjectChanged()));
         break;
     case Uml::ot_Datatype:
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.h #442485:442486
@@ -334,18 +334,6 @@
       * itself emits the corresponding signal as well.
       */
     void modified();
-    /** Signals that a new UMLObject has been added to this object.
-      * More specialized classes like UMLPackage or UMLClassifier emit
-      * more specialized signals, like "classAdded" or "operationAdded" in
-      * addition to this one.
-      */
-    void childObjectAdded( UMLObject *obj );
-    /** Signals that a UMLObject has been removed from this object.
-      * More specialized classes like UMLPackage or UMLClassifier emit
-      * more specialized signals, like "classRemoved" or "operationRemoved" in
-      * addition to this one.
-      */
-    void childObjectRemoved( UMLObject *obj );
 
 protected:
     /**
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.cpp #442485:442486
@@ -547,12 +547,15 @@
         {
             UMLObject *pClone = m_pObject->clone();
             m_pView->addObject(pClone);
+            // Update the list view.
+            // CHECK: This smells of hack.
+            UMLListView *listview = UMLApp::app()->getListView();
             if (dynamic_cast<UMLClassifier*>(pClone)) {
                 UMLClassifier *c = static_cast<UMLClassifier*>(pClone);
                 UMLClassifierListItemList items = c->getFilteredList(Uml::ot_UMLObject);
                 for (UMLClassifierListItemListIt it(items); it.current(); ++it) {
                     UMLClassifierListItem *item = it.current();
-                    c->signalChildObjectAdded(item);
+                    listview->childObjectAdded(item, c);
                 }
             }
         }




More information about the umbrello-devel mailing list