[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard

Oliver Kellogg okellogg at users.sourceforge.net
Sun Feb 4 14:53:05 UTC 2007


SVN commit 630136 by okellogg:

pasteClip5(): Assume success if at least one child object could be pasted.

 M  +10 -5     umlclipboard.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard/umlclipboard.cpp #630135:630136
@@ -580,11 +580,13 @@
     }
 
     UMLObject   *obj = 0;
-    UMLObjectListIt object_it(objects);
     doc->setModified(true);
     idchanges = doc->getChangeLog();
+    // Assume success if at least one child object could be pasted
+    if (objects.count())
+        result = false;
 
-    while ( (obj=object_it.current()) != 0 ) {
+    for (UMLObjectListIt it(objects); (obj = it.current()) != NULL; ++it) {
         obj->setID(doc->assignNewID(obj->getID()));
         switch(obj->getBaseType()) {
         case Uml::ot_Attribute :
@@ -595,7 +597,9 @@
                     obj->setName(newName);
                 }
                 UMLAttribute *att = static_cast<UMLAttribute*>(obj);
-                if (!parent->addAttribute(att, idchanges)) {
+                if (parent->addAttribute(att, idchanges)) {
+                    result = true;
+                } else {
                     kError() << "UMLClipboard::pasteClip5: " << parent->getName()
                         << "->addAttribute(" << att->getName() << ") failed" << endl;
                 }
@@ -609,7 +613,9 @@
                     QString newName = parent->uniqChildName(Uml::ot_Operation, obj->getName());
                     op->setName(newName);
                 }
-                if (!parent->addOperation(op, idchanges)) {
+                if (parent->addOperation(op, idchanges)) {
+                    result = true;
+                } else {
                     kError() << "UMLClipboard::pasteClip5: " << parent->getName()
                         << "->addOperation(" << op->getName() << ") failed" << endl;
                 }
@@ -619,7 +625,6 @@
             kWarning() << "pasteing unknown children type in clip type 5" << endl;
             return false;
         }
-        ++object_it;
     }
 
     return result;




More information about the umbrello-devel mailing list