diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index 5640dd345..4e92337e6 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -47,6 +47,7 @@ private slots: void slotUpdateInfo(); void slotIgnoreFilesEditor(); void loadMiscSettings(); + private: Ui::GeneralSettings *_ui; QPointer _ignoreEditor; diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index 05aba5138..aacce23c2 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -20,16 +20,6 @@ General Settings - - - - For System Tray - - - Use &Monochrome Icons - - - @@ -44,6 +34,16 @@ + + + + For System Tray + + + Use &Monochrome Icons + + + @@ -252,6 +252,9 @@ + autostartCheckBox + desktopNotificationsCheckBox + monoIconsCheckBox ignoredFilesButton newFolderLimitCheckBox newFolderLimitSpinBox diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 21838528e..3e75882b9 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -17,6 +17,7 @@ #include "ocsnavigationappsjob.h" #include "theme.h" #include "folderman.h" +#include "configfile.h" #include "progressdispatcher.h" #include "owncloudsetupwizard.h" #include "sharedialog.h" @@ -34,7 +35,6 @@ #include "accountmanager.h" #include "common/syncjournalfilerecord.h" #include "creds/abstractcredentials.h" -#include "configfile.h" #ifdef WITH_LIBCLOUDPROVIDERS #include "cloudproviders/cloudprovidermanager.h" #endif @@ -54,6 +54,7 @@ #include #include +#include namespace OCC { @@ -398,13 +399,11 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men QAction *enable = menu->addAction(tr("Unpause all folders")); enable->setProperty(propertyAccountC, QVariant::fromValue(accountState)); connect(enable, &QAction::triggered, this, &ownCloudGui::slotUnpauseAllFolders); - _storedActionsForNavApps.append(enable); } if (!allPaused) { QAction *enable = menu->addAction(tr("Pause all folders")); enable->setProperty(propertyAccountC, QVariant::fromValue(accountState)); connect(enable, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders); - _storedActionsForNavApps.append(enable); } if (accountState->isSignedOut()) { @@ -415,7 +414,6 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men QAction *signout = menu->addAction(tr("Log out")); signout->setProperty(propertyAccountC, QVariant::fromValue(accountState)); connect(signout, &QAction::triggered, this, &ownCloudGui::slotLogout); - _storedActionsForNavApps.append(signout); } } } @@ -572,7 +570,6 @@ void ownCloudGui::updateContextMenu() menu->deleteLater(); } _accountMenus.clear(); - _storedActionsForNavApps.clear(); auto accountList = AccountManager::instance()->accounts(); @@ -620,7 +617,6 @@ void ownCloudGui::updateContextMenu() _contextMenu->addAction(_actionNewAccountWizard); } _contextMenu->addAction(_actionSettings); - if (!Theme::instance()->helpUrl().isEmpty()) { _contextMenu->addAction(_actionHelp); } @@ -762,7 +758,6 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply) if(!reply.isEmpty()){ auto element = reply.object().value("ocs").toObject().value("data"); auto navLinks = element.toArray(); - if(navLinks.size() > 0){ if(auto account = qvariant_cast(sender()->property(propertyAccountC))){ if(QMenu *accountMenu = qvariant_cast(sender()->property(propertyMenuC))){ @@ -770,17 +765,13 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply) // when there is only one account add the nav links above the settings QAction *actionBefore = _actionSettings; - // when there is more than one account add the nav links bellow the account submenu + // when there is more than one account add the nav links above pause/unpause folder or logout action if(AccountManager::instance()->accounts().size() > 1){ - foreach(QAction *action, _storedActionsForNavApps){ - qDebug() << "Action: " - << action->text(); + foreach(QAction *action, accountMenu->actions()){ + + // pause/unpause folder and logout actions have propertyAccountC if(auto actionAccount = qvariant_cast(action->property(propertyAccountC))){ - qDebug() << "Account found!" - << actionAccount->account()->displayName(); - if(actionAccount->account()->displayName() == account->displayName()){ - qDebug() << "Menu found!" - << actionAccount->account()->displayName(); + if(actionAccount->account() == account){ actionBefore = action; break; } @@ -806,13 +797,11 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply) } } - void ownCloudGui::slotOcsError(int statusCode, const QString &message) { emit serverError(statusCode, message); } - void ownCloudGui::slotRebuildRecentMenus() { _recentActionsMenu->clear(); diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h index c0fe1f5c2..432a22014 100644 --- a/src/gui/owncloudgui.h +++ b/src/gui/owncloudgui.h @@ -18,7 +18,6 @@ #include "systray.h" #include "connectionvalidator.h" #include "progressdispatcher.h" -#include "configfile.h" #include #include @@ -30,11 +29,6 @@ #include #endif -#include - -class QJsonDocument; -class QJsonObject; - namespace OCC { class Folder; @@ -100,6 +94,7 @@ public slots: void slotAccountStateChanged(); void slotTrayMessageIfServerUnsupported(Account *account); void slotNavigationAppsFetched(const QJsonDocument &reply); + /** * Open a share dialog for a file or folder. * @@ -121,14 +116,12 @@ private slots: void slotPauseAllFolders(); void slotNewAccountWizard(); - private: void setPauseOnAllFoldersHelper(bool pause); void setupActions(); void addAccountContextMenu(AccountStatePtr accountState, QMenu *menu, bool separateMenu); void fetchNavigationApps(AccountStatePtr account, QMenu *accountMenu); - QPointer _tray; #if defined(Q_OS_MAC) QPointer _settingsDialog; @@ -161,11 +154,9 @@ private: QAction *_actionHelp; QAction *_actionQuit; QAction *_actionCrash; - QList _recentItemsActions; - QList _storedActionsForNavApps; - Application *_app; - ConfigFile _cfg; + QList _recentItemsActions; + Application *_app; }; } // namespace OCC