Notifications: Immediately request when getting account online

This commit is contained in:
Markus Goetz 2018-02-08 17:20:50 +01:00 committed by Roeland Jago Douma
parent 00d8343e76
commit 13b2e51dfe
No known key found for this signature in database
GPG key ID: F941078878347C0C
4 changed files with 19 additions and 0 deletions

View file

@ -237,6 +237,9 @@ void SettingsDialog::accountAdded(AccountState *s)
connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialog::slotAccountAvatarChanged); connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialog::slotAccountAvatarChanged);
connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialog::slotAccountDisplayNameChanged); connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialog::slotAccountDisplayNameChanged);
// Refresh immediatly when getting online
connect(s, &AccountState::isConnectedChanged, this, &SettingsDialog::slotRefreshActivityAccountStateSender);
slotRefreshActivity(s); slotRefreshActivity(s);
} }
@ -379,6 +382,11 @@ QAction *SettingsDialog::createColorAwareAction(const QString &iconPath, const Q
return createActionWithIcon(coloredIcon, text, iconPath); return createActionWithIcon(coloredIcon, text, iconPath);
} }
void SettingsDialog::slotRefreshActivityAccountStateSender()
{
slotRefreshActivity(qobject_cast<AccountState*>(sender()));
}
void SettingsDialog::slotRefreshActivity(AccountState *accountState) void SettingsDialog::slotRefreshActivity(AccountState *accountState)
{ {
if (accountState) { if (accountState) {

View file

@ -59,6 +59,7 @@ public slots:
void showIssuesList(const QString &folderAlias); void showIssuesList(const QString &folderAlias);
void slotSwitchPage(QAction *action); void slotSwitchPage(QAction *action);
void slotRefreshActivity(AccountState *accountState); void slotRefreshActivity(AccountState *accountState);
void slotRefreshActivityAccountStateSender();
void slotAccountAvatarChanged(); void slotAccountAvatarChanged();
void slotAccountDisplayNameChanged(); void slotAccountDisplayNameChanged();

View file

@ -21,6 +21,7 @@
#include "generalsettings.h" #include "generalsettings.h"
#include "networksettings.h" #include "networksettings.h"
#include "accountsettings.h" #include "accountsettings.h"
#include "accountstate.h"
#include "creds/abstractcredentials.h" #include "creds/abstractcredentials.h"
#include "configfile.h" #include "configfile.h"
#include "progressdispatcher.h" #include "progressdispatcher.h"
@ -161,6 +162,9 @@ void SettingsDialogMac::accountAdded(AccountState *s)
connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialogMac::slotAccountAvatarChanged); connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialogMac::slotAccountAvatarChanged);
connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialogMac::slotAccountDisplayNameChanged); connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialogMac::slotAccountDisplayNameChanged);
// Refresh immediatly when getting online
connect(s, &AccountState::isConnectedChanged, this, &SettingsDialogMac::slotRefreshActivityAccountStateSender);
slotRefreshActivity(s); slotRefreshActivity(s);
} }
@ -176,6 +180,11 @@ void SettingsDialogMac::accountRemoved(AccountState *s)
_activitySettings->slotRemoveAccount(s); _activitySettings->slotRemoveAccount(s);
} }
void SettingsDialogMac::slotRefreshActivityAccountStateSender()
{
slotRefreshActivity(qobject_cast<AccountState*>(sender()));
}
void SettingsDialogMac::slotRefreshActivity(AccountState *accountState) void SettingsDialogMac::slotRefreshActivity(AccountState *accountState)
{ {
if (accountState) { if (accountState) {

View file

@ -49,6 +49,7 @@ public slots:
void showActivityPage(); void showActivityPage();
void showIssuesList(const QString &folderAlias); void showIssuesList(const QString &folderAlias);
void slotRefreshActivity(AccountState *accountState); void slotRefreshActivity(AccountState *accountState);
void slotRefreshActivityAccountStateSender();
private slots: private slots:
void accountAdded(AccountState *); void accountAdded(AccountState *);