Skip to content

Commit

Permalink
gui/tray: Handle troubled/no longer troubled file provider sync states
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra committed Feb 17, 2025
1 parent 8148815 commit b7d7bf3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/gui/tray/syncstatussummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ void SyncStatusSummary::setSyncState(const SyncResult::Status state)
case SyncResult::Success:
case SyncResult::SyncPrepare:
// Success should only be shown if all folders were fine
if (!folderErrors() || folderError(folder)) {
if (!folderErrors()
#ifdef BUILD_FILE_PROVIDER_MODULE
&& _fileProviderDomainsWithErrors.empty()
#endif
) {
setSyncing(false);
setTotalFiles(0);
setSyncStatusString(tr("All synced!"));
Expand Down Expand Up @@ -232,6 +236,25 @@ void SyncStatusSummary::onFileProviderDomainSyncStateChanged(const AccountPtr &a
if (!_accountState || !_accountState->isConnected() || account != _accountState->account()) {
return;
}

switch (state) {
case SyncResult::Success:
case SyncResult::SyncPrepare:
// Success should only be shown if all folders were fine
_fileProviderDomainsWithErrors.erase(account->userIdAtHostWithPort());
break;
case SyncResult::Error:
case SyncResult::SetupError:
case SyncResult::Problem:
case SyncResult::Undefined:
_fileProviderDomainsWithErrors.insert(account->userIdAtHostWithPort());
case SyncResult::SyncRunning:
case SyncResult::NotYetStarted:
case SyncResult::Paused:
case SyncResult::SyncAbortRequested:
break;
}

setSyncState(state);
}

Expand Down
7 changes: 7 additions & 0 deletions src/gui/tray/syncstatussummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public slots:
void onFolderSyncStateChanged(const Folder *folder);
void onIsConnectedChanged();

#ifdef BUILD_FILE_PROVIDER_MODULE
void onFileProviderDomainSyncStateChanged(const AccountPtr &account, const SyncResult::Status status);
#endif

void setSyncState(const SyncResult::Status state);
void setSyncStateForFolder(const Folder *folder);
void markFolderAsError(const Folder *folder);
Expand All @@ -87,6 +91,9 @@ public slots:

AccountStatePtr _accountState;
std::set<QString> _foldersWithErrors;
#ifdef BUILD_FILE_PROVIDER_MODULE
std::set<QString> _fileProviderDomainsWithErrors;
#endif

QUrl _syncIcon = Theme::instance()->syncStatusOk();
double _progress = 1.0;
Expand Down

0 comments on commit b7d7bf3

Please sign in to comment.