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

Oliver Kellogg okellogg at users.sourceforge.net
Sat Sep 16 09:33:07 UTC 2006


SVN commit 585086 by okellogg:

UMLDoc::currentRoot(): New. Set the container on UMLAssociations. Thanks Daniel for reminding ;)

 M  +2 -1      association.cpp  
 M  +14 -0     umldoc.cpp  
 M  +6 -0      umldoc.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/association.cpp #585085:585086
@@ -17,6 +17,7 @@
 #include <qregexp.h>
 // app includes
 #include "classifier.h"
+#include "folder.h"
 #include "uml.h"
 #include "umldoc.h"
 #include "umlrole.h"
@@ -553,7 +554,7 @@
     m_Name = "";
     m_bOldLoadMode = false;
     nrof_parent_widgets = -1;
-
+    m_pUMLPackage = UMLApp::app()->getDocument()->currentRoot();
     m_pRole[Uml::A] = new UMLRole (this, roleAObj, Uml::A);
     m_pRole[Uml::B] = new UMLRole (this, roleBObj, Uml::B);
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #585085:585086
@@ -1179,6 +1179,20 @@
     }
 }
 
+UMLFolder *UMLDoc::currentRoot() {
+    UMLView *currentView = UMLApp::app()->getCurrentView();
+    if (currentView == NULL) {
+        kdError() << "UMLDoc::currentRoot: currentView is NULL, assuming Logical View"
+            << endl;
+        return m_root[Uml::mt_Logical];
+    }
+    UMLFolder *f = currentView->getFolder();
+    while (f->getUMLPackage()) {
+        f = static_cast<UMLFolder*>(f->getUMLPackage());
+    }
+    return f;
+}
+
 void UMLDoc::removeUMLObject(UMLObject* umlobject) {
     UMLApp::app()->getDocWindow()->updateDocumentation(true);
     Object_Type type = umlobject->getBaseType();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.h #585085:585086
@@ -627,6 +627,12 @@
     Uml::Model_Type rootFolderType(UMLObject *obj);
 
     /**
+     * Return the currently selected root folder.
+     * This will be an element from the m_root[] array.
+     */
+    UMLFolder *currentRoot();
+
+    /**
      * Read property of IDChangeLog* m_pChangeLog.
      *
      * @return  Pointer to the IDChangeLog object.




More information about the umbrello-devel mailing list