From 092f1be99b31e4e396f44c39956a01392be34bf6 Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 25 Aug 2023 22:27:20 +0000 Subject: [PATCH] Further mark messages read fixes Add a timer to lockout the scroll trigger for marking messages as read in the first second after changing room. This is because the scrollview can't differentiate between mouse scrolling and the multiple changes in scrollview that happen as the room is changed over. --- src/qml/Component/TimelineView.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qml/Component/TimelineView.qml b/src/qml/Component/TimelineView.qml index 71cfdaa1d..8a8aa8281 100644 --- a/src/qml/Component/TimelineView.qml +++ b/src/qml/Component/TimelineView.qml @@ -17,10 +17,10 @@ QQC2.ScrollView { required property NeoChatRoom currentRoom onCurrentRoomChanged: { roomChanging = true; + roomChangingTimer.restart() applicationWindow().hoverLinkIndicator.text = ""; messageListView.positionViewAtBeginning(); hasScrolledUpBefore = false; - roomChanging = true; } property bool roomChanging: false readonly property bool atYEnd: messageListView.atYEnd @@ -79,6 +79,13 @@ QQC2.ScrollView { messageEventModel.fetchMore(messageEventModel.index(0, 0)); } + Timer { + id: roomChangingTimer + interval: 1000 + onTriggered: { + root.roomChanging = false + } + } onAtYEndChanged: if (!root.roomChanging) { if (atYEnd && root.hasScrolledUpBefore) { if (QQC2.ApplicationWindow.window && (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden)) {