From 52a11b08359e619350df3a60130d96c95fc6e021 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 17 Nov 2015 11:53:49 +0100 Subject: [PATCH] Activities: Fix on Mac #4083 --- src/gui/settingsdialogmac.cpp | 22 ++++++++++++++++++---- src/gui/settingsdialogmac.h | 7 +++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/gui/settingsdialogmac.cpp b/src/gui/settingsdialogmac.cpp index 13134a2a1..51a0094d5 100644 --- a/src/gui/settingsdialogmac.cpp +++ b/src/gui/settingsdialogmac.cpp @@ -25,6 +25,7 @@ #include "progressdispatcher.h" #include "owncloudgui.h" #include "protocolwidget.h" +#include "activitywidget.h" #include "accountmanager.h" #include @@ -67,6 +68,12 @@ SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent) setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI())); + QIcon activityIcon(QLatin1String(":/client/resources/activity.png")); + _activitySettings = new ActivitySettings; + addPreferencesPanel(activityIcon, tr("Activity"), _activitySettings); + connect( _activitySettings, SIGNAL(guiLog(QString,QString)), _gui, + SLOT(slotShowOptionalTrayMessage(QString,QString)) ); + connect(AccountManager::instance(), &AccountManager::accountAdded, this, &SettingsDialogMac::accountAdded); connect(AccountManager::instance(), &AccountManager::accountRemoved, @@ -75,10 +82,6 @@ SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent) accountAdded(ai.data()); } - QIcon protocolIcon(QLatin1String(":/client/resources/activity.png")); - _protocolWidget = new ProtocolWidget; - addPreferencesPanel(protocolIcon, tr("Activity"), _protocolWidget); - QIcon generalIcon = MacStandardIcon::icon(MacStandardIcon::PreferencesGeneral); GeneralSettings *generalSettings = new GeneralSettings; addPreferencesPanel(generalIcon, tr("General"), generalSettings); @@ -120,6 +123,8 @@ void SettingsDialogMac::accountAdded(AccountState *s) connect( accountSettings, &AccountSettings::folderChanged, _gui, &ownCloudGui::slotFoldersChanged); connect( accountSettings, &AccountSettings::openFolderAlias, _gui, &ownCloudGui::slotFolderOpenAction); + + slotRefreshActivity(s); } void SettingsDialogMac::accountRemoved(AccountState *s) @@ -130,7 +135,16 @@ void SettingsDialogMac::accountRemoved(AccountState *s) removePreferencesPanel(p); } } + + _activitySettings->slotRemoveAccount(s); } +void SettingsDialogMac::slotRefreshActivity( AccountState* accountState ) +{ + if (accountState) { + qDebug() << "Refreshing Activity list for " << accountState->account()->displayName(); + _activitySettings->slotRefresh(accountState); + } +} } diff --git a/src/gui/settingsdialogmac.h b/src/gui/settingsdialogmac.h index fc7ea705a..a1b58694e 100644 --- a/src/gui/settingsdialogmac.h +++ b/src/gui/settingsdialogmac.h @@ -17,6 +17,7 @@ #include "progressdispatcher.h" #include "macpreferenceswindow.h" +#include "owncloudgui.h" class QStandardItemModel; class QListWidgetItem; @@ -30,6 +31,7 @@ class FolderMan; class ownCloudGui; class Folder; class AccountState; +class ActivitySettings; /** * @brief The SettingsDialogMac class @@ -44,15 +46,16 @@ public: public slots: void showActivityPage(); + void slotRefreshActivity(AccountState *accountState ); private slots: void accountAdded(AccountState *); void accountRemoved(AccountState *); - private: void closeEvent(QCloseEvent *event); - ProtocolWidget *_protocolWidget; // this is actually the activityPage + ProtocolWidget *_protocolWidget; + ActivitySettings *_activitySettings; ownCloudGui *_gui; int _protocolIdx;