diff --git a/linphone-app/src/components/chat/ChatModel.cpp b/linphone-app/src/components/chat/ChatModel.cpp index d50d576eb..89b43b022 100644 --- a/linphone-app/src/components/chat/ChatModel.cpp +++ b/linphone-app/src/components/chat/ChatModel.cpp @@ -638,9 +638,8 @@ void ChatModel::compose () { void ChatModel::resetMessageCount () { if (mChatRoom->getUnreadMessagesCount() > 0){ mChatRoom->markAsRead();// Marking as read is only for messages. Not for calls. - emit messageCountReset(); - }else if (CoreManager::getInstance()->getMissedCallCount(getPeerAddress(), getLocalAddress())>0) - emit messageCountReset(); + } + emit messageCountReset(); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/chat/ChatProxyModel.cpp b/linphone-app/src/components/chat/ChatProxyModel.cpp index 025ec4778..97370fd08 100644 --- a/linphone-app/src/components/chat/ChatProxyModel.cpp +++ b/linphone-app/src/components/chat/ChatProxyModel.cpp @@ -209,8 +209,6 @@ void ChatProxyModel::reload () { mChatModel = CoreManager::getInstance()->getChatModel(mPeerAddress, mLocalAddress); if (mChatModel) { - mChatModel->resetMessageCount(); - mChatModel->focused(); ChatModel *chatModel = mChatModel.get(); QObject::connect(chatModel, &ChatModel::isRemoteComposingChanged, this, &ChatProxyModel::handleIsRemoteComposingChanged); @@ -220,7 +218,11 @@ void ChatProxyModel::reload () { static_cast(sourceModel())->setSourceModel(mChatModel.get()); } - +void ChatProxyModel::resetMessageCount(){ + if( mChatModel){ + mChatModel->resetMessageCount(); + } +} // ----------------------------------------------------------------------------- static inline QWindow *getParentWindow (QObject *object) { diff --git a/linphone-app/src/components/chat/ChatProxyModel.hpp b/linphone-app/src/components/chat/ChatProxyModel.hpp index 7f41e4574..9ab97e3e9 100644 --- a/linphone-app/src/components/chat/ChatProxyModel.hpp +++ b/linphone-app/src/components/chat/ChatProxyModel.hpp @@ -60,6 +60,8 @@ public: Q_INVOKABLE void compose (); + Q_INVOKABLE void resetMessageCount(); + signals: void peerAddressChanged (const QString &peerAddress); void localAddressChanged (const QString &localAddress); diff --git a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp index 81469bb68..da54f3936 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp @@ -121,7 +121,6 @@ void AbstractEventCountNotifier::handleResetAllMissedCalls () { internalnotifyEventCount(); } - void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) { auto it = mMissedCalls.find({ Utils::cleanSipAddress(chatModel->getPeerAddress()), Utils::cleanSipAddress(chatModel->getLocalAddress()) }); if (it != mMissedCalls.cend()) { @@ -129,7 +128,6 @@ void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) { internalnotifyEventCount(); } } - void AbstractEventCountNotifier::handleCallMissed (CallModel *callModel) { ++mMissedCalls[{ Utils::cleanSipAddress(callModel->getPeerAddress()), Utils::cleanSipAddress(callModel->getLocalAddress()) }]; internalnotifyEventCount(); diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 937890419..f1d8cfffb 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -168,6 +168,7 @@ ColumnLayout { if (!SettingsModel.chatEnabled) { setEntryTypeFilter(ChatModel.CallEntry) } + resetMessageCount() } peerAddress: conversation.peerAddress