Allow using ESC to go back to room list

Fix #392
This commit is contained in:
Carl Schwan
2021-12-25 18:48:23 +01:00
committed by Tobias Fella
parent 924a1fed21
commit 67bc66ee0c
2 changed files with 16 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ Kirigami.ScrollablePage {
/// Used to determine if scrolling to the bottom should mark the message as unread
property bool hasScrolledUpBefore: false;
/// Disable cancel shortcut. Used by the seperate window since it provide its own
/// cancel implementation.
property bool disableCancelShortcut: false
title: currentRoom.htmlSafeDisplayName
KeyNavigation.left: pageStack.get(0)
@@ -55,6 +59,12 @@ Kirigami.ScrollablePage {
connection: Controller.activeConnection
}
Shortcut {
sequence: StandardKey.Cancel
onActivated: applicationWindow().pageStack.get(0).forceActiveFocus()
enabled: !page.disableCancelShortcut
}
Connections {
target: Controller.activeConnection
function onJoinedRoom(room, invited) {

View File

@@ -12,8 +12,14 @@ Kirigami.ApplicationWindow {
required property var currentRoom
minimumWidth: Kirigami.Units.gridUnit * 10
minimumHeight: Kirigami.Units.gridUnit * 15
Shortcut {
sequence: StandardKey.Cancel
onActivated: window.close()
}
pageStack.initialPage: RoomPage {
visible: true
currentRoom: window.currentRoom
disableCancelShortcut: true
}
}