[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Mon Jan 3 12:08:16 UTC 2005


CVS commit by okellogg: 

addTemplate(): Check that the template param is not already known.


  M +8 -5      classifier.cpp   1.66
  M +1 -1      classifier.h   1.47


--- kdesdk/umbrello/umbrello/classifier.cpp  #1.65:1.66
@@ -331,10 +331,13 @@ UMLClassifierListItemList UMLClassifier:
 
 UMLTemplate* UMLClassifier::addTemplate(const QString &name, Uml::IDType id) {
-        UMLTemplate* newTemplate = new UMLTemplate(this, name, id);
-        m_List.append(newTemplate);
+        UMLTemplate *t = findTemplate(name);
+        if (t)
+                return t;
+        t = new UMLTemplate(this, name, id);
+        m_List.append(t);
         emit modified();
-        connect(newTemplate,SIGNAL(modified()),this,SIGNAL(modified()));
-        emit templateAdded(newTemplate);
-        return newTemplate;
+        connect(t, SIGNAL(modified()), this, SIGNAL(modified()));
+        emit templateAdded(t);
+        return t;
 }
 

--- kdesdk/umbrello/umbrello/classifier.h  #1.46:1.47
@@ -153,5 +153,5 @@ public:
 
         /**
-         * Adds a template to the class.
+         * Adds a template to the class if it is not there yet.
          *
          * @param name          The name of the template.






More information about the umbrello-devel mailing list