From f40d1b9f4efeca257f58805f852ce00439b4e1dd Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Feb 2023 16:57:36 +0100 Subject: [PATCH] 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. --- src/qml/Page/RoomPage.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qml/Page/RoomPage.qml b/src/qml/Page/RoomPage.qml index 4b8c1b748..ecb519e27 100644 --- a/src/qml/Page/RoomPage.qml +++ b/src/qml/Page/RoomPage.qml @@ -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 }