diff --git a/src/qml/RoomPage.qml b/src/qml/RoomPage.qml index 09382355a..3f5843719 100644 --- a/src/qml/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -120,6 +120,7 @@ Kirigami.Page { sourceComponent: TimelineView { id: timelineView currentRoom: root.currentRoom + page: root timelineModel: root.timelineModel messageFilterModel: root.messageFilterModel actionsHandler: root.actionsHandler diff --git a/src/qml/TimelineView.qml b/src/qml/TimelineView.qml index c7117db95..af6897dcd 100644 --- a/src/qml/TimelineView.qml +++ b/src/qml/TimelineView.qml @@ -27,6 +27,8 @@ QQC2.ScrollView { } property bool roomChanging: false + required property Item page + /** * @brief The TimelineModel to use. * @@ -299,14 +301,14 @@ QQC2.ScrollView { Timer { id: markReadIfVisibleTimer - running: messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) + running: messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) && applicationWindow().pageStack.visibleItems.includes(root.page) interval: 10000 onTriggered: root.currentRoom.markAllMessagesAsRead() function reset() { restart(); running = Qt.binding(function () { - return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded); + return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) && applicationWindow().pageStack.visibleItems.includes(root.page); }); } }