mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
Fix global unread notifications #LINQT-2024
This commit is contained in:
parent
453d16250a
commit
4a05b727c6
3 changed files with 16 additions and 0 deletions
|
|
@ -586,6 +586,14 @@ void App::initCore() {
|
|||
mAccountList->setInitialized(false);
|
||||
mAccountList->lUpdate(true);
|
||||
}
|
||||
// Update global unread Notifications when an account updates his unread Notifications
|
||||
connect(mAccountList.get(), &AccountList::unreadNotificationsChanged, this, [this]() {
|
||||
lDebug() << "unreadNotificationsChanged of AccountList";
|
||||
mCoreModelConnection->invokeToModel([this] {
|
||||
int n = mEventCountNotifier->getCurrentEventCount();
|
||||
mCoreModelConnection->invokeToCore([this, n] { mEventCountNotifier->notifyEventCount(n); });
|
||||
});
|
||||
});
|
||||
if (!mCallList) setCallList(CallList::create());
|
||||
else mCallList->lUpdate();
|
||||
if (!mSettings) {
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
|||
auto model = AccountCore::create(it);
|
||||
if (it == defaultAccount) defaultAccountCore = model;
|
||||
accounts->push_back(model);
|
||||
connect(model.get(), &AccountCore::unreadNotificationsChanged, this,
|
||||
[this] { emit unreadNotificationsChanged(); });
|
||||
connect(model.get(), &AccountCore::removed, this, [this, model]() {
|
||||
disconnect(model.get(), &AccountCore::unreadNotificationsChanged, this, nullptr);
|
||||
});
|
||||
}
|
||||
mModelConnection->invokeToCore([this, accounts, defaultAccountCore, isInitialization]() {
|
||||
mustBeInMainThread(getClassName());
|
||||
|
|
@ -74,6 +79,8 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
|||
}
|
||||
delete accounts;
|
||||
});
|
||||
// Update notification count at startup
|
||||
if (isInitialization) emit unreadNotificationsChanged();
|
||||
});
|
||||
});
|
||||
mModelConnection->makeConnectToModel(
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ signals:
|
|||
void haveAccountChanged();
|
||||
void defaultAccountChanged();
|
||||
void initializedChanged(bool init);
|
||||
void unreadNotificationsChanged();
|
||||
|
||||
private:
|
||||
bool mHaveAccount = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue