From: Peter Penz Date: Sat, 2 Jun 2012 13:53:16 +0000 (+0200) Subject: Don't remove/insert an item if no moving has been done at all X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/5269938f24cf5244047e39a8bd600187b14b076a Don't remove/insert an item if no moving has been done at all --- diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 02e1944bd..1138f1378 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -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; }