Process state of file provider account domains in slotComputeOverallSyncStatus

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-07-17 17:32:35 +08:00
parent 98dba86f58
commit 84d74bc5ab
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -65,6 +65,7 @@
#ifdef BUILD_FILE_PROVIDER_MODULE #ifdef BUILD_FILE_PROVIDER_MODULE
#include "macOS/fileprovider.h" #include "macOS/fileprovider.h"
#include "macOS/fileproviderdomainmanager.h"
#include "macOS/fileprovidersettingscontroller.h" #include "macOS/fileprovidersettingscontroller.h"
#endif #endif
@ -299,6 +300,25 @@ void ownCloudGui::slotComputeOverallSyncStatus()
} }
} }
#ifdef BUILD_FILE_PROVIDER_MODULE
QList<QString> syncingFileProviderAccounts;
if (Mac::FileProvider::fileProviderAvailable()) {
for (const auto &accountState : AccountManager::instance()->accounts()) {
const auto accountFpId = Mac::FileProviderDomainManager::fileProviderDomainIdentifierFromAccountState(accountState);
if (!Mac::FileProviderSettingsController::instance()->vfsEnabledForAccount(accountFpId)) {
continue;
}
const auto socketState = Mac::FileProvider::instance()->socketServer()->socketStateForAccount(accountFpId);
if (!socketState.connected || socketState.latestStatus == SyncResult::Problem || socketState.latestStatus == SyncResult::Error) {
problemAccounts.append(accountState);
} else if (socketState.latestStatus == SyncResult::SyncRunning) {
syncingFileProviderAccounts.append(accountFpId);
}
}
}
#endif
if (!problemAccounts.empty()) { if (!problemAccounts.empty()) {
_tray->setIcon(Theme::instance()->folderOfflineIcon(true)); _tray->setIcon(Theme::instance()->folderOfflineIcon(true));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN