[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Mar 19 01:23:14 UTC 2005


CVS commit by okellogg: 

loadFromXMI(): Attempt setting the m_pOperation from the operation text.
Required when reading old files where the op text was saved instead of
the operation's xmi.id.


  M +18 -0     messagewidget.cpp   1.64


--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.63:1.64
@@ -837,4 +837,22 @@ bool MessageWidget::loadFromXMI(QDomElem
                         // Just setting it empty for the sake of sanity.
                         m_CustomOp = QString::null;
+                } else {
+                        // Previous umbrello versions saved the operation text
+                        // instead of the xmi.id of the operation.
+                        // For backward compatibility, attempt to determine the
+                        // m_pOperation from the operation text:
+                        Umbrello::OpDescriptor od;
+                        Umbrello::Parse_Status st = Umbrello::parseOperation(m_CustomOp, od, c);
+                        if (st == Umbrello::PS_OK) {
+                                UMLDoc *umldoc = UMLApp::app()->getDocument();
+                                bool isExistingOp = false;
+                                UMLObject *o = umldoc->createOperation(c, od.m_name, &isExistingOp, &od.m_args);
+                                UMLOperation *op = static_cast<UMLOperation*>(o);
+                                if (od.m_pReturnType) {
+                                        op->setType(od.m_pReturnType);
+                                }
+                                setOperation(op);
+                                m_CustomOp = QString::null;
+                        }
                 }
         }






More information about the umbrello-devel mailing list