[Uml-devel] kdesdk/umbrello/umbrello
Luis De la Parra Blum
lparrab at gmx.net
Thu Apr 3 16:04:41 UTC 2003
CVS commit by luis:
Fixed bug introduced by myself...
you can now create elements again
M +40 -42 umldoc.cpp 1.34
--- kdesdk/umbrello/umbrello/umldoc.cpp #1.33:1.34
@@ -522,24 +522,28 @@ UMLObject* UMLDoc::createUMLObject(UMLOb
bool ok = false;
int id;
- bool askForName = !n.isEmpty();
- QString name = n,
- currentName = uniqObjectName(type);
UMLObject *o = 0L;
- while (true) {
- if( askForName ){
- name = KLineEditDlg::getText(i18n("Enter name:"), currentName, &ok, (QWidget*)parent());
+ QString name;
+ if( n.length() != 0 && !(o = findUMLObject(type,n)) )
+ {
+ name = n;
}
- currentName = name;
+ else
+ {
+ name = uniqObjectName(type);
+ do {
+ name = KLineEditDlg::getText(i18n("Enter name:"), name, &ok, (QWidget*)parent());
if (!ok) {
- break;
+ return;
}
- o = findUMLObject(type, name);
if (name.length() == 0) {
KMessageBox::error(0, i18n("That is an invalid name."), i18n("Invalid Name"));
+ continue;
}
+ o = findUMLObject(type, name);
if (o) {
KMessageBox::error(0, i18n("That name is already being used."), i18n("Not a Unique Name"));
- askForName = true;
- } else { //create an object
+ }
+ }while( name.length() == 0 || o != 0L );
+ }
id = getUniqueID();
@@ -563,7 +566,6 @@ UMLObject* UMLDoc::createUMLObject(UMLOb
} else {
kdWarning() << "CreateUMLObject(int) error" << endl;
- return o;
+ return (UMLObject*)0L;
}
-
objectList.append(o);
emit sigObjectCreated(o);
@@ -568,9 +570,5 @@ UMLObject* UMLDoc::createUMLObject(UMLOb
objectList.append(o);
emit sigObjectCreated(o);
-
setModified(true);
- break;
- }
- }//end while
return o;
}
More information about the umbrello-devel
mailing list