[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Dec 29 14:46:12 UTC 2004


CVS commit by okellogg: 

createTemplate(): Add an optional 'name' arg.


  M +7 -6      umldoc.cpp   1.227
  M +1 -1      umldoc.h   1.92


--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.226:1.227
@@ -1114,10 +1114,11 @@ UMLObject* UMLDoc::createAttribute(UMLCl
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-UMLObject* UMLDoc::createTemplate(UMLClass* umlclass) {
-        QString currentName = umlclass->uniqChildName(Uml::ot_Template);
-        UMLTemplate* newTemplate = new UMLTemplate(umlclass, currentName);
+UMLObject* UMLDoc::createTemplate(UMLClassifier* o, QString currentName /*= QString::null*/) {
+        bool goodName = !currentName.isEmpty();
+        if (!goodName)
+                currentName = o->uniqChildName(Uml::ot_Template);
+        UMLTemplate* newTemplate = new UMLTemplate(o, currentName);
 
         int button = QDialog::Accepted;
-        bool goodName = false;
 
         while (button==QDialog::Accepted && !goodName) {
@@ -1128,5 +1129,5 @@ UMLObject* UMLDoc::createTemplate(UMLCla
                 if(name.length() == 0) {
                         KMessageBox::error(0, i18n("That is an invalid name."), i18n("Invalid Name"));
-                } else if ( umlclass->findChildObject(Uml::ot_Template, name).count() > 0 ) {
+                } else if ( o->findChildObject(Uml::ot_Template, name).count() > 0 ) {
                         KMessageBox::error(0, i18n("That name is already being used."), i18n("Not a Unique Name"));
                 } else {
@@ -1139,5 +1140,5 @@ UMLObject* UMLDoc::createTemplate(UMLCla
         }
 
-        umlclass->addTemplate(newTemplate);
+        o->addTemplate(newTemplate);
 
         emit sigObjectCreated(newTemplate);

--- kdesdk/umbrello/umbrello/umldoc.h  #1.91:1.92
@@ -287,5 +287,5 @@ public:
          * @return      The UMLTemplate created
          */
-        UMLObject* createTemplate(UMLClass* umlclass);
+        UMLObject* createTemplate(UMLClassifier* o, QString name = QString::null);
 
         /**






More information about the umbrello-devel mailing list