[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg Oliver.Kellogg at t-online.de
Sat Sep 13 10:40:03 UTC 2003


CVS commit by okellogg: 

findWidget(): Add optional arg allowClassForObject.
loadAssociationsFromXMI(): Be forgiving about bad AssocWidgets.


  M +11 -4     umlview.cpp   1.86
  M +3 -2      umlview.h   1.36


--- kdesdk/umbrello/umbrello/umlview.cpp  #1.85:1.86
@@ -777,5 +777,5 @@ void UMLView::contentsMouseMoveEvent(QMo
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-UMLWidget * UMLView::findWidget( int id ) {
+UMLWidget * UMLView::findWidget( int id, bool allowClassForObject ) {
         UMLWidget *obj;
 
@@ -789,4 +789,6 @@ UMLWidget * UMLView::findWidget( int id 
                                 return obj;
                         }
+                        if (allowClassForObject && obj->getID() == id)
+                                return obj;
                 } else if( obj -> getID() == id ) {
                         return obj;
@@ -3223,8 +3225,13 @@ bool UMLView::loadAssociationsFromXMI( Q
                         AssociationWidget *assoc = new AssociationWidget(this);
                         if( !assoc->loadFromXMI( assocElement ) ) {
-                                assoc->cleanup(); delete assoc;
-                                return false;
-                        }
+                                assoc->cleanup();
+                                delete assoc;
+                                /* return false;
+                                   Returning false here is a little harsh when the
+                                   rest of the diagram might load okay.
+                                 */
+                        } else {
                         m_AssociationList.append( assoc );
+                        }
                 }
                 node = assocElement.nextSibling();

--- kdesdk/umbrello/umbrello/umlview.h  #1.35:1.36
@@ -380,8 +380,9 @@ public:
          *
          * @param       id      The ID of the widget to find.
+         * @param allowClassForObject   True if ok to return the class of an ObjectWidget.
          *
          * @return      Returns the widget found, returns 0 if no widget found.
          */
-        UMLWidget * findWidget(int id);
+        UMLWidget * findWidget(int id, bool allowClassForObject = false);
 
         /**






More information about the umbrello-devel mailing list