From a2a6983123cbcd5dc19ffd2e525b173c9b4ece65 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Tue, 27 Apr 2021 20:28:20 +0000 Subject: [PATCH] feat: add button in RoomPage to mark all messages as read --- imports/NeoChat/Page/RoomPage.qml | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 66555e793..6e488e3f1 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -578,20 +578,38 @@ Kirigami.ScrollablePage { id: goReadMarkerFab - visible: currentRoom && currentRoom.hasUnreadMessages && currentRoom.readMarkerLoaded || !messageListView.atYEnd + visible: currentRoom && currentRoom.hasUnreadMessages && currentRoom.readMarkerLoaded action: Kirigami.Action { onTriggered: { - if (currentRoom && currentRoom.hasUnreadMessages) { - goToEvent(currentRoom.readMarkerEventId) - } else { - goToLastMessage(); - } + goToEvent(currentRoom.readMarkerEventId) } - icon.name: currentRoom && currentRoom.hasUnreadMessages ? "go-up" : "go-down" + icon.name: "go-up" } QQC2.ToolTip { - text: currentRoom && currentRoom.hasUnreadMessages ? i18n("Jump to first unread message") : i18n("Jump to latest message") + text: i18n("Jump to first unread message") + } + } + QQC2.RoundButton { + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: Kirigami.Units.largeSpacing + anchors.rightMargin: Kirigami.Units.largeSpacing + implicitWidth: Kirigami.Units.gridUnit * 2 + implicitHeight: Kirigami.Units.gridUnit * 2 + + id: goMarkAsReadFab + + visible: !messageListView.atYEnd + action: Kirigami.Action { + onTriggered: { + goToLastMessage(); + } + icon.name: "go-down" + } + + QQC2.ToolTip { + text: i18n("Jump to latest message") } }