From 56a38da57a020ed5617d5293013c4f8cc2d04fc3 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sun, 20 Oct 2019 12:35:52 +0200 Subject: Avoid emitting twice twice selectionChanged when keyboard changes the selection, fix slotChangeCurrentItem Summary: In KItemListController::slotChangeCurrentItem searchFromNextItem use was bugged : The two branches of `if (searchFromNextItem)` both looked for the next keyboard with indexForKeyboardSearch(text, currentIndex (the first one with just a +1 modulo). But when searchFromNextItem is false, we are supposed to start to look for the next indexKeyboard from the start of the list `0`, not from the `currentIndex` Reviewers: elvisangelaccio, #dolphin Reviewed By: elvisangelaccio, #dolphin Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D24505 --- src/kitemviews/kitemlistselectionmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/kitemviews/kitemlistselectionmanager.cpp') diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp index d16c5e2d3..1b4f7db45 100644 --- a/src/kitemviews/kitemlistselectionmanager.cpp +++ b/src/kitemviews/kitemlistselectionmanager.cpp @@ -173,6 +173,16 @@ void KItemListSelectionManager::clearSelection() } } +void KItemListSelectionManager::replaceSelection(int index, int count) +{ + const KItemSet previous = selectedItems(); + if (!previous.isEmpty()) { + m_selectedItems.clear(); + m_isAnchoredSelectionActive = false; + } + setSelected(index, count); +} + void KItemListSelectionManager::beginAnchoredSelection(int anchor) { if (anchor >= 0 && m_model && anchor < m_model->count()) { -- cgit v1.3