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

Oliver Kellogg okellogg at users.sourceforge.net
Sun Oct 1 15:42:38 UTC 2006


SVN commit 591054 by okellogg:

setCurrentRoot(): New.
addUMLObject(): Use currentRoot() when object->getUMLPackage() is NULL.


 M  +8 -19     umldoc.cpp  
 M  +9 -0      umldoc.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #591053:591054
@@ -762,27 +762,12 @@
         return false;
     }
     UMLPackage *pkg = object->getUMLPackage();
-    if (pkg != NULL) {
+    if (pkg == NULL) {
+        pkg = currentRoot();
         kdDebug() << "UMLDoc::addUMLObject(" << object->getName()
-                  << "): adding at containing package instead" << endl;
-        return pkg->addObject(object);
+            << "): no parent package set, assuming " << pkg->getName() << endl;
     }
-    /*
-    //stop it being added twice
-    if (m_objectList.find(object) != -1)  {
-        kdDebug() << "UMLDoc::addUMLObject: not adding " << object->getName()
-                  << " because it's already there." << endl;
-        return false;
-    }
-    if (prepend)
-        m_objectList.prepend(object);
-    else
-        m_objectList.append(object);
-     */
-    kdError() << "UMLDoc::addUMLObject(" << object->getName()
-       << "): no parent package set !" << endl;
-    kdBacktrace(25);
-    return false;
+    return pkg->addObject(object);
 }
 
 void UMLDoc::addStereotype(const UMLStereotype *s) {
@@ -1201,6 +1186,10 @@
     return f;
 }
 
+void UMLDoc::setCurrentRoot(Uml::Model_Type rootType) {
+    m_pCurrentRoot = m_root[rootType];
+}
+
 void UMLDoc::removeUMLObject(UMLObject* umlobject) {
     UMLApp::app()->getDocWindow()->updateDocumentation(true);
     Object_Type type = umlobject->getBaseType();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.h #591053:591054
@@ -626,6 +626,15 @@
     UMLFolder *currentRoot();
 
     /**
+     * Set the current root folder.
+     *
+     * @param rootType    The type of the root folder to set.
+     *                    The element from m_root[] which is indexed
+     *                    by this type is selected.
+     */
+    void setCurrentRoot(Uml::Model_Type rootType);
+
+    /**
      * Read property of IDChangeLog* m_pChangeLog.
      *
      * @return  Pointer to the IDChangeLog object.




More information about the umbrello-devel mailing list