Skip to content
Open
Changes from 1 commit
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
30 changes: 30 additions & 0 deletions src/gui/tray/syncstatussummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@
}
return status;
}

bool hasConfiguredSyncSource(const OCC::AccountStatePtr &accountState)

Check warning on line 40 in src/gui/tray/syncstatussummary.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/tray/syncstatussummary.cpp:40:6 [modernize-use-trailing-return-type]

use a trailing return type for this function
{
if (!accountState) {
return false;
}

for (const auto &folder : OCC::FolderMan::instance()->map()) {
if (folder && folder->accountState() == accountState.data()) {
return true;
}
}

#ifdef BUILD_FILE_PROVIDER_MODULE
const auto account = accountState->account();
const auto userIdAtHostWithPort = account->userIdAtHostWithPort();
if (OCC::Mac::FileProviderSettingsController::instance()->vfsEnabledForAccount(userIdAtHostWithPort)) {
return true;
}
#endif

return false;
}
}

namespace OCC {
Expand Down Expand Up @@ -403,9 +426,12 @@
setSyncing(false);
setTotalFiles(0);
setSyncStatusDetailString("");
if (_accountState && !_accountState->isConnected()) {

Check warning on line 429 in src/gui/tray/syncstatussummary.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/tray/syncstatussummary.cpp:429:57 [bugprone-branch-clone]

repeated branch in conditional chain
setSyncStatusString(tr("Offline"));
setSyncIcon(Theme::instance()->folderOffline());
} else if (!hasConfiguredSyncSource(_accountState)) {
setSyncStatusString(tr("Sync paused"));
setSyncIcon(Theme::instance()->pause());
} else {
setSyncStatusString(tr("All synced!"));
setSyncIcon(Theme::instance()->syncStatusOk());
Expand All @@ -429,6 +455,10 @@
{
auto syncStateFallbackNeeded = true;
for (const auto &folder : FolderMan::instance()->map()) {
if (!folder || folder->accountState() != _accountState.data()) {
continue;
}

onFolderSyncStateChanged(folder);
syncStateFallbackNeeded = false;
}
Expand Down