Skip to content

Don't display resume sync if no account is configured #10999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog/unreleased/10939
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Change: Modernize systray menu
We had a closer look on the system tray and cleaned it up.

https://github.com/owncloud/client/issues/10939
https://github.com/owncloud/client/pull/10949
https://github.com/owncloud/client/pull/10999
20 changes: 9 additions & 11 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ void ownCloudGui::updateContextMenu()
bool isConfigured = (!accountList.isEmpty());
bool atLeastOneConnected = false;
bool atLeastOnePaused = false;
bool atLeastOneNotPaused = false;
for (const auto &a : accountList) {
if (a->isConnected()) {
atLeastOneConnected = true;
Expand All @@ -609,25 +608,24 @@ void ownCloudGui::updateContextMenu()
for (auto *f : FolderMan::instance()->folders()) {
if (f->syncPaused()) {
atLeastOnePaused = true;
} else {
atLeastOneNotPaused = true;
}
}

_contextMenu->addAction(Theme::instance()->applicationIcon(), tr("Show %1").arg(Theme::instance()->appNameGUI()), this, &ownCloudGui::slotShowSettings);
_contextMenu->addSeparator();
if (atLeastOnePaused) {
_contextMenu->addAction(
tr("Resume synchronization"), this, [this] { setPauseOnAllFoldersHelper(AccountManager::instance()->accounts().values(), false); });
} else {
_contextMenu->addAction(
tr("Stop synchronization"), this, [this] { setPauseOnAllFoldersHelper(AccountManager::instance()->accounts().values(), true); });
}
_contextMenu->addSeparator();

if (accountList.isEmpty()) {
_contextMenu->addAction(tr("Create a new account"), this, &ownCloudGui::runNewAccountWizard);
} else {
if (atLeastOnePaused) {
_contextMenu->addAction(
tr("Resume synchronization"), this, [this] { setPauseOnAllFoldersHelper(AccountManager::instance()->accounts().values(), false); });
} else {
_contextMenu->addAction(
tr("Stop synchronization"), this, [this] { setPauseOnAllFoldersHelper(AccountManager::instance()->accounts().values(), true); });
}
_contextMenu->addSeparator();

// submenus for accounts
for (const auto &account : accountList) {
QMenu *accountMenu = new QMenu(account->account()->displayName(), _contextMenu.data());
Expand Down