mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 06:25:56 +03:00
Compares account menu with the account associated with the action to make sure apps is added to the right position.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
4ffff7454e
commit
99d8d050c2
4 changed files with 24 additions and 40 deletions
|
@ -47,6 +47,7 @@ private slots:
|
||||||
void slotUpdateInfo();
|
void slotUpdateInfo();
|
||||||
void slotIgnoreFilesEditor();
|
void slotIgnoreFilesEditor();
|
||||||
void loadMiscSettings();
|
void loadMiscSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *_ui;
|
Ui::GeneralSettings *_ui;
|
||||||
QPointer<IgnoreListEditor> _ignoreEditor;
|
QPointer<IgnoreListEditor> _ignoreEditor;
|
||||||
|
|
|
@ -20,16 +20,6 @@
|
||||||
<string>General Settings</string>
|
<string>General Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="monoIconsCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>For System Tray</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Use &Monochrome Icons</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="autostartCheckBox">
|
<widget class="QCheckBox" name="autostartCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -44,6 +34,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="monoIconsCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>For System Tray</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Use &Monochrome Icons</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -252,6 +252,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>autostartCheckBox</tabstop>
|
||||||
|
<tabstop>desktopNotificationsCheckBox</tabstop>
|
||||||
|
<tabstop>monoIconsCheckBox</tabstop>
|
||||||
<tabstop>ignoredFilesButton</tabstop>
|
<tabstop>ignoredFilesButton</tabstop>
|
||||||
<tabstop>newFolderLimitCheckBox</tabstop>
|
<tabstop>newFolderLimitCheckBox</tabstop>
|
||||||
<tabstop>newFolderLimitSpinBox</tabstop>
|
<tabstop>newFolderLimitSpinBox</tabstop>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "ocsnavigationappsjob.h"
|
#include "ocsnavigationappsjob.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "folderman.h"
|
#include "folderman.h"
|
||||||
|
#include "configfile.h"
|
||||||
#include "progressdispatcher.h"
|
#include "progressdispatcher.h"
|
||||||
#include "owncloudsetupwizard.h"
|
#include "owncloudsetupwizard.h"
|
||||||
#include "sharedialog.h"
|
#include "sharedialog.h"
|
||||||
|
@ -34,7 +35,6 @@
|
||||||
#include "accountmanager.h"
|
#include "accountmanager.h"
|
||||||
#include "common/syncjournalfilerecord.h"
|
#include "common/syncjournalfilerecord.h"
|
||||||
#include "creds/abstractcredentials.h"
|
#include "creds/abstractcredentials.h"
|
||||||
#include "configfile.h"
|
|
||||||
#ifdef WITH_LIBCLOUDPROVIDERS
|
#ifdef WITH_LIBCLOUDPROVIDERS
|
||||||
#include "cloudproviders/cloudprovidermanager.h"
|
#include "cloudproviders/cloudprovidermanager.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
@ -398,13 +399,11 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men
|
||||||
QAction *enable = menu->addAction(tr("Unpause all folders"));
|
QAction *enable = menu->addAction(tr("Unpause all folders"));
|
||||||
enable->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
enable->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
||||||
connect(enable, &QAction::triggered, this, &ownCloudGui::slotUnpauseAllFolders);
|
connect(enable, &QAction::triggered, this, &ownCloudGui::slotUnpauseAllFolders);
|
||||||
_storedActionsForNavApps.append(enable);
|
|
||||||
}
|
}
|
||||||
if (!allPaused) {
|
if (!allPaused) {
|
||||||
QAction *enable = menu->addAction(tr("Pause all folders"));
|
QAction *enable = menu->addAction(tr("Pause all folders"));
|
||||||
enable->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
enable->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
||||||
connect(enable, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders);
|
connect(enable, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders);
|
||||||
_storedActionsForNavApps.append(enable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountState->isSignedOut()) {
|
if (accountState->isSignedOut()) {
|
||||||
|
@ -415,7 +414,6 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men
|
||||||
QAction *signout = menu->addAction(tr("Log out"));
|
QAction *signout = menu->addAction(tr("Log out"));
|
||||||
signout->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
signout->setProperty(propertyAccountC, QVariant::fromValue(accountState));
|
||||||
connect(signout, &QAction::triggered, this, &ownCloudGui::slotLogout);
|
connect(signout, &QAction::triggered, this, &ownCloudGui::slotLogout);
|
||||||
_storedActionsForNavApps.append(signout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -572,7 +570,6 @@ void ownCloudGui::updateContextMenu()
|
||||||
menu->deleteLater();
|
menu->deleteLater();
|
||||||
}
|
}
|
||||||
_accountMenus.clear();
|
_accountMenus.clear();
|
||||||
_storedActionsForNavApps.clear();
|
|
||||||
|
|
||||||
auto accountList = AccountManager::instance()->accounts();
|
auto accountList = AccountManager::instance()->accounts();
|
||||||
|
|
||||||
|
@ -620,7 +617,6 @@ void ownCloudGui::updateContextMenu()
|
||||||
_contextMenu->addAction(_actionNewAccountWizard);
|
_contextMenu->addAction(_actionNewAccountWizard);
|
||||||
}
|
}
|
||||||
_contextMenu->addAction(_actionSettings);
|
_contextMenu->addAction(_actionSettings);
|
||||||
|
|
||||||
if (!Theme::instance()->helpUrl().isEmpty()) {
|
if (!Theme::instance()->helpUrl().isEmpty()) {
|
||||||
_contextMenu->addAction(_actionHelp);
|
_contextMenu->addAction(_actionHelp);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +758,6 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply)
|
||||||
if(!reply.isEmpty()){
|
if(!reply.isEmpty()){
|
||||||
auto element = reply.object().value("ocs").toObject().value("data");
|
auto element = reply.object().value("ocs").toObject().value("data");
|
||||||
auto navLinks = element.toArray();
|
auto navLinks = element.toArray();
|
||||||
|
|
||||||
if(navLinks.size() > 0){
|
if(navLinks.size() > 0){
|
||||||
if(auto account = qvariant_cast<AccountPtr>(sender()->property(propertyAccountC))){
|
if(auto account = qvariant_cast<AccountPtr>(sender()->property(propertyAccountC))){
|
||||||
if(QMenu *accountMenu = qvariant_cast<QMenu*>(sender()->property(propertyMenuC))){
|
if(QMenu *accountMenu = qvariant_cast<QMenu*>(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
|
// when there is only one account add the nav links above the settings
|
||||||
QAction *actionBefore = _actionSettings;
|
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){
|
if(AccountManager::instance()->accounts().size() > 1){
|
||||||
foreach(QAction *action, _storedActionsForNavApps){
|
foreach(QAction *action, accountMenu->actions()){
|
||||||
qDebug() << "Action: "
|
|
||||||
<< action->text();
|
// pause/unpause folder and logout actions have propertyAccountC
|
||||||
if(auto actionAccount = qvariant_cast<AccountStatePtr>(action->property(propertyAccountC))){
|
if(auto actionAccount = qvariant_cast<AccountStatePtr>(action->property(propertyAccountC))){
|
||||||
qDebug() << "Account found!"
|
if(actionAccount->account() == account){
|
||||||
<< actionAccount->account()->displayName();
|
|
||||||
if(actionAccount->account()->displayName() == account->displayName()){
|
|
||||||
qDebug() << "Menu found!"
|
|
||||||
<< actionAccount->account()->displayName();
|
|
||||||
actionBefore = action;
|
actionBefore = action;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -806,13 +797,11 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ownCloudGui::slotOcsError(int statusCode, const QString &message)
|
void ownCloudGui::slotOcsError(int statusCode, const QString &message)
|
||||||
{
|
{
|
||||||
emit serverError(statusCode, message);
|
emit serverError(statusCode, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ownCloudGui::slotRebuildRecentMenus()
|
void ownCloudGui::slotRebuildRecentMenus()
|
||||||
{
|
{
|
||||||
_recentActionsMenu->clear();
|
_recentActionsMenu->clear();
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
#include "connectionvalidator.h"
|
#include "connectionvalidator.h"
|
||||||
#include "progressdispatcher.h"
|
#include "progressdispatcher.h"
|
||||||
#include "configfile.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
@ -30,11 +29,6 @@
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QJsonArray>
|
|
||||||
|
|
||||||
class QJsonDocument;
|
|
||||||
class QJsonObject;
|
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
class Folder;
|
class Folder;
|
||||||
|
@ -100,6 +94,7 @@ public slots:
|
||||||
void slotAccountStateChanged();
|
void slotAccountStateChanged();
|
||||||
void slotTrayMessageIfServerUnsupported(Account *account);
|
void slotTrayMessageIfServerUnsupported(Account *account);
|
||||||
void slotNavigationAppsFetched(const QJsonDocument &reply);
|
void slotNavigationAppsFetched(const QJsonDocument &reply);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a share dialog for a file or folder.
|
* Open a share dialog for a file or folder.
|
||||||
*
|
*
|
||||||
|
@ -121,14 +116,12 @@ private slots:
|
||||||
void slotPauseAllFolders();
|
void slotPauseAllFolders();
|
||||||
void slotNewAccountWizard();
|
void slotNewAccountWizard();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setPauseOnAllFoldersHelper(bool pause);
|
void setPauseOnAllFoldersHelper(bool pause);
|
||||||
void setupActions();
|
void setupActions();
|
||||||
void addAccountContextMenu(AccountStatePtr accountState, QMenu *menu, bool separateMenu);
|
void addAccountContextMenu(AccountStatePtr accountState, QMenu *menu, bool separateMenu);
|
||||||
void fetchNavigationApps(AccountStatePtr account, QMenu *accountMenu);
|
void fetchNavigationApps(AccountStatePtr account, QMenu *accountMenu);
|
||||||
|
|
||||||
|
|
||||||
QPointer<Systray> _tray;
|
QPointer<Systray> _tray;
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
QPointer<SettingsDialogMac> _settingsDialog;
|
QPointer<SettingsDialogMac> _settingsDialog;
|
||||||
|
@ -161,11 +154,9 @@ private:
|
||||||
QAction *_actionHelp;
|
QAction *_actionHelp;
|
||||||
QAction *_actionQuit;
|
QAction *_actionQuit;
|
||||||
QAction *_actionCrash;
|
QAction *_actionCrash;
|
||||||
QList<QAction *> _recentItemsActions;
|
|
||||||
QList<QAction *> _storedActionsForNavApps;
|
|
||||||
Application *_app;
|
|
||||||
|
|
||||||
ConfigFile _cfg;
|
QList<QAction *> _recentItemsActions;
|
||||||
|
Application *_app;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|
Loading…
Reference in a new issue