Add Missed call count for local proxies

This commit is contained in:
Julien Wadel 2020-05-29 09:35:59 +02:00
parent c41f337907
commit eca8bd8ab4
6 changed files with 17 additions and 1 deletions

View file

@ -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 () {

View file

@ -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 ();

View file

@ -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> &chatModel) {

View file

@ -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);

View file

@ -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;
}

View file

@ -103,7 +103,7 @@ DialogPlus {
MessageCounter {
anchors.fill: parent
count: flattenedModel.unreadMessageCount
count: flattenedModel.unreadMessageCount+flattenedModel.missedCallCount
}
}
}