summary refs log tree commit diff
path: root/resources/qml/MessageView.qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-02-13 01:41:09 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-02-13 01:41:09 +0100
commit7ddcab3902a6b39c3ed8328c245f58a495b4c43f (patch)
tree33101eb2c7231dff3f671194b87bee2e8d120e7d /resources/qml/MessageView.qml
parentRevert keeping whitespace in html, it breaks lists (diff)
downloadnheko-7ddcab3902a6b39c3ed8328c245f58a495b4c43f.tar.xz
Mark messages as read, when Nheko gets focused
fixes #235
Diffstat (limited to 'resources/qml/MessageView.qml')
-rw-r--r--resources/qml/MessageView.qml15
1 files changed, 14 insertions, 1 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 13b4c82c..35b5cac4 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -77,6 +77,19 @@ ListView {
         }
     }
 
+    Connections {
+        target: TimelineManager
+        onFocusChanged: readTimer.running = TimelineManager.isWindowFocused
+    }
+
+    Timer {
+        id: readTimer
+
+        // force current read index to update
+        onTriggered: chat.model.setCurrentIndex(chat.model.currentIndex)
+        interval: 1000
+    }
+
     Component {
         id: sectionHeader
 
@@ -193,7 +206,7 @@ ListView {
         Connections {
             target: chat
             onMovementEnded: {
-                if (y + height + 2 * chat.spacing > chat.contentY + timelineRoot.height && y < chat.contentY + timelineRoot.height)
+                if (y + height + 2 * chat.spacing > chat.contentY + chat.height && y < chat.contentY + chat.height)
                     chat.model.currentIndex = index;
 
             }