From 01437a787da5b327187290122de9227cf34075ee Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 26 Jan 2022 16:32:39 +0100 Subject: [PATCH] Reset unread messages when going to bottom after 5s --- .../src/components/chat-room/ChatRoomModel.hpp | 2 +- linphone-app/ui/modules/Linphone/Chat/Chat.qml | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.hpp b/linphone-app/src/components/chat-room/ChatRoomModel.hpp index b99277650..81c62ceb5 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.hpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.hpp @@ -233,7 +233,7 @@ public: void sendFileMessage (const QString &path); Q_INVOKABLE void forwardMessage(ChatMessageModel * model); void compose (); - void resetMessageCount (); + Q_INVOKABLE void resetMessageCount (); Q_INVOKABLE void initEntries(); Q_INVOKABLE int loadMoreEntries(); // return new entries count void callEnded(std::shared_ptr call); diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.qml b/linphone-app/ui/modules/Linphone/Chat/Chat.qml index fa686cf7d..87e1bc67f 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.qml @@ -52,6 +52,16 @@ Rectangle { if( loadingEntries && !displaying) displaying = true } + onBindToEndChanged: if( bindToEnd){ + markAsReadTimer.start() + } + Timer{ + id: markAsReadTimer + interval: 5000 + repeat: false + running: false + onTriggered: container.proxyModel.chatRoomModel.resetMessageCount() + } //property var sipAddressObserver: SipAddressesModel.getSipAddressObserver(proxyModel.fullPeerAddress, proxyModel.fullLocalAddress) // ----------------------------------------------------------------------- Layout.fillHeight: true