[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello

Caroline Bourdeu d'Aguerre cbda at free.fr
Fri Feb 23 15:08:53 UTC 2007


SVN commit 636614 by bourdeu:

Move the function askTypeForWidget from dialog_utils to combinedfragmentwidget. Thanks to 
Florence :)


 M  +22 -0     combinedfragmentwidget.cpp  
 M  +3 -0      combinedfragmentwidget.h  
 M  +0 -21     dialog_utils.cpp  
 M  +0 -2      dialog_utils.h  
 M  +1 -1      toolbarstateother.cpp  


--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.cpp #636613:636614
@@ -232,6 +232,28 @@
     return true;
 }
 
+void CombinedFragmentWidget::askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
+                      const QString& dialogPrompt, const QString& defaultName) {
+
+    bool pressedOK = false;
+    const QStringList list = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
+    const QStringList select = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
+    QStringList result = KInputDialog::getItemList (dialogTitle, dialogPrompt, list, select, false, &pressedOK, UMLApp::app());
+
+    if (pressedOK) {
+        QString type = result.join("");
+        dynamic_cast<CombinedFragmentWidget*>(targetWidget)->setCombinedFragmentType(type);
+        if (type == "Reference")
+            Dialog_Utils::askNameForWidget(targetWidget, i18n("Enter the name of the diagram referenced"), i18n("Enter the name of the diagram referenced"), i18n("Diagram name"));
+        if (type == "Loop")
+            Dialog_Utils::askNameForWidget(targetWidget, i18n("Enter the guard of the loop"), i18n("Enter the guard of the loop"), i18n("-"));
+    } else {
+        targetWidget->cleanup();
+        delete targetWidget;
+        targetWidget = NULL;
+    }
+}
+
 void CombinedFragmentWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
     QDomElement combinedFragmentElement = qDoc.createElement( "combinedFragmentwidget" );
     UMLWidget::saveToXMI( qDoc, combinedFragmentElement );
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.h #636613:636614
@@ -87,6 +87,9 @@
      */
     bool showProperties();
 
+    void askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
+                      const QString& dialogPrompt, const QString& defaultName);
+
     /**
      * Saves the widget to the <combinedFragmentwidget> XMI element.
      */
--- branches/work/isi-umbrello/umbrello/umbrello/dialog_utils.cpp #636613:636614
@@ -58,27 +58,6 @@
     }
 }
 
-void askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
-                      const QString& dialogPrompt, const QString& defaultName) {
 
-    bool pressedOK = false;
-    const QStringList list = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
-    const QStringList select = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
-    QStringList result = KInputDialog::getItemList (dialogTitle, dialogPrompt, list, select, false, &pressedOK, UMLApp::app());
-
-    if (pressedOK) {
-        QString type = result.join("");
-        dynamic_cast<CombinedFragmentWidget*>(targetWidget)->setCombinedFragmentType(type);
-        if (type == "Reference")
-            askNameForWidget(targetWidget, i18n("Enter the name of the diagram referenced"), i18n("Enter the name of the diagram referenced"), i18n("Diagram name"));
-        if (type == "Loop")
-            askNameForWidget(targetWidget, i18n("Enter the guard of the loop"), i18n("Enter the guard of the loop"), i18n("-"));
-    } else {
-        targetWidget->cleanup();
-        delete targetWidget;
-        targetWidget = NULL;
-    }
-}
-
 }  // end namespace Dialog_Utils
 
--- branches/work/isi-umbrello/umbrello/umbrello/dialog_utils.h #636613:636614
@@ -59,8 +59,6 @@
  */
 void askNameForWidget(UMLWidget * &targetWidget, const QString& dialogTitle,
                       const QString& dialogPrompt, const QString& defaultName);
-void askNameForWidgetType(UMLWidget * &targetWidget, const QString& dialogTitle,
-                      const QString& dialogPrompt, const QString& defaultName);
 
 }
 
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstateother.cpp #636613:636614
@@ -193,7 +193,7 @@
             umlWidget, i18n("Enter Time Event Name"),
             i18n("Enter Time Event"), i18n("new time event"));
     } else if (getButton() == WorkToolBar::tbb_Seq_Combined_Fragment) {
-        Dialog_Utils::askNameForWidgetType(
+        dynamic_cast<CombinedFragmentWidget*>(umlWidget)->askNameForWidgetType(
             umlWidget, i18n("Enter Combined Fragment Name"),
             i18n("Enter the Combined Fragment"), i18n("new Combined Fragment"));
     } else if (getButton() == WorkToolBar::tbb_State) {




More information about the umbrello-devel mailing list