[Uml-devel] kdesdk/umbrello/umbrello

Brian Thomas thomas at mail630.gsfc.nasa.gov
Sun Aug 31 15:33:01 UTC 2003


CVS commit by thomas: 

added better handling of associations. New signals: sigAssociationAdded sigAssociationRemoved were added AND you should pass an actual pointer to UMLAssociation inforced for removeAssocation


  M +4 -2      umlcanvasobject.cpp   1.5
  M +16 -1     umlcanvasobject.h   1.4


--- kdesdk/umbrello/umbrello/umlcanvasobject.h  #1.3:1.4
@@ -30,4 +30,5 @@ class UMLAssociation;
 
 class UMLCanvasObject : public UMLObject {
+        Q_OBJECT
 public:
         /**
@@ -79,5 +80,5 @@ public:
          *      @param  o       The association to remove.
          */
-        int removeAssociation(UMLObject *o);
+        int removeAssociation(UMLAssociation *assoc);
  
         /**
@@ -166,4 +167,18 @@ protected:
          */
         QPtrList<UMLAssociation> m_TmpAssocs;
+
+
+signals:
+        /**
+         * Emit when new association is added.
+         * @param assoc Pointer to the association which has been added.
+         */
+        void sigAssociationAdded(UMLAssociation * assoc);
+
+        /**
+         * Emit when new association is removed.
+         * @param assoc Pointer to the association which has been removed.
+         */
+        void sigAssociationRemoved(UMLAssociation * assoc);
 
 };

--- kdesdk/umbrello/umbrello/umlcanvasobject.cpp  #1.4:1.5
@@ -41,4 +41,5 @@ bool UMLCanvasObject::addAssociation(UML
         m_AssocsList.append( assoc );
         emit modified();
+        emit sigAssociationAdded(assoc);
         return true;
 }
@@ -50,10 +51,11 @@ bool UMLCanvasObject::hasAssociation(UML
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-int UMLCanvasObject::removeAssociation(UMLObject* a) {
-        if(!m_AssocsList.remove((UMLAssociation *)a)) {
+int UMLCanvasObject::removeAssociation(UMLAssociation * assoc) {
+        if(!m_AssocsList.remove(assoc)) {
                 kdWarning() << "can't find assoc given in list" << endl;
                 return -1;
         }
         emit modified();
+        emit sigAssociationRemoved(assoc);
         return m_AssocsList.count();
 }






More information about the umbrello-devel mailing list