Add keybind to toggle room pane focus

This commit is contained in:
miruka 2020-03-17 16:52:14 -04:00
parent b092cc11eb
commit 53bace3915
4 changed files with 14 additions and 10 deletions

View File

@ -243,6 +243,8 @@ class UISettings(JSONDataFile):
"clearRoomMessages": ["Ctrl+L"], "clearRoomMessages": ["Ctrl+L"],
"sendFile": ["Alt+F"], "sendFile": ["Alt+F"],
"sendFileFromPathInClipboard": ["Alt+Shift+F"], "sendFileFromPathInClipboard": ["Alt+Shift+F"],
"toggleFocusRoomPane": ["Alt+R"],
}, },
} }

View File

@ -243,4 +243,14 @@ Item {
Clipboard.text.trim(), 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
}
} }

View File

@ -37,6 +37,7 @@ MultiviewPane {
function toggleFocus() { function toggleFocus() {
if (swipeView.currentItem.keybindFocusItem.activeFocus) { if (swipeView.currentItem.keybindFocusItem.activeFocus) {
if (roomPane.collapse) roomPane.close()
pageLoader.takeFocus() pageLoader.takeFocus()
return return
} }

View File

@ -53,16 +53,7 @@ HBox {
encryptCheckBox.changed || requireInviteCheckbox.changed || encryptCheckBox.changed || requireInviteCheckbox.changed ||
forbidGuestsCheckBox.changed forbidGuestsCheckBox.changed
readonly property Item keybindFocusItem: { readonly property Item keybindFocusItem: nameField.field
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
}
HRoomAvatar { HRoomAvatar {