Activities: Fix on Mac #4083

This commit is contained in:
Markus Goetz 2015-11-17 11:53:49 +01:00
parent ef17dc6482
commit 52a11b0835
2 changed files with 23 additions and 6 deletions

View file

@ -25,6 +25,7 @@
#include "progressdispatcher.h"
#include "owncloudgui.h"
#include "protocolwidget.h"
#include "activitywidget.h"
#include "accountmanager.h"
#include <QLabel>
@ -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);
}
}
}

View file

@ -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;