Bug 95951 - cannot have two diagrams with the same name
Summary: cannot have two diagrams with the same name
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-28 22:29 UTC by Marcos Mayorga
Modified: 2004-12-30 20:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos Mayorga 2004-12-28 22:29:54 UTC
Version:           1.3.90 (using KDE 3.3.89 (CVS >= 20041104), compiled sources)
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-13)
OS:                Linux (i686) release 2.6.8.1

The full quialified name (container_name:: ... ::name) is what must be different, not just the name of the diagram. It should be possible to have diagrams with the same name in diferent folders.
Comment 1 Oliver Kellogg 2004-12-30 20:18:58 UTC
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.