[Uml-devel] [Bug 94728] using a containment will crash umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Dec 9 12:38:01 UTC 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=94728        
okellogg users sourceforge net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From okellogg users sourceforge net  2004-12-09 21:36 -------
CVS commit by okellogg: 

slotMenuSelection(mt_Delete): In case of a containment, determine the new
 parent in the list view.
BUG:94728


  M +31 -5     associationwidget.cpp   1.134


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.133:1.134
 @ -12,7 +12,14  @
  *                                                                         *
  ***************************************************************************/
+
+// own header
+#include "associationwidget.h"
+// system includes
 #include <cstdlib>
 #include <cmath>
-
+// qt/kde includes
+#include <kdebug.h>
+#include <klocale.h>
+// app includes
 #include "activitywidget.h"
 #include "uml.h"
 @ -26,5 +33,4  @
 #include "attribute.h"
 #include "association.h"
-#include "associationwidget.h"
 #include "assocrules.h"
 #include "floatingtext.h"
 @ -33,7 +39,6  @
 #include "dialogs/assocpropdlg.h"
 #include "inputdialog.h"
-
-#include <kdebug.h>
-#include <klocale.h>
+#include "umllistview.h"
+#include "umllistviewitem.h"
 
 using namespace Uml;
 @ -2101,4 +2106,25  @ void AssociationWidget::slotMenuSelectio
 
         case ListPopupMenu::mt_Delete:
+                if (getAssocType() == at_Containment) {
+                        UMLListView *lv = UMLApp::app()->getListView();
+                        UMLObject *oldContainer = getWidget(A)->getUMLObject();
+                        UMLObject *objToBeMoved = getWidget(B)->getUMLObject();
+                        if (objToBeMoved == NULL) {
+                                m_pView->removeAssocInViewAndDoc(this);
+                                return;
+                        }
+                        UMLListViewItem *newLVParent = NULL;
+                        if (oldContainer) {
+                                UMLListViewItem *oldLVParent = lv->findUMLObject(oldContainer);
+                                if (oldLVParent)
+                                        newLVParent = dynamic_cast<UMLListViewItem*>(oldLVParent->parent());
+                        }
+                        if (newLVParent == NULL)
+                                newLVParent = lv->theLogicalView();
+                        Object_Type ot = objToBeMoved->getBaseType();
+                        lv->moveObject( objToBeMoved->getID(),
+                                        UMLListView::convert_OT_LVT(ot),
+                                        newLVParent );
+                }
                 m_pView->removeAssocInViewAndDoc(this);
                 break;




More information about the umbrello-devel mailing list