diff options
| author | Tigran Gabrielyan <[email protected]> | 2019-03-20 10:21:21 +0100 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2019-03-20 17:46:15 +0100 |
| commit | 303cd17444e1fb88d1f92a911f7c770214b8f90e (patch) | |
| tree | dc774d7cf0854f380333d0d0e2fade1f6836e814 | |
| parent | 5b463d82fed9a443b098888c0aee8a7b3b322666 (diff) | |
Fix rearranging items in places panel with hidden items
Summary:
`m_sourceModel->movePlace` is called using index from the view model.
This becomes an issue when there are hidden places items.
This change calls `m_sourceModel->movePlace` using the corresponding mapped source index.
BUG: 399430
FIXED-IN: 19.04.0
Test Plan:
# Create at least 4 Places items
# Hide first item
# Drag the now first visible item between second and third item
Actual: The item does not move
Expected: The first visible item should now be second visible item in the list
Reviewers: #dolphin, ngraham
Reviewed By: #dolphin, ngraham
Subscribers: ngraham, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19901
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 7513a25d5..e8636942b 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -353,7 +353,10 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData) int oldIndex; stream >> oldIndex; - m_sourceModel->movePlace(oldIndex, index); + QModelIndex sourceIndex = mapToSource(index); + QModelIndex oldSourceIndex = mapToSource(oldIndex); + + m_sourceModel->movePlace(oldSourceIndex.row(), sourceIndex.row()); } else if (mimeData->hasFormat(QStringLiteral("text/uri-list"))) { // One or more items must be added to the model const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData); |
