diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index e342a4508..d0773c073 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -220,6 +220,7 @@ ChatRoomModel::ChatRoomModel (std::shared_ptr chatRoom, QObj QObject::connect(coreManager->getContactsListModel(), &ContactsListModel::contactAdded, this, &ChatRoomModel::fullPeerAddressChanged); QObject::connect(coreManager->getContactsListModel(), &ContactsListModel::contactRemoved, this, &ChatRoomModel::usernameChanged); QObject::connect(coreManager->getContactsListModel(), &ContactsListModel::contactRemoved, this, &ChatRoomModel::fullPeerAddressChanged); + //QObject::connect(this, &ChatRoomModel::messageCountReset, coreManager, &CoreManager::eventCountChanged ); if(mChatRoom){ @@ -633,8 +634,8 @@ void ChatRoomModel::resetMessageCount () { } setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount()); setMissedCallsCount(0); - CoreManager::getInstance()->updateUnreadMessageCount(); emit messageCountReset(); + CoreManager::getInstance()->updateUnreadMessageCount(); } } //------------------------------------------------- diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 547fed01a..5281924f4 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -275,6 +275,10 @@ void CoreManager::createLinphoneCore (const QString &configPath) { mCore->enableFriendListSubscription(true); } +void CoreManager::handleChatRoomCreated(const std::shared_ptr &chatRoomModel){ + emit chatRoomModelCreated(chatRoomModel); +} + void CoreManager::migrate () { shared_ptr config = mCore->getConfig(); int rcVersion = config->getInt(SettingsModel::UiSection, RcVersionName, 0); diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index 02a20d79d..01c71c6cf 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -168,6 +168,7 @@ public slots: void stopIterate(); void setLastRemoteProvisioningState(const linphone::ConfiguringState& state); void createLinphoneCore (const QString &configPath);// In order to delay creation + void handleChatRoomCreated(const std::shared_ptr &chatRoomModel); signals: void coreManagerInitialized (); diff --git a/linphone-app/src/components/timeline/TimelineModel.cpp b/linphone-app/src/components/timeline/TimelineModel.cpp index 081ec65a7..113f337ec 100644 --- a/linphone-app/src/components/timeline/TimelineModel.cpp +++ b/linphone-app/src/components/timeline/TimelineModel.cpp @@ -51,8 +51,10 @@ TimelineModel::TimelineModel (std::shared_ptr chatRoom, QObj mChatRoomModel = ChatRoomModel::create(chatRoom); // mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoom); if( mChatRoomModel ){ + CoreManager::getInstance()->handleChatRoomCreated(mChatRoomModel); QObject::connect(mChatRoomModel.get(), &ChatRoomModel::unreadMessagesCountChanged, this, &TimelineModel::updateUnreadCount); QObject::connect(mChatRoomModel.get(), &ChatRoomModel::missedCallsCountChanged, this, &TimelineModel::updateUnreadCount); + QObject::connect(this, &TimelineModel::selectedChanged, this, &TimelineModel::updateUnreadCount); QObject::connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultProxyChanged, this, &TimelineModel::onDefaultProxyChanged); } diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index f0937731d..8162330dd 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -402,7 +402,6 @@ ColumnLayout { if (!SettingsModel.chatEnabled) { setEntryTypeFilter(ChatRoomModel.CallEntry) } - resetMessageCount() } chatRoomModel: conversation.chatRoomModel peerAddress: conversation.peerAddress