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

Oliver Kellogg okellogg at users.sourceforge.net
Wed Jun 8 22:40:58 UTC 2005


SVN commit 423638 by okellogg:

Backport unreopening of bug 72016 from main trunk.

 M  +13 -0     associationwidget.cpp  
 M  +15 -0     associationwidget.h  


--- branches/KDE/3.4/kdesdk/umbrello/umbrello/associationwidget.cpp #423637:423638
@@ -2720,7 +2720,20 @@
 	return rectangle;
 }
 
+void AssociationWidget::setUMLObject(UMLObject *obj) {
+	WidgetBase::setUMLObject(obj);
+	if (obj && obj->getBaseType() == Uml::ot_Attribute) {
+		UMLClassifier *klass = static_cast<UMLClassifier*>(obj->parent());
+		connect(klass, SIGNAL(attributeRemoved(UMLObject*)),
+			this, SLOT(slotAttributeRemoved(UMLObject*)));
+	}
+}
 
+void AssociationWidget::slotAttributeRemoved(UMLObject* obj) {
+	kdDebug() << "AssociationWidget::slotAttributeRemoved(" << obj->getName() << ")" << endl;
+	m_pView->removeAssoc(this);
+}
+
 void AssociationWidget::init (UMLView *view)
 {
 	m_pView = view;  // pointer to parent viewwidget object
--- branches/KDE/3.4/kdesdk/umbrello/umbrello/associationwidget.h #423637:423638
@@ -531,6 +531,13 @@
 	void calculateEndingPoints();
 
 	/**
+	 * Overriding the method from WidgetBase because we need to do
+	 * something extra in case this AssociationWidget represents
+	 * an attribute of a classifier.
+	 */
+	void setUMLObject(UMLObject *obj);
+
+	/**
 	 * Saves this widget to the <assocwidget> XMI element.
 	 */
 	void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
@@ -890,6 +897,14 @@
 	void slotClearAllSelected();
 
 	/**
+	 * Connected to UMLClassifier::attributeRemoved() in case this
+	 * AssociationWidget is linked to a classifer's attribute type.
+	 *
+	 * @param obj		The UMLAttribute removed.
+	 */
+	void slotAttributeRemoved(UMLObject* obj);
+
+	/**
 	 * Synchronize this widget from the UMLAssociation.
 	 */
 	void syncToModel();




More information about the umbrello-devel mailing list