Skip to content

Commit

Permalink
Fix overall status computation
Browse files Browse the repository at this point in the history
Fixes: #9270
  • Loading branch information
TheOneRing committed Mar 1, 2023
1 parent 3449966 commit eba85e4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 37 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/9270
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: Fix computation of sync status when multiple folders are synced

https://github.com/owncloud/client/issues/9270
43 changes: 7 additions & 36 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,42 +85,12 @@ void TrayOverallStatusResult::addResult(Folder *f)
lastSyncDone = time;
}

const auto status = f->syncPaused() ? SyncResult::Paused : f->syncResult().status();
switch (status) {
case SyncResult::Paused:
Q_FALLTHROUGH();
case SyncResult::SyncAbortRequested:
// Problem has a high enum value but real problems and errors
// take precedence
if (_overallStatus.status() < SyncResult::Success) {
_overallStatus.setStatus(status);
}
break;
case SyncResult::Success:
Q_FALLTHROUGH();
case SyncResult::NotYetStarted:
Q_FALLTHROUGH();
case SyncResult::SyncPrepare:
Q_FALLTHROUGH();
case SyncResult::SyncRunning:
if (_overallStatus.status() < SyncResult::Problem) {
_overallStatus.setStatus(status);
}
break;
case SyncResult::Undefined:
if (_overallStatus.status() < SyncResult::Problem) {
_overallStatus.setStatus(SyncResult::Problem);
}
break;
case SyncResult::Problem:
Q_FALLTHROUGH();
case SyncResult::Error:
Q_FALLTHROUGH();
case SyncResult::SetupError:
if (_overallStatus.status() < status) {
_overallStatus.setStatus(status);
}
break;
auto status = f->syncPaused() ? SyncResult::Paused : f->syncResult().status();
if (status == SyncResult::Undefined) {
status = SyncResult::Problem;
}
if (status > _overallStatus.status()) {
_overallStatus.setStatus(status);
}
}

Expand Down Expand Up @@ -1158,6 +1128,7 @@ QString FolderMan::trayTooltipStatusString(
folderMessage = tr("Sync is running.");
break;
case SyncResult::Success:
[[fallthrough]];
case SyncResult::Problem:
if (result.hasUnresolvedConflicts()) {
folderMessage = tr("Sync was successful, unresolved conflicts.");
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/syncresult.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class OWNCLOUDSYNC_EXPORT SyncResult
// overall status
enum Status {
Undefined,
NotYetStarted,
Success,
NotYetStarted,
SyncPrepare,
SyncRunning,
SyncAbortRequested,
Expand Down

0 comments on commit eba85e4

Please sign in to comment.