From 53bace39155cf4fcd8e944e753be703383755c9a Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 17 Mar 2020 16:52:14 -0400 Subject: [PATCH] Add keybind to toggle room pane focus --- src/backend/user_files.py | 2 ++ src/gui/GlobalShortcuts.qml | 10 ++++++++++ src/gui/Pages/Chat/RoomPane/RoomPane.qml | 1 + src/gui/Pages/Chat/RoomPane/SettingsView.qml | 11 +---------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/backend/user_files.py b/src/backend/user_files.py index b7bc341f..37f010fc 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -243,6 +243,8 @@ class UISettings(JSONDataFile): "clearRoomMessages": ["Ctrl+L"], "sendFile": ["Alt+F"], "sendFileFromPathInClipboard": ["Alt+Shift+F"], + + "toggleFocusRoomPane": ["Alt+R"], }, } diff --git a/src/gui/GlobalShortcuts.qml b/src/gui/GlobalShortcuts.qml index 0ae40417..ea5a57ad 100644 --- a/src/gui/GlobalShortcuts.qml +++ b/src/gui/GlobalShortcuts.qml @@ -243,4 +243,14 @@ Item { Clipboard.text.trim(), ) } + + + // RoomPane + + HShortcut { + enabled: window.uiState.page === "Pages/Chat/Chat.qml" + sequences: settings.keys.toggleFocusRoomPane + onActivated: mainUI.pageLoader.item.roomPane.toggleFocus() + context: Qt.ApplicationShortcut + } } diff --git a/src/gui/Pages/Chat/RoomPane/RoomPane.qml b/src/gui/Pages/Chat/RoomPane/RoomPane.qml index c5034efe..5b57adbd 100644 --- a/src/gui/Pages/Chat/RoomPane/RoomPane.qml +++ b/src/gui/Pages/Chat/RoomPane/RoomPane.qml @@ -37,6 +37,7 @@ MultiviewPane { function toggleFocus() { if (swipeView.currentItem.keybindFocusItem.activeFocus) { + if (roomPane.collapse) roomPane.close() pageLoader.takeFocus() return } diff --git a/src/gui/Pages/Chat/RoomPane/SettingsView.qml b/src/gui/Pages/Chat/RoomPane/SettingsView.qml index e55d4290..32f2bd23 100644 --- a/src/gui/Pages/Chat/RoomPane/SettingsView.qml +++ b/src/gui/Pages/Chat/RoomPane/SettingsView.qml @@ -53,16 +53,7 @@ HBox { encryptCheckBox.changed || requireInviteCheckbox.changed || forbidGuestsCheckBox.changed - readonly property Item keybindFocusItem: { - for (let i = 0; i < visibleChildren.length; i++) { - const child = visibleChildren[i] - - if (child.focus || (child.field && child.field.focus)) - return visibleChildren[i] - } - - return nameField.field - } + readonly property Item keybindFocusItem: nameField.field HRoomAvatar {