]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Clear the previous selection when selecting pasted or dropped items
authorFrank Reininghaus <frank78ac@googlemail.com>
Mon, 19 Nov 2012 21:06:29 +0000 (22:06 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 24 Nov 2012 15:04:43 +0000 (16:04 +0100)
This fixes a recent regression in the 4.9 branch caused by
b25059e803e7eed54f0593605a4066882d63bce2.

BUG: 310365
FIXED-IN: 4.9.4
REVIEW: 107389

src/views/dolphinview.cpp
src/views/dolphinview.h

index 13db9896e66ae83f616ead6f46653e6dc9a6da01..70a7394274a65c3a8be9808e6993b8c4cfbffac8 100644 (file)
@@ -101,6 +101,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     m_scrollToCurrentItem(false),
     m_restoredContentsPosition(),
     m_selectedUrls(),
+    m_clearSelectionBeforeSelectingNewItems(false),
     m_versionControlObserver(0)
 {
     m_topLayout = new QVBoxLayout(this);
@@ -1218,6 +1219,12 @@ void DolphinView::updateViewState()
 
     if (!m_selectedUrls.isEmpty()) {
         KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+
+        if (m_clearSelectionBeforeSelectingNewItems) {
+            selectionManager->clearSelection();
+            m_clearSelectionBeforeSelectingNewItems = false;
+        }
+
         QSet<int> selectedItems = selectionManager->selectedItems();
 
         for (QList<KUrl>::iterator it = m_selectedUrls.begin(); it != m_selectedUrls.end(); ++it) {
@@ -1535,6 +1542,7 @@ void DolphinView::markPastedUrlsAsSelected(const QMimeData* mimeData)
         destUrls << destination;
     }
     markUrlsAsSelected(destUrls);
+    m_clearSelectionBeforeSelectingNewItems = true;
 }
 
 void DolphinView::updateWritableState()
index 7d8e8b76add25f90fe7f395c10797e7681a63d9f..f756de05edae39311f7c9e728046732205d5a3bd 100644 (file)
@@ -759,6 +759,7 @@ private:
     QPoint m_restoredContentsPosition;
 
     QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
+    bool m_clearSelectionBeforeSelectingNewItems;
 
     VersionControlObserver* m_versionControlObserver;