diff --git a/src/gui/Base/HPageHeader.qml b/src/gui/Base/HPageHeader.qml index 36041609..a3b66f62 100644 --- a/src/gui/Base/HPageHeader.qml +++ b/src/gui/Base/HPageHeader.qml @@ -26,7 +26,7 @@ Rectangle { icon.name: "go-back-to-main-pane" toolTip.text: qsTr("Go back to main pane") - onClicked: mainUI.mainPane.toggleFocus() + onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() Layout.preferredWidth: theme.baseElementsHeight Layout.fillHeight: true diff --git a/src/gui/MainPane/FilterRoomsField.qml b/src/gui/MainPane/FilterRoomsField.qml index 6e6e1042..1fca87d4 100644 --- a/src/gui/MainPane/FilterRoomsField.qml +++ b/src/gui/MainPane/FilterRoomsField.qml @@ -33,6 +33,17 @@ HTextField { property RoomList roomList + function toggleFocus() { + if (filterField.activeFocus) { + pageLoader.takeFocus() + return + } + + mainPane.open() + filterField.forceActiveFocus() + } + + Behavior on opacity { HNumberAnimation {} } HShortcut { @@ -42,14 +53,6 @@ HTextField { HShortcut { sequences: window.settings.keys.toggleFocusMainPane - onActivated: { - if (filterField.activeFocus) { - pageLoader.takeFocus() - return - } - - mainPane.open() - filterField.forceActiveFocus() - } + onActivated: toggleFocus() } } diff --git a/src/gui/Pages/Chat/RoomHeader.qml b/src/gui/Pages/Chat/RoomHeader.qml index ec4a7a82..8df4140c 100644 --- a/src/gui/Pages/Chat/RoomHeader.qml +++ b/src/gui/Pages/Chat/RoomHeader.qml @@ -34,7 +34,7 @@ Rectangle { icon.name: "go-back-to-main-pane" toolTip.text: qsTr("Go back to main pane") - onClicked: mainUI.mainPane.toggleFocus() + onClicked: mainUI.mainPane.filterRoomsField.toggleFocus() Layout.preferredWidth: showPaneButtons ? avatar.width : 0 Layout.fillHeight: true