[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Mar 16 23:07:51 UTC 2005


CVS commit by okellogg: 

showOpDlg(): Hook up with the infrastructure around LinkWidget::m_pOperation.
BUG:53376


  M +20 -5     floatingtext.cpp   1.70


--- kdesdk/umbrello/umbrello/floatingtext.cpp  #1.69:1.70
@@ -28,4 +28,5 @@
 #include "listpopupmenu.h"
 #include "operation.h"
+#include "model_utils.h"
 #include "inputdialog.h"
 #include "dialogs/assocpropdlg.h"
@@ -249,6 +250,6 @@ void FloatingText::showOpDlg() {
                 return;
         }
-        QString seqNum, op;
-        UMLClassifier* c = m_pLink->getSeqNumAndOp(this, seqNum, op);
+        QString seqNum, opText;
+        UMLClassifier* c = m_pLink->getSeqNumAndOp(this, seqNum, opText);
         if (c == NULL) {
                 kdError() << "FloatingText::showOpDlg: "
@@ -260,5 +261,6 @@ void FloatingText::showOpDlg() {
         SelectOpDlg selectDlg(m_pView, c);
         selectDlg.setSeqNumber( seqNum );
-        selectDlg.setCustomOp( op );
+        if (m_pLink->getOperation() == NULL)
+                selectDlg.setCustomOp( opText );
         int result = selectDlg.exec();
         if(!result) {
@@ -266,6 +268,19 @@ void FloatingText::showOpDlg() {
         }
         seqNum = selectDlg.getSeqNumber();
-        op = selectDlg.getOpText();
-        m_pLink->setSeqNumAndOp(seqNum, op);
+        opText = selectDlg.getOpText();
+        Umbrello::OpDescriptor od;
+        Umbrello::Parse_Status st = Umbrello::parseOperation(opText, 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);
+                }
+                m_pLink->setOperation(op);
+                opText = QString::null;
+        }
+        m_pLink->setSeqNumAndOp(seqNum, opText);
         setMessageText();
 }






More information about the umbrello-devel mailing list