From 1692ae244bc5229df78df2d5ba2e76418362cb50 Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Wed, 5 Sep 2018 18:58:35 +0900 Subject: Improve arrow key navigation of Kicker search results Summary: Kicker already makes sure the first search result is highlighted and actionable while searching. This patch makes arrow-down after typing move to the second search result instead of merely moving focus from the search field to the list, so the user doesn't have to press arrow-down twice anymore. It also allows using arrow-left/right to jump to the other result columns, when the cursor is at the start or end of the text field, respectively. BUG:397779 Reviewers: ngraham Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D15286 --- .../package/contents/ui/MenuRepresentation.qml | 20 +++++++++++++++++++- .../kicker/package/contents/ui/RunnerResultsList.qml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/applets/kicker/package/contents/ui/MenuRepresentation.qml b/applets/kicker/package/contents/ui/MenuRepresentation.qml index b70b76b..58cbf8d 100644 --- a/applets/kicker/package/contents/ui/MenuRepresentation.qml +++ b/applets/kicker/package/contents/ui/MenuRepresentation.qml @@ -393,7 +393,7 @@ FocusScope { } else if (event.key == Qt.Key_Down) { if (rootList.visible) { rootList.showChildDialogs = false; - rootList.currentIndex = 0; + rootList.currentIndex = Math.min(1, rootList.count); rootList.forceActiveFocus(); rootList.showChildDialogs = true; } @@ -402,11 +402,29 @@ FocusScope { for (var i = 0; i < runnerModel.count; ++i) { if (runnerModel.modelForRow(i).count) { var targetList = runnerColumnsRepeater.itemAt(i); + targetList.currentIndex = Math.min(1, targetList.count); + targetList.forceActiveFocus(); + break; + } + } + } + } else if (event.key == Qt.Key_Left && cursorPosition == 0) { + for (var i = runnerModel.count; i >= 0; --i) { + if (runnerModel.modelForRow(i).count) { + var targetList = runnerColumnsRepeater.itemAt(i); targetList.currentIndex = 0; targetList.forceActiveFocus(); break; } } + } else if (event.key == Qt.Key_Right && cursorPosition == length) { + for (var i = 1; i < runnerModel.count; ++i) { + if (runnerModel.modelForRow(i).count) { + var targetList = runnerColumnsRepeater.itemAt(i); + targetList.currentIndex = 0; + targetList.forceActiveFocus(); + break; + } } } else if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { if (runnerColumns.visible && runnerModel.modelForRow(0).count) { diff --git a/applets/kicker/package/contents/ui/RunnerResultsList.qml b/applets/kicker/package/contents/ui/RunnerResultsList.qml index 3627c2f..4e6dc2f 100644 --- a/applets/kicker/package/contents/ui/RunnerResultsList.qml +++ b/applets/kicker/package/contents/ui/RunnerResultsList.qml @@ -30,6 +30,7 @@ FocusScope { signal keyNavigationAtListEnd property alias currentIndex: runnerMatches.currentIndex + property alias count: runnerMatches.count property alias containsMouse: runnerMatches.containsMouse Accessible.name: header.text -- cgit v0.11.2