From b4561ce50bbfc5810df952b24b936d3d98e623da Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 10 May 2020 17:46:52 -0400 Subject: [PATCH] Fix back/forward headers buttons in small window --- src/gui/Base/HPageHeader.qml | 2 +- src/gui/MainPane/FilterRoomsField.qml | 21 ++++++++++++--------- src/gui/Pages/Chat/RoomHeader.qml | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) 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