From b8ffa755ed2df6bf6a47b9268e7da93355a4d856 Mon Sep 17 00:00:00 2001 From: Nathaniel Graham Date: Fri, 23 Mar 2018 07:30:37 -0600 Subject: [PATCH] Move to KRunner's second results item with a single keypress Summary: Currently, to navigate the list of results after typing a search term, you need to press the down arrow twice: first to focus the result list, and a second time to actually change the selection. This patch fixes that by changing the selection during the focus oprtation. BUG: 392197 Test Plan: Deployed change, killed, restarted, and activated KRunner, typed a search term: - The down arrow key now moves to the second item - Clicked on the text field; up arrow now moves to the previous item in the results list Activating the {nav Open Containing Folder} button for the first result via the keyboard changes slightly with this patch: - Currently, it's {nav down arrow > tab key} - With this patch, it's {nav tab key three times} or {nav down arrow > shift + tab} Seems like an acceptable change to me to better support the common case of just wanting to easily navigate to the results list items. Reviewers: #plasma, broulik, mart Reviewed By: #plasma, broulik, mart Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D11611 --- lookandfeel/contents/runcommand/RunCommand.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lookandfeel/contents/runcommand/RunCommand.qml b/lookandfeel/contents/runcommand/RunCommand.qml index bcdb08ac5..66e41e19e 100644 --- a/lookandfeel/contents/runcommand/RunCommand.qml +++ b/lookandfeel/contents/runcommand/RunCommand.qml @@ -100,16 +100,18 @@ ColumnLayout { if (length === 0) { root.showHistory = true; listView.forceActiveFocus(); - } else { + } else if (results.count > 0) { results.forceActiveFocus(); + results.decrementCurrentIndex(); } } Keys.onDownPressed: { if (length === 0) { root.showHistory = true; listView.forceActiveFocus(); - } else { + } else if (results.count > 0) { results.forceActiveFocus(); + results.incrementCurrentIndex(); } } Keys.onEnterPressed: results.runCurrentIndex()