Commit 1692ae24 authored by Eike Hein's avatar Eike Hein

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
parent b96651ac
......@@ -393,13 +393,23 @@ 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;
}
if (runnerColumns.visible) {
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;
......@@ -407,6 +417,14 @@ FocusScope {
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) {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment