]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't remove/insert an item if no moving has been done at all
authorPeter Penz <peter.penz19@gmail.com>
Sat, 2 Jun 2012 13:53:16 +0000 (15:53 +0200)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 2 Jun 2012 13:53:50 +0000 (15:53 +0200)
src/panels/places/placesitemmodel.cpp

index 02e1944bd2600767ee5b4f3ce6b94b299827c916..1138f13788f44156100341143aca35390da91336 100644 (file)
@@ -370,6 +370,10 @@ void PlacesItemModel::dropMimeData(int index, const QMimeData* mimeData)
         QDataStream stream(&itemData, QIODevice::ReadOnly);
         int oldIndex;
         stream >> oldIndex;
+        if (oldIndex == index || oldIndex == index - 1) {
+            // No moving has been done
+            return;
+        }
 
         PlacesItem* oldItem = placesItem(oldIndex);
         if (!oldItem) {
@@ -379,7 +383,7 @@ void PlacesItemModel::dropMimeData(int index, const QMimeData* mimeData)
         PlacesItem* newItem = new PlacesItem(oldItem->bookmark());
         removeItem(oldIndex);
 
-        if (oldIndex <= index) {
+        if (oldIndex < index) {
             --index;
         }