Commit 19796bc5 authored by Eike Hein's avatar Eike Hein

Make sure the search result that Return will run is highlighted

Summary:
Otherwise there's no visual feedback that you can just hit
Return.

This requires refactoring the item list code slightly not to
implicitly focus the list when the current index changes (so
focus isn't moved away from the search field). Instead it's
now done on mouse over and manually by external callers after
they set an index.

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9962
parent fc155e94
......@@ -48,6 +48,7 @@ FocusScope {
property alias keyNavigationWraps: listView.keyNavigationWraps
property alias showChildDialogs: listView.showChildDialogs
property alias model: listView.model
property alias count: listView.count
property alias containsMouse: listener.containsMouse
property alias resetOnExitDelay: resetIndexTimer.interval
......@@ -118,6 +119,7 @@ FocusScope {
if (containsMouse) {
resetIndexTimer.stop();
itemList.forceActiveFocus();
} else if ((!childDialog || !dialog)
&& (!currentItem || !currentItem.menu.opened)) {
resetIndexTimer.start();
......@@ -156,8 +158,6 @@ FocusScope {
onCurrentIndexChanged: {
if (currentIndex != -1) {
itemList.forceActiveFocus();
if (childDialog) {
if (currentItem && currentItem.hasChildren) {
childDialog.model = model.modelForRow(currentIndex);
......
......@@ -376,13 +376,16 @@ FocusScope {
if (rootList.visible) {
rootList.showChildDialogs = false;
rootList.currentIndex = rootList.model.count - 1;
rootList.forceActiveFocus();
rootList.showChildDialogs = true;
}
if (runnerColumns.visible) {
for (var i = 0; i < runnerModel.count; ++i) {
if (runnerModel.modelForRow(i).count) {
runnerColumnsRepeater.itemAt(i).currentIndex = runnerModel.modelForRow(i).count - 1;
var targetList = runnerColumnsRepeater.itemAt(i);
targetList.currentIndex = runnerModel.modelForRow(i).count - 1;
targetList.forceActiveFocus();
break;
}
}
......@@ -391,13 +394,16 @@ FocusScope {
if (rootList.visible) {
rootList.showChildDialogs = false;
rootList.currentIndex = 0;
rootList.forceActiveFocus();
rootList.showChildDialogs = true;
}
if (runnerColumns.visible) {
for (var i = 0; i < runnerModel.count; ++i) {
if (runnerModel.modelForRow(i).count) {
runnerColumnsRepeater.itemAt(i).currentIndex = 0;
var targetList = runnerColumnsRepeater.itemAt(i);
targetList.currentIndex = 0;
targetList.forceActiveFocus();
break;
}
}
......
......@@ -95,6 +95,12 @@ FocusScope {
visible: false;
}
}
onCountChanged: {
if (index == 0 && searchField.focus) {
currentIndex = 0;
}
}
}
Component.onCompleted: {
......
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