Jump to bottom and mark messages read with Escape

Pressing the Escape key again when you're already at the bottom and
there are no unread messages takes you back to the room list like
before.
This commit is contained in:
Kevin Wolf
2023-02-23 16:57:36 +01:00
committed by Tobias Fella
parent e9cd165457
commit f40d1b9f4e

View File

@@ -77,7 +77,14 @@ Kirigami.ScrollablePage {
Shortcut {
sequence: StandardKey.Cancel
onActivated: applicationWindow().pageStack.get(0).forceActiveFocus()
onActivated: {
if (!messageListView.atYEnd || currentRoom.hasUnreadMessages) {
goToLastMessage();
currentRoom.markAllMessagesAsRead();
} else {
applicationWindow().pageStack.get(0).forceActiveFocus();
}
}
enabled: !page.disableCancelShortcut
}