diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 679cd4048..9bd5452df 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -310,6 +310,9 @@ int CoreManager::getEventCount () const { int CoreManager::getMissedCallCount(const QString &peerAddress, const QString &localAddress)const{ return mEventCountNotifier ? mEventCountNotifier->getMissedCallCount(peerAddress, localAddress) : 0; } +int CoreManager::getMissedCallCountFromLocal( const QString &localAddress)const{ + return mEventCountNotifier ? mEventCountNotifier->getMissedCallCountFromLocal(localAddress) : 0; +} // ----------------------------------------------------------------------------- void CoreManager::iterate () { diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index 6235307ee..27fb88997 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -131,6 +131,7 @@ public: Q_INVOKABLE void cleanLogs () const; int getMissedCallCount(const QString &peerAddress, const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines) + int getMissedCallCountFromLocal(const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines) signals: void coreCreated (); 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 06c8365d9..7abd1196c 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp @@ -77,6 +77,15 @@ int AbstractEventCountNotifier::getMissedCallCount(const QString &peerAddress, c else return 0; } +// Get missed call from a chat (useful for showing bubbles on Timelines) +int AbstractEventCountNotifier::getMissedCallCountFromLocal(const QString &localAddress) const{ + int count = 0; + for(auto it = mMissedCalls.cbegin() ; it != mMissedCalls.cend() ; ++it){ + if(it.key().second == localAddress) + count += *it; + } + return count; +} // ----------------------------------------------------------------------------- void AbstractEventCountNotifier::handleChatModelCreated (const shared_ptr &chatModel) { diff --git a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp index 4797fa227..923640323 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp @@ -53,6 +53,7 @@ public: int getEventCount () const { return mUnreadMessageCount + getMissedCallCount(); } int getMissedCallCount(const QString &peerAddress, const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines) + int getMissedCallCountFromLocal(const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines) signals: void eventCountChanged (int count); diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 3ca1c09b3..6d4ae64e7 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -406,6 +406,7 @@ QVariantList AccountSettingsModel::getAccounts () const { account["sipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly()); account["fullSipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asString()); account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->createPrimaryContactParsed()); + account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); account["proxyConfig"].setValue(nullptr); accounts << account; } @@ -416,6 +417,7 @@ QVariantList AccountSettingsModel::getAccounts () const { account["fullSipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asString()); account["proxyConfig"].setValue(proxyConfig); account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount(); + account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); accounts << account; } diff --git a/linphone-app/ui/views/App/Main/Dialogs/ManageAccounts.qml b/linphone-app/ui/views/App/Main/Dialogs/ManageAccounts.qml index 74a59dcd5..71f0b89c7 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/ManageAccounts.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/ManageAccounts.qml @@ -103,7 +103,7 @@ DialogPlus { MessageCounter { anchors.fill: parent - count: flattenedModel.unreadMessageCount + count: flattenedModel.unreadMessageCount+flattenedModel.missedCallCount } } }