[Uml-devel] KDE/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Jul 18 05:29:32 UTC 2007
SVN commit 689341 by okellogg:
apply r688793 from branches/KDE/3.5
M +1 -0 ChangeLog
M +14 -0 umbrello/associationwidget.cpp
M +8 -0 umbrello/associationwidget.h
M +13 -1 umbrello/attribute.cpp
M +20 -0 umbrello/attribute.h
M +2 -2 umbrello/umlobject.h
--- trunk/KDE/kdesdk/umbrello/ChangeLog #689340:689341
@@ -8,6 +8,7 @@
* The size of a fork/join is not restored (147069)
* Crash when changing the association type to containment (147202)
* Moving component on diagram results in absurd shape of self-association (147810)
+* Crash when changing the attribute name (147919)
Version 1.5.71
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp #689340:689341
@@ -3216,6 +3216,7 @@
if (obj == NULL)
return;
UMLClassifier *klass = NULL;
+ UMLAttribute *attr = NULL;
UMLEntity *ent = NULL;
const Uml::Object_Type ot = obj->getBaseType();
switch (ot) {
@@ -3229,6 +3230,8 @@
klass = static_cast<UMLClassifier*>(obj->parent());
connect(klass, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
this, SLOT(slotClassifierListItemRemoved(UMLClassifierListItem*)));
+ attr = static_cast<UMLAttribute*>(obj);
+ connect(attr, SIGNAL(attributeChanged()), this, SLOT(slotAttributeChanged()));
break;
case Uml::ot_EntityAttribute:
ent = static_cast<UMLEntity*>(obj->parent());
@@ -3255,6 +3258,17 @@
m_pView->removeAssoc(this);
}
+void AssociationWidget::slotAttributeChanged() {
+ UMLAttribute *attr = getAttribute();
+ if (attr == NULL) {
+ kError() << "AssociationWidget::slotAttributeChanged: getAttribute returns NULL"
+ << endl;
+ return;
+ }
+ setVisibility(attr->getVisibility(), B);
+ setRoleName(attr->getName(), B);
+}
+
void AssociationWidget::init (UMLView *view)
{
WidgetBase::init(view, wt_Association);
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h #689340:689341
@@ -1041,6 +1041,14 @@
/**
+ * Connected to UMLObject::modified() in case this
+ * AssociationWidget is linked to a classifer's attribute type.
+ *
+ * @param obj The UMLAttribute removed.
+ */
+ void slotAttributeChanged();
+
+ /**
* Synchronize this widget from the UMLAssociation.
*/
void syncToModel();
--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.cpp #689340:689341
@@ -48,6 +48,18 @@
UMLAttribute::~UMLAttribute() { }
+void UMLAttribute::setName(const QString &name) {
+ m_Name = name;
+ emit attributeChanged();
+ UMLObject::emitModified();
+}
+
+void UMLAttribute::setVisibility(Uml::Visibility s) {
+ m_Vis = s;
+ emit attributeChanged();
+ UMLObject::emitModified();
+}
+
QString UMLAttribute::getInitialValue() {
return m_InitialValue;
}
@@ -312,4 +324,4 @@
}
-
+#include "attribute.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.h #689340:689341
@@ -26,6 +26,7 @@
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
class UMLAttribute : public UMLClassifierListItem {
+ Q_OBJECT
public:
/**
* Sets up an attribute.
@@ -66,6 +67,18 @@
virtual void copyInto(UMLAttribute *rhs) const;
/**
+ * Reimplementation of method from UMLObject is required as
+ * an extra signal, attributeChanged(), is emitted.
+ */
+ void setName(const QString &name);
+
+ /**
+ * Reimplementation of method from UMLObject is required as
+ * an extra signal, attributeChanged(), is emitted.
+ */
+ void setVisibility(Uml::Visibility s);
+
+ /**
* Make a clone of the UMLAttribute.
*/
virtual UMLObject* clone() const;
@@ -117,6 +130,13 @@
*/
virtual UMLClassifierList getTemplateParams();
+signals:
+ /**
+ * Required for informing AssociationWidgets representing this attribute
+ * that the attribute name or visibility has changed.
+ */
+ void attributeChanged();
+
protected:
/**
* Loads the <UML:Attribute> XMI element.
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.h #689340:689341
@@ -131,7 +131,7 @@
*
* @param s The visibility of the object.
*/
- void setVisibility(Uml::Visibility s);
+ virtual void setVisibility(Uml::Visibility s);
/**
* Method used by setVisibility: its called by cmdSetVisibility, Don't use it!
@@ -239,7 +239,7 @@
/**
* Set the UMLObject's name
*/
- void setName(const QString &strName);
+ virtual void setName(const QString &strName);
/**
* Method used by setName: its called by cmdSetName, Don't use it!
More information about the umbrello-devel
mailing list