[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue Oct 12 23:57:09 UTC 2004


CVS commit by okellogg: 

Fix bug 90206 (locks up when dragging folder to child folder)


  M +14 -5     umllistview.cpp   1.119
  M +15 -1     umllistviewitem.cpp   1.54
  M +6 -0      umllistviewitem.h   1.16


--- kdesdk/umbrello/umbrello/umllistview.cpp  #1.118:1.119
@@ -929,8 +929,11 @@ bool UMLListView::acceptDrag(QDropEvent*
                         case Uml::lvt_Interface:
                         case Uml::lvt_Enum:
-                                accept = (dstType == Uml::lvt_Logical_Folder ||
-                                          dstType == Uml::lvt_Logical_View ||
+                                if (dstType == Uml::lvt_Logical_View ||
                                           dstType == Uml::lvt_Class ||
-                                          dstType == Uml::lvt_Package);
+                                    dstType == Uml::lvt_Package) {
+                                        accept = !item->isOwnParent(data->id);
+                                } else {
+                                        accept = (dstType == Uml::lvt_Logical_Folder);
+                                }
                                 break;
                         case Uml::lvt_Datatype:
@@ -946,8 +949,14 @@ bool UMLListView::acceptDrag(QDropEvent*
                         case Uml::lvt_Activity_Diagram:
                         case Uml::lvt_Sequence_Diagram:
-                        case Uml::lvt_Logical_Folder:
                                 accept = (dstType == Uml::lvt_Logical_Folder ||
                                           dstType == Uml::lvt_Logical_View);
                                 break;
+                        case Uml::lvt_Logical_Folder:
+                                if (dstType == Uml::lvt_Logical_Folder) {
+                                        accept = !item->isOwnParent(data->id);
+                                } else {
+                                        accept = (dstType == Uml::lvt_Logical_View);
+                                }
+                                break;
                         case Uml::lvt_Actor:
                         case Uml::lvt_UseCase:

--- kdesdk/umbrello/umbrello/umllistviewitem.cpp  #1.53:1.54
@@ -158,5 +158,19 @@ void UMLListViewItem::setID(Uml::IDType 
         m_nId = id;
 }
-////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool UMLListViewItem::isOwnParent(Uml::IDType listViewItemID) {
+        QListViewItem *lvi = (QListViewItem*)s_pListView->findItem(listViewItemID);
+        if (lvi == NULL) {
+                kdError() << "UMLListViewItem::isOwnParent: ListView->findItem("
+                          << ID2STR(listViewItemID) << ") returns NULL" << endl;
+                return true;
+        }
+        for (QListViewItem *self = (QListViewItem*)this; self; self = self->parent()) {
+                if (lvi == self)
+                        return true;
+        }
+        return false;
+}
+
 void UMLListViewItem::updateObject() {
         if( m_pObject == NULL )

--- kdesdk/umbrello/umbrello/umllistviewitem.h  #1.15:1.16
@@ -122,4 +122,10 @@ public:
 
         /**
+         * Returns true if the UMLListViewItem of the given ID is a parent of
+         * this UMLListViewItem.
+         */
+        bool isOwnParent(Uml::IDType listViewItemID);
+
+        /**
          * Updates the representation of the object.
          */






More information about the umbrello-devel mailing list