From 5269938f24cf5244047e39a8bd600187b14b076a Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 2 Jun 2012 15:53:16 +0200 Subject: [PATCH] Don't remove/insert an item if no moving has been done at all --- src/panels/places/placesitemmodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.47.3