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

Oliver Kellogg okellogg at users.sourceforge.net
Tue May 8 22:24:40 UTC 2007


SVN commit 662702 by okellogg:

http://www.geeksoc.org/~jr/umbrello/uml-devel/10220.html
Thanks to Danny Beullens for reviewing the code.


 M  +9 -26     associationwidget.cpp  
 M  +0 -1      floatingtextwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #662701:662702
@@ -117,12 +117,6 @@
         // Create a temporary name to bring on setName()
         int collabID = m_pView->generateCollaborationId();
         setName('m' + QString::number(collabID));
-        if (m_pObject) {
-            m_pName->setUMLObject( m_pObject );
-        } else {
-            ObjectWidget *ow = static_cast<ObjectWidget*>(m_role[B].m_pWidget);
-            m_pName->setUMLObject( ow->getUMLObject() );
-        }
     }
 }
 
@@ -313,43 +307,35 @@
 }
 
 void AssociationWidget::setName(const QString &strName) {
+    // set attribute of UMLAssociation associated with this associationwidget
+    UMLAssociation *umla = getAssociation();
+    if (umla)
+        umla->setName(strName);
+
     bool newLabel = false;
     if(!m_pName) {
         // Don't construct the FloatingTextWidget if the string is empty.
-        if (strName.isEmpty())
+        if (! FloatingTextWidget::isTextValid(strName))
             return;
 
         newLabel = true;
         m_pName = new FloatingTextWidget(m_pView, CalculateNameType(tr_Name), strName);
         m_pName->setLink(this);
-        if (m_role[B].m_pWidget)
-            m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());
     } else {
         m_pName->setText(strName);
-        /**** This code leads to bug 141813 (unable to delete label or multi)
-        if (strName.isEmpty()) {
-            m_pName->hide();
+        if (! FloatingTextWidget::isTextValid(strName)) {
+            //m_pName->hide();
+            m_pView->removeWidget(m_pName);
             m_pName = NULL;
             return;
         }
-         ********************************************************************/
     }
 
-    // set attribute of UMLAssociation associated with this associationwidget
-    if (m_pObject)
-        m_pObject->setName(strName);
-
     setTextPosition( tr_Name );
     if (newLabel) {
         m_pName->setActivated();
         m_pView->addWidget(m_pName);
     }
-
-    if(FloatingTextWidget::isTextValid(m_pName->getText()))
-        m_pName -> show();
-    else
-        m_pName -> hide();
-
 }
 
 void AssociationWidget::setFloatingText(Uml::Text_Role tr,
@@ -629,9 +615,6 @@
         } else {
             m_pName-> hide();
         }
-        if( m_pView->getType() == dt_Collaboration && m_pName) {
-            m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());
-        }
         m_pName->activate();
         calculateNameTextSegment();
     }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/floatingtextwidget.cpp #662701:662702
@@ -203,7 +203,6 @@
                 break;
               default:
                 assoc->setName(QString::null);
-                m_pView->removeWidget(this);
                 break;
             }
         } else {




More information about the umbrello-devel mailing list