Commit bddd526c authored by Arjen Hiemstra's avatar Arjen Hiemstra Committed by Nate Graham
Browse files

Don't use forceActiveFocus to set search field focus

Instead just set the right focus properties so that we are actually
declaring what we want instead of bypassing all the focus mechanisms.

This also uses Plasmoid.expanded to ensure we reevalute the focus
binding when the applet is reshown so it is in a known state.

(cherry picked from commit 1f92caf3)
parent c009bd83
Pipeline #159204 passed with stage
in 7 minutes and 32 seconds
......@@ -13,6 +13,8 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.19 as Kirigami // for InputMethod.willShowOnActive
Menu {
id: clipboardMenu
Keys.onPressed: {
......@@ -85,6 +87,8 @@ Menu {
Keys.forwardTo: [stack.currentItem]
property var header: PlasmaExtras.PlasmoidHeading {
focus: true
RowLayout {
anchors.fill: parent
enabled: clipboardMenu.model.count > 0 || filter.text.length > 0
......@@ -97,6 +101,11 @@ Menu {
inputMethodHints: Qt.ImhNoPredictiveText
// This uses expanded to ensure the binding gets reevaluated
// when the plasmoid is shown again and that way ensure we are
// always in the correct state on show.
focus: plasmoid.expanded && !Kirigami.InputMethod.willShowOnActive
Keys.onUpPressed: clipboardMenu.arrowKeyPressed(event)
Keys.onDownPressed: clipboardMenu.arrowKeyPressed(event)
......@@ -163,9 +172,6 @@ Menu {
// Intercept up/down key to prevent ListView from accepting the key event.
clipboardMenu.view.Keys.upPressed.connect(clipboardMenu.arrowKeyPressed);
clipboardMenu.view.Keys.downPressed.connect(clipboardMenu.arrowKeyPressed);
// Focus on the search field when the applet is opened for the first time
filter.forceActiveFocus();
}
function goToCurrent() {
......
......@@ -32,7 +32,6 @@ PlasmaComponents3.ScrollView {
contentItem: ListView {
id: menuListView
focus: true
highlight: PlasmaComponents.Highlight { }
highlightMoveDuration: 0
......
Supports Markdown
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