When the selection is deselected, restart the keyboard search from the beginning
AcceptedPublic

Authored by meven on Wed, Sep 4, 10:29 AM.

Details

Reviewers
elvisangelaccio
ngraham
Group Reviewers
Dolphin
Summary

BUG: 411538
FIXED-IN: 19.12

Test Plan

Open a directory with 3 files starting with the same letter.

  1. Press this letter key twice
  2. The second file is selected
  3. Deselect the file with the mouse or using Esc
  4. Wait 1 second
  5. Press the same key again

Before:
The third file gets selected

After:
The first file get selected

ctest

Diff Detail

Repository
R318 Dolphin
Branch
bug-411538
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 16115
Build 16133: arc lint + arc unit
meven created this revision.Wed, Sep 4, 10:29 AM
Restricted Application added a project: Dolphin. · View Herald TranscriptWed, Sep 4, 10:29 AM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
meven requested review of this revision.Wed, Sep 4, 10:29 AM
meven edited the test plan for this revision. (Show Details)Wed, Sep 4, 10:31 AM
meven edited the summary of this revision. (Show Details)
ngraham added a subscriber: ngraham.Wed, Sep 4, 3:57 PM

Nice. But I'm wondering why we even need the 1 second timeout for the case where the selection is cleared.

meven updated this revision to Diff 65420.Thu, Sep 5, 12:45 PM

Add a KItemListSelectionManager::replaceSelection to avoid sending twice selectionChanged in a row on KItemListController::slotChangeCurrentItem

meven edited the test plan for this revision. (Show Details)Thu, Sep 5, 12:45 PM

Nice. But I'm wondering why we even need the 1 second timeout for the case where the selection is cleared.

emit changeCurrentItem triggers KItemListController::slotChangeCurrentItem which calls in a row:

m_selectionManager->clearSelection();
m_selectionManager->setSelected(index, 1);

Triggering KItemListSelectionManager::SelectionChanged twice in a row and KItemListKeyboardSearchManager::slotSelectionChanged twice
The first time with : previous.isEmpty(): false current.isEmpty(): true previous.count(): 1 current.count(): 0 # deselect everything
Second time with : previous.isEmpty(): true current.isEmpty(): false previous.count(): 0 current.count(): 1 # select the new element

This caused a bug :
Let's you have three files : e1 e2 e3 in folder.
You type e then e and then e you expect the third file to be selected e3.
Without this check, the first file was selected and all subsequent e typing stays on the same file.

I have changed this to not be needed anymore adding KItemListSelectionManager::replaceSelection

meven updated this revision to Diff 65422.Thu, Sep 5, 12:50 PM

Clean commit

ngraham accepted this revision.Thu, Sep 5, 2:18 PM

LGTM but please wait for a thumbs-up from @elvisangelaccio as well.

This revision is now accepted and ready to land.Thu, Sep 5, 2:18 PM