Browse Source

Merge pull request #300 from nextcloud/upstream/pr/6351

SettingsDialogMac: Also start timer for notifications
Roeland Jago Douma 7 years ago
parent
commit
6ebcc638e0

+ 8 - 0
src/gui/settingsdialog.cpp

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

+ 1 - 0
src/gui/settingsdialog.h

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

+ 10 - 0
src/gui/settingsdialogmac.cpp

@@ -21,6 +21,7 @@
 #include "generalsettings.h"
 #include "networksettings.h"
 #include "accountsettings.h"
+#include "accountstate.h"
 #include "creds/abstractcredentials.h"
 #include "configfile.h"
 #include "progressdispatcher.h"
@@ -121,6 +122,7 @@ SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent)
 
     ConfigFile cfg;
     cfg.restoreGeometry(this);
+    _activitySettings->setNotificationRefreshInterval(cfg.notificationRefreshInterval());
 }
 
 void SettingsDialogMac::closeEvent(QCloseEvent *event)
@@ -160,6 +162,9 @@ void SettingsDialogMac::accountAdded(AccountState *s)
     connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialogMac::slotAccountAvatarChanged);
     connect(s->account().data(), &Account::accountChangedDisplayName, this, &SettingsDialogMac::slotAccountDisplayNameChanged);
 
+    // Refresh immediatly when getting online
+    connect(s, &AccountState::isConnectedChanged, this, &SettingsDialogMac::slotRefreshActivityAccountStateSender);
+
     slotRefreshActivity(s);
 }
 
@@ -175,6 +180,11 @@ void SettingsDialogMac::accountRemoved(AccountState *s)
     _activitySettings->slotRemoveAccount(s);
 }
 
+void SettingsDialogMac::slotRefreshActivityAccountStateSender()
+{
+    slotRefreshActivity(qobject_cast<AccountState*>(sender()));
+}
+
 void SettingsDialogMac::slotRefreshActivity(AccountState *accountState)
 {
     if (accountState) {

+ 1 - 0
src/gui/settingsdialogmac.h

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