From 666f24718510c338552d345f5a87e25eb1803dce Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 3 Jan 2023 18:06:51 +0000 Subject: [PATCH] Fix Ctrl + F not working Fix Crtl + F not working by only having the shortcut assigned to a single searchfield. - Ctrl + F is now for the roomlist search - The user search in the room drawer is now ctrl + shift + f - for the emoji picker and qucik switcher these have the shortcut removed and focus is managed by the popup. BUG: 462524 --- src/qml/Component/Emoji/EmojiPicker.qml | 10 ++++++++++ src/qml/Component/QuickSwitcher.qml | 5 +++++ src/qml/Dialog/EmojiDialog.qml | 8 ++++++++ src/qml/Panel/RoomDrawer.qml | 2 ++ 4 files changed, 25 insertions(+) diff --git a/src/qml/Component/Emoji/EmojiPicker.qml b/src/qml/Component/Emoji/EmojiPicker.qml index 7526ee55d..883b24f0c 100644 --- a/src/qml/Component/Emoji/EmojiPicker.qml +++ b/src/qml/Component/Emoji/EmojiPicker.qml @@ -27,6 +27,10 @@ ColumnLayout { signal chosen(string emoji) + onActiveFocusChanged: if (activeFocus) { + searchField.forceActiveFocus() + } + spacing: 0 QQC2.ScrollView { @@ -78,6 +82,12 @@ ColumnLayout { id: searchField Layout.margins: Kirigami.Units.smallSpacing Layout.fillWidth: true + + /** + * The focus is manged by the parent and we don't want to use the standard + * shortcut as it could block other SearchFields from using it. + */ + focusSequence: "" } EmojiGrid { diff --git a/src/qml/Component/QuickSwitcher.qml b/src/qml/Component/QuickSwitcher.qml index c33fce028..5d4d59161 100644 --- a/src/qml/Component/QuickSwitcher.qml +++ b/src/qml/Component/QuickSwitcher.qml @@ -40,6 +40,11 @@ QQC2.Popup { // we used to be able to expect that the text field wouldn't attempt to // perform a mini-DDOS attack using signals. autoAccept: false + /** + * The focus is manged by the popup and we don't want to use the standard + * shortcut as it could block other SearchFields from using it. + */ + focusSequence: "" Layout.preferredWidth: Kirigami.Units.gridUnit * 21 // 3 * 7 = 21, roughly 7 avatars on screen Keys.onLeftPressed: cView.decrementCurrentIndex() diff --git a/src/qml/Dialog/EmojiDialog.qml b/src/qml/Dialog/EmojiDialog.qml index 47526c78e..add5696d3 100644 --- a/src/qml/Dialog/EmojiDialog.qml +++ b/src/qml/Dialog/EmojiDialog.qml @@ -24,6 +24,13 @@ QQC2.Popup { } } + onVisibleChanged: { + if (!visible) { + return + } + emojiPicker.forceActiveFocus() + } + background: Kirigami.ShadowedRectangle { Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor @@ -43,6 +50,7 @@ QQC2.Popup { implicitHeight: Kirigami.Units.gridUnit * 20 + 2 * padding width: Math.min(contentItem.categoryIconSize * contentItem.categoryCount + 2 * padding, QQC2.Overlay.overlay.width) contentItem: EmojiPicker { + id: emojiPicker height: 400 includeCustom: emojiPopup.includeCustom showQuickReaction: emojiPopup.showQuickReaction diff --git a/src/qml/Panel/RoomDrawer.qml b/src/qml/Panel/RoomDrawer.qml index 225980443..4a0b697a4 100644 --- a/src/qml/Panel/RoomDrawer.qml +++ b/src/qml/Panel/RoomDrawer.qml @@ -251,6 +251,8 @@ Kirigami.OverlayDrawer { Layout.rightMargin: Kirigami.Units.largeSpacing - 1 Layout.bottomMargin: Kirigami.Units.smallSpacing + focusSequence: "Ctrl+Shift+F" + onAccepted: sortedMessageEventModel.filterString = text; }