fix automatic presence when app focus changes #LINQT-2172
This commit is contained in:
parent
b2ae9213a2
commit
c8428d6ade
1 changed files with 14 additions and 15 deletions
|
|
@ -1069,9 +1069,8 @@ bool App::notify(QObject *receiver, QEvent *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::handleAppActivity() {
|
void App::handleAppActivity() {
|
||||||
auto handle = [this](AccountGui *currentAcount) {
|
auto handle = [this](QSharedPointer<AccountCore> accountCore) {
|
||||||
auto accountCore = currentAcount->mCore;
|
if (!accountCore) return;
|
||||||
Q_ASSERT(accountCore);
|
|
||||||
auto accountPresence = accountCore->getPresence();
|
auto accountPresence = accountCore->getPresence();
|
||||||
if ((mMainWindow && mMainWindow->isActive() || (mCallsWindow && mCallsWindow->isActive())) &&
|
if ((mMainWindow && mMainWindow->isActive() || (mCallsWindow && mCallsWindow->isActive())) &&
|
||||||
accountPresence == LinphoneEnums::Presence::Away)
|
accountPresence == LinphoneEnums::Presence::Away)
|
||||||
|
|
@ -1081,20 +1080,20 @@ void App::handleAppActivity() {
|
||||||
accountCore->lSetPresence(LinphoneEnums::Presence::Away);
|
accountCore->lSetPresence(LinphoneEnums::Presence::Away);
|
||||||
};
|
};
|
||||||
if (mAccountList) {
|
if (mAccountList) {
|
||||||
if (mAccountList->getDefaultAccount()) {
|
for (auto &account : mAccountList->getSharedList<AccountCore>())
|
||||||
handle(mAccountList->getDefaultAccount());
|
handle(account);
|
||||||
} else {
|
} else {
|
||||||
connect(
|
connect(
|
||||||
mAccountList.get(), &AccountList::defaultAccountChanged, this,
|
this, &App::accountsChanged, this,
|
||||||
[this, handle] {
|
[this, &handle] {
|
||||||
if (mAccountList->getDefaultAccount()) {
|
if (mAccountList) {
|
||||||
handle(mAccountList->getDefaultAccount());
|
for (auto &account : mAccountList->getSharedList<AccountCore>())
|
||||||
|
handle(account);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Qt::SingleShotConnection);
|
Qt::SingleShotConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QQuickWindow *App::getCallsWindow() {
|
QQuickWindow *App::getCallsWindow() {
|
||||||
return mCallsWindow;
|
return mCallsWindow;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue