diff --git a/krunner/view.cpp b/krunner/view.cpp --- a/krunner/view.cpp +++ b/krunner/view.cpp @@ -62,6 +62,8 @@ KCrash::setFlags(KCrash::AutoRestart); + //used only by on screen readers + setTitle(i18n("KRunner")); m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General"); setFreeFloating(m_config.readEntry("FreeFloating", false)); diff --git a/lookandfeel/contents/runcommand/RunCommand.qml b/lookandfeel/contents/runcommand/RunCommand.qml --- a/lookandfeel/contents/runcommand/RunCommand.qml +++ b/lookandfeel/contents/runcommand/RunCommand.qml @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import org.kde.plasma.core 2.0 as PlasmaCore @@ -97,19 +97,25 @@ Keys.onPressed: allowCompletion = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete) Keys.onUpPressed: { if (length === 0) { - root.showHistory = true + root.showHistory = true; + listView.forceActiveFocus(); + } else { + results.forceActiveFocus(); } } Keys.onDownPressed: { if (length === 0) { - root.showHistory = true + root.showHistory = true; + listView.forceActiveFocus(); + } else { + results.forceActiveFocus(); } } Keys.onEscapePressed: { runnerWindow.visible = false } - Keys.forwardTo: [listView, results] + //Keys.forwardTo: [listView, results] } PlasmaComponents.ToolButton { iconSource: "window-close" @@ -131,6 +137,13 @@ queryString: root.query runner: root.runner + Keys.onPressed: { + if (event.text != "") { + queryField.text += event.text; + queryField.focus = true; + } + } + onActivated: { runnerWindow.addToHistory(queryString) runnerWindow.visible = false @@ -156,6 +169,7 @@ keyNavigationWraps: true highlight: PlasmaComponents.Highlight {} highlightMoveDuration: 0 + activeFocusOnTab: true // we store 50 entries in the history but only show 20 in the UI so it doesn't get too huge model: root.showHistory ? runnerWindow.history.slice(0, 20) : [] delegate: Milou.ResultDelegate { @@ -166,20 +180,46 @@ icon: "list-remove", text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Remove") }] + Accessible.description: i18n("in category recent queries") } + onActiveFocusChanged: { + if (!activeFocus && currentIndex == listView.count-1) { + currentIndex = 0; + } + } Keys.onReturnPressed: runCurrentIndex() Keys.onEnterPressed: runCurrentIndex() - - Keys.onTabPressed: incrementCurrentIndex() - Keys.onBacktabPressed: decrementCurrentIndex() + + Keys.onTabPressed: { + if (currentIndex == listView.count-1) { + listView.nextItemInFocusChain(true).forceActiveFocus(); + } else { + incrementCurrentIndex() + } + } + Keys.onBacktabPressed: { + if (currentIndex == 0) { + listView.nextItemInFocusChain(false).forceActiveFocus(); + } else { + decrementCurrentIndex() + } + } + Keys.onPressed: { + if (event.text != "") { + queryField.text += event.text; + queryField.focus = true; + } + } + Keys.onUpPressed: decrementCurrentIndex() Keys.onDownPressed: incrementCurrentIndex() function runCurrentIndex() { var entry = runnerWindow.history[currentIndex] if (entry) { queryField.text = entry + queryField.forceActiveFocus(); } }