[Uml-devel] kdesdk/umbrello/umbrello

Brian Thomas thomas at mail630.gsfc.nasa.gov
Thu Apr 15 11:50:05 UTC 2004


CVS commit by thomas: 

bug fix: umlrole should use parent umlobj 'scope' field to store visibility information


  M +11 -9     umlrole.cpp   1.15
  M +1 -2      umlrole.h   1.12


--- kdesdk/umbrello/umbrello/umlrole.h  #1.11:1.12
@@ -167,5 +167,4 @@ private:
         QString m_Name;
         QString m_Multi;
-        Scope m_Visibility;
         Changeability_Type m_Changeability;
 

--- kdesdk/umbrello/umbrello/umlrole.cpp  #1.14:1.15
@@ -29,5 +29,4 @@ bool UMLRole::operator==(UMLRole &rhs) {
         return( UMLObject::operator==( rhs ) &&
                 m_Changeability == rhs.m_Changeability &&
-                m_Visibility == rhs.m_Visibility &&
                 m_Multi == rhs.m_Multi &&
                 m_Name == rhs.m_Name
@@ -58,5 +57,5 @@ Changeability_Type UMLRole::getChangeabi
 
 Scope UMLRole::getVisibility() const {
-        return m_Visibility;
+        return getScope();
 }
 
@@ -99,6 +98,5 @@ void UMLRole::setObject (UMLObject *obj)
 
 void UMLRole::setVisibility (Scope value) {
-        m_Visibility = value;
-        emit modified();
+        setScope(value);
 }
 
@@ -134,5 +132,4 @@ void UMLRole::init(UMLAssociation * pare
         m_Multi = "";
         m_Name = "";
-        m_Visibility = Public;
         m_Changeability = chg_Changeable;
 
@@ -167,5 +164,5 @@ bool UMLRole::saveToXMI( QDomDocument & 
                         roleElement.setAttribute("isNavigable", "true");
         }
-        switch (m_Visibility) {
+        switch (getScope()) {
                 case Uml::Private:
                         roleElement.setAttribute("visibility", "private");
@@ -174,4 +171,5 @@ bool UMLRole::saveToXMI( QDomDocument & 
                         roleElement.setAttribute("visibility", "protected");
                         break;
+                default:
                 case Uml::Public:
                         roleElement.setAttribute("visibility", "public");
@@ -219,4 +218,6 @@ bool UMLRole::loadFromXMI( QDomElement &
         m_pObject = obj;
 
+        // block signals to prevent needless updating
+        blockSignals(true);
         // Here comes the handling of the association type.
         // This is open for discussion - I'm pretty sure there are better ways..
@@ -262,10 +263,9 @@ bool UMLRole::loadFromXMI( QDomElement &
 
         // visibilty defaults to Public if it cant set it here..
-        m_Visibility = Uml::Public;
         QString vis = element.attribute("visibility", "public");
         if (vis == "private")
-                m_Visibility = Uml::Private;
+                setScope(Uml::Private);
         else if (vis == "protected")
-                m_Visibility = Uml::Protected;
+                setScope(Uml::Protected);
 
         // Changeability defaults to Changeable if it cant set it here..
@@ -277,4 +277,6 @@ bool UMLRole::loadFromXMI( QDomElement &
                 m_Changeability = Uml::chg_AddOnly;
 
+        // finished config, now unblock
+        blockSignals(false);
         return true;
 }






More information about the umbrello-devel mailing list