Add back quick search to the bookmark menu

Authored by rade on Mar 8 2018, 4:14 AM.

Description

Add back quick search to the bookmark menu

Before the upgrade to Qt5 you could go to any bookmark in the bookmark
menu by simply typing the shortest unique first part of its name.
This functionality disappeared after migration to KF5 due to
removed functions setKeyboardShortcutsEnabled and
setKeyboardShortcutsExecute (see the commented out code in
krbookmarkbutton.cpp). As I could find no equivalent functions in kde
framework 5 I wrote the code to emulate their functionality instead.

The patch has been originally submitted as email [1]
and then improved by code review iterations [2].

Description of the feature:

  • Quick search is enabled after opening the bookmark menu.
  • For bookmarks with a single-character shortcut (denoted with an ampersand) if the character is pressed first, the bookmark triggers immediately.
  • User may type some characters until there is only a single bookmark that starts with a typed sequence.
  • While several bookmarks could be found, the matches denoted with underlined characters in the bookmark names.

There are known issues as found and discussed on the code review page [2]:

  • To actually see the underlines one needs to press alt or set an option in System Settings -> Application Style -> Widget Style -> Applications (tab) -> Breeze:Configure -> General (tab) -> Keyboard accelerators visibility ... to "Always Show [...]".
  • Special bookmarks (Trash, Lan, Popular, etc) and Manage Bookmarks action participate in the quick search as regular bookmarks
  • 's' and 'j' immediately trigger actions "Set Jump Back Point" and "Jump back" even though there are bookmarks that start with the letters.
  • In case a sequence is not matched to any bookmark after another key press, the sequence is reset and the next letter after the one that triggered not-found case will start a new search. This feels unnatural especially given the Backspace support.

Tested and reviewed by: Nikita Melnichenko, Martin Kostolný
Commit message edited and prepared by: Nikita Melnichenko

[1] https://groups.google.com/forum/#!topic/krusader-devel/OCO1bwjHXhE
[2] Differential Revision: https://phabricator.kde.org/D10954

Details

Committed
nmelMar 8 2018, 5:19 AM
Parents
R167:cb7711f8f6f8: Merge branch 'bug-389413-fix'
Branches
Unknown
Tags
Unknown