Skip to content

Commit

Permalink
Merge pull request #6686 from nextcloud/backport/6588/stable-3.12
Browse files Browse the repository at this point in the history
Backport/6588/stable 3.12
  • Loading branch information
camilasan authored Apr 24, 2024
2 parents a225e57 + a8fe9cf commit 8c81539
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/gui/systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,8 @@ void Systray::create()
}
hideWindow();
emit activated(QSystemTrayIcon::ActivationReason::Unknown);

const auto folderMap = FolderMan::instance()->map();
for (const auto *folder : folderMap) {
if (!folder->syncPaused()) {
_syncIsPaused = false;
break;
}
}
slotUpdateSyncPausedState();
connect(FolderMan::instance(), &FolderMan::folderListChanged, this, &Systray::slotUpdateSyncPausedState);
}

void Systray::showWindow(WindowPosition position)
Expand Down Expand Up @@ -435,6 +429,22 @@ void Systray::slotCurrentUserChanged()
UserAppsModel::instance()->buildAppList();
}

void Systray::slotUpdateSyncPausedState()
{
const auto folderMap = FolderMan::instance()->map();
for (const auto folder : folderMap) {
connect(folder, &Folder::syncPausedChanged, this, &Systray::slotUpdateSyncPausedState, Qt::UniqueConnection);
if (!folder->syncPaused()) {
_syncIsPaused = false;
emit syncIsPausedChanged();
return;
}
}

_syncIsPaused = true;
emit syncIsPausedChanged();
}

void Systray::slotUnpauseAllFolders()
{
setPauseOnAllFoldersHelper(false);
Expand Down Expand Up @@ -567,6 +577,7 @@ void Systray::setSyncIsPaused(const bool syncIsPaused)
} else {
slotUnpauseAllFolders();
}
emit syncIsPausedChanged();
}

/********************************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions src/gui/systray.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public slots:
void presentShareViewInTray(const QString &localPath);

private slots:
void slotUpdateSyncPausedState();
void slotUnpauseAllFolders();
void slotPauseAllFolders();

Expand Down

0 comments on commit 8c81539

Please sign in to comment.