[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Fri Apr 16 15:54:07 UTC 2004


CVS commit by okellogg: 

setMulti(), setChangeWidget(): Return type is void.
setName, setMulti, setRoleName, setChangeWidget: Don't construct the
 FloatingText widget if the input string is empty.


  M +22 -9     associationwidget.cpp   1.93
  M +3 -3      associationwidget.h   1.39


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.92:1.93
@@ -292,4 +292,8 @@ void AssociationWidget::setName(QString 
         bool newLabel = false;
         if(!m_pName) {
+                // Don't construct the FloatingText if the string is empty.
+                if (strName.isEmpty())
+                        return;
+
                 newLabel = true;
                 m_pName = new FloatingText(m_pView, CalculateNameType(tr_Name), strName);
@@ -320,9 +324,13 @@ void AssociationWidget::setName(QString 
 }
 
-bool AssociationWidget::setMulti(QString strMulti, Role_Type role) {
+void AssociationWidget::setMulti(QString strMulti, Role_Type role) {
         bool newLabel = false;
         Text_Role tr = (role == A ? tr_MultiA : tr_MultiB);
 
         if(!m_role[role].m_pMulti) {
+                // Don't construct the FloatingText if the string is empty.
+                if (strMulti.isEmpty())
+                        return;
+
                 newLabel = true;
                 m_role[role].m_pMulti = new FloatingText(m_pView, tr, strMulti);
@@ -346,5 +354,4 @@ bool AssociationWidget::setMulti(QString
         else
                 m_role[role].m_pMulti -> hide();
-        return true;
 }
 
@@ -356,9 +363,9 @@ bool AssociationWidget::setMultiA(QStrin
                 return false;
         }
-        bool status = setMulti(strMultiA, A);
+        setMulti(strMultiA, A);
         // set attribute of UMLAssociation associated with this associationwidget
         if (m_pAssociation)
                 m_pAssociation->setMultiA(strMultiA);
-        return status;
+        return true;
 }
 
@@ -368,9 +375,9 @@ bool AssociationWidget::setMultiB(QStrin
         if( !AssocRules::allowMultiplicity( type, getWidgetB() -> getBaseType() ) )
                 return false;
-        bool status = setMulti(strMultiB, B);
+        setMulti(strMultiB, B);
         // set attribute of UMLAssociation associated with this associationwidget
         if (m_pAssociation)
                 m_pAssociation->setMultiB(strMultiB);
-        return status;
+        return true;
 }
 
@@ -386,4 +393,8 @@ bool AssociationWidget::setRoleName (QSt
         Text_Role tr = (role == A ? tr_RoleAName : tr_RoleBName);
         if(!m_role[role].m_pRole) {
+                // Don't construct the FloatingText if the string is empty.
+                if (strRole.isEmpty())
+                        return true;
+
                 newLabel = true;
                 m_role[role].m_pRole = new FloatingText(m_pView, tr, strRole);
@@ -512,9 +523,13 @@ void AssociationWidget::setChangeability
 }
 
-bool AssociationWidget::setChangeWidget(QString strChangeWidget, Role_Type role) {
+void AssociationWidget::setChangeWidget(QString strChangeWidget, Role_Type role) {
         bool newLabel = false;
         Text_Role tr = (role == A ? tr_ChangeA : tr_ChangeB);
 
         if(!m_role[role].m_pChangeWidget) {
+                // Don't construct the FloatingText if the string is empty.
+                if (strChangeWidget.isEmpty())
+                        return;
+
                 newLabel = true;
                 m_role[role].m_pChangeWidget = new FloatingText(m_pView, tr, strChangeWidget);
@@ -539,6 +554,4 @@ bool AssociationWidget::setChangeWidget(
         else
                 m_role[role].m_pChangeWidget -> hide();
-
-        return true;
 }
 

--- kdesdk/umbrello/umbrello/associationwidget.h  #1.38:1.39
@@ -834,5 +834,5 @@ private:
          * Auxiliary to setMulti{A,B}.
          */
-        bool setMulti(QString strMulti, Role_Type role);
+        void setMulti(QString strMulti, Role_Type role);
 
         /**
@@ -855,5 +855,5 @@ private:
          * Other classes/users should use setChangeability[AB] instead.
          */
-        bool setChangeWidget(QString strChangeWidget, Role_Type role);
+        void setChangeWidget(QString strChangeWidget, Role_Type role);
 
         /**






More information about the umbrello-devel mailing list