[Uml-devel] kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Dec 30 11:19:02 UTC 2004


CVS commit by okellogg: 

BUG:95951 - folders create a separate name scope for diagrams in the list view


  M +1 -1      ChangeLog   1.54
  M +22 -8     umbrello/umldoc.cpp   1.230
  M +3 -1      umbrello/umldoc.h   1.93
  M +1 -1      umbrello/umllistview.h   1.54


--- kdesdk/umbrello/ChangeLog  #1.53:1.54
@@ -25,5 +25,5 @@
 92116 92123 92222 92300 92301 92781 92995 93122 93219 93297
 93501 93595 93696 94173 94728 94795 94883 95082 95252 95722
-95924
+95924 95951
 
 Version 1.3

--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.229:1.230
@@ -172,5 +172,5 @@ void UMLDoc::removeView(UMLView *view , 
         //remove all widgets before deleting view
         view->removeAllWidgets();
-        // m_ViewLiset is set to autodelete!!
+        // m_ViewList is set to autodelete!!
         m_ViewList.remove(view);
         if (m_currentView == view)
@@ -743,5 +743,6 @@ CodeGenerator * UMLDoc::findCodeGenerato
 
 UMLView * UMLDoc::findView(Uml::IDType id) {
-        for(UMLView *w = m_ViewList.first(); w; w = m_ViewList.next()) {
+        for (UMLViewListIt vit(m_ViewList); vit.current(); ++vit) {
+                UMLView *w = vit.current();
                 if(w->getID() ==id) {
                         return w;
@@ -752,11 +753,25 @@ UMLView * UMLDoc::findView(Uml::IDType i
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-UMLView * UMLDoc::findView(Diagram_Type type, const QString &name) {
-        for(UMLView *w = m_ViewList.first(); w; w = m_ViewList.next()) {
+UMLView * UMLDoc::findView(Diagram_Type type, const QString &name,
+                           bool searchAllScopes /* =false */) {
+        UMLListView *listView = UMLApp::app()->getListView();
+        UMLListViewItem *currentItem = static_cast<UMLListViewItem*>(listView->currentItem());
+        if (searchAllScopes || ! UMLListView::typeIsFolder(currentItem->getType())) {
+                for (UMLViewListIt vit(m_ViewList); vit.current(); ++vit) {
+                        UMLView *w = vit.current();
                 if( (w->getType() == type) && ( w->getName() == name) ) {
                         return w;
                 }
         }
-        return 0;
+                return NULL;
+        }
+        for (QListViewItemIterator it(currentItem); it.current(); ++it) {
+                UMLListViewItem *item = static_cast<UMLListViewItem*>(it.current());
+                if (! UMLListView::typeIsDiagram(item->getType()))
+                        continue;
+                if (item->getText() == name)
+                        return findView(item->getID());
+        }
+        return NULL;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1523,5 +1538,4 @@ void UMLDoc::renameDiagram(Uml::IDType i
                         KMessageBox::error(0, i18n("A diagram is already using that name."), i18n("Not a Unique Name"));
         }
-        return;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////

--- kdesdk/umbrello/umbrello/umldoc.h  #1.92:1.93
@@ -493,7 +493,9 @@ public:
          * @param type          The type of view to find.
          * @param name          The name of the view to find.
+         * @param searchAllScopes Search in all subfolders (default: false.)
          * @return      Pointer to the view found, or NULL if not found.
          */
-        UMLView * findView(Uml::Diagram_Type type, const QString &name);
+        UMLView * findView(Uml::Diagram_Type type, const QString &name,
+                           bool searchAllScopes = false);
 
 

--- kdesdk/umbrello/umbrello/umllistview.h  #1.53:1.54
@@ -372,5 +372,5 @@ class UMLListView : public KListView {
          * This methods looks for a object in a folder an its subfolders recursive.
          * @param item The folder entry of the list view.
-         * @param o The object to be find in the folder.
+         * @param o The object to be found in the folder.
          *
          * @return The object if found else a NULL pointer.






More information about the umbrello-devel mailing list