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

Gopala Krishna A krishna.ggk at gmail.com
Mon Aug 31 20:39:32 UTC 2009


SVN commit 1017899 by gopala:

* Fix wrong size of Widgets on creating them from Toolbar and mouse.
* Improvised CombinedFragmentWidget by not showing partially constructed
  FloatingDashLineWidgets.


 M  +1 -1      umlscene.cpp  
 M  +25 -6     widgets/combinedfragmentwidget.cpp  
 M  +1 -0      widgets/combinedfragmentwidget.h  
 M  +1 -1      widgets/widget_factory.cpp  


--- branches/work/soc-umbrello/umbrello/umlscene.cpp #1017898:1017899
@@ -1674,7 +1674,7 @@
     case wt_UseCase:
     case wt_Category: {
         Uml::IDType id = pWidget->id();
-        Uml::IDType newID = log->findNewID(id);
+        Uml::IDType newID = log ? log->findNewID(id) : Uml::id_None;
         if (newID == Uml::id_None) {   // happens after a cut
             if (id == Uml::id_None)
                 return false;
--- branches/work/soc-umbrello/umbrello/widgets/combinedfragmentwidget.cpp #1017898:1017899
@@ -173,12 +173,30 @@
                                            i18n("Enter the first alternative name"),
                                            i18n("-"));
         }
+
+        foreach (FloatingDashLineWidget *fld, m_dashLines) {
+            if (fld->isActivated() == false) {
+                fld->activate();
+            }
+        }
     } else {
         delete targetWidget;
         targetWidget = 0;
     }
 }
 
+
+bool CombinedFragmentWidget::activate()
+{
+    setActivatedFlag(false);
+    bool status = true;
+    foreach (FloatingDashLineWidget *fld, m_dashLines) {
+        status = status && fld->activate();
+        if (!status) return false;
+    }
+    return UMLWidget::activate();
+}
+
 /**
  * Reimplemented from UMLWidget::loadFromXMI to load
  * CombinedFragmentWidget data from XMI.
@@ -207,18 +225,17 @@
                 delete fdlwidget;
                 return false;
             }
-            else {
-                m_dashLines.append(fdlwidget);
-                // No need to call setupFloatingWidget as that will reset
-                // the line properties of FloatingDashLineWidget.
-            }
+
+            // No need to call setupFloatingWidget as that will reset
+            // the line properties of FloatingDashLineWidget.
+            m_dashLines.append(fdlwidget);
         } else {
             uError() << "unknown tag " << tag << endl;
         }
         node = node.nextSibling();
         element = node.toElement();
     }
-   // m_dashLines = listline;
+    // m_dashLines = listline;
     setCombinedFragmentType( (CombinedFragmentType)type.toInt() );
 
     return true;
@@ -263,6 +280,8 @@
 
     if(sel == ListPopupMenu::mt_AddInteractionOperand) {
         FloatingDashLineWidget *flwd = new FloatingDashLineWidget(this);
+        bool status = flwd->activate(); // should always succeeed
+        Q_ASSERT(status);
         m_dashLines.append(flwd);
 
         if(combinedFragmentType() == Alt) {
--- branches/work/soc-umbrello/umbrello/widgets/combinedfragmentwidget.h #1017898:1017899
@@ -60,6 +60,7 @@
 
     void askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
                               const QString& dialogPrompt, const QString& defaultName);
+    virtual bool activate();
 
     bool loadFromXMI( QDomElement & qElement );
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
--- branches/work/soc-umbrello/umbrello/widgets/widget_factory.cpp #1017898:1017899
@@ -152,7 +152,7 @@
 
     if (newWidget) {
         newWidget->setPos(pos.x(), y);
-        scene->addItem(newWidget);
+        scene->addWidget(newWidget);
     }
 
     return newWidget;




More information about the umbrello-devel mailing list