From bf9ee3754bd23b8414d798365c6f9e8ec3cd31b3 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 23 Oct 2024 17:07:17 +0800 Subject: [PATCH] Start counting storage usage from 0 for macOS virtual files account Signed-off-by: Claudio Cambra --- src/gui/macOS/fileprovidersettingscontroller_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/macOS/fileprovidersettingscontroller_mac.mm b/src/gui/macOS/fileprovidersettingscontroller_mac.mm index 7e97c6b8ed8c9..9d083300c6b49 100644 --- a/src/gui/macOS/fileprovidersettingscontroller_mac.mm +++ b/src/gui/macOS/fileprovidersettingscontroller_mac.mm @@ -211,16 +211,17 @@ void enumerateMaterialisedFilesForDomainManager(NSFileProviderManager * const ma const auto qDomainIdentifier = QString::fromNSString(domain.identifier); QVector qMaterialisedItems; qMaterialisedItems.reserve(items.count); + unsigned long long storageUsage = 0; for (const id item in items) { const auto itemMetadata = FileProviderItemMetadata::fromNSFileProviderItem(item, qDomainIdentifier); - const auto storageUsage = _storageUsage.value(qDomainIdentifier) + itemMetadata.documentSize(); + storageUsage += itemMetadata.documentSize(); qCDebug(lcFileProviderSettingsController) << "Adding item" << itemMetadata.identifier() << "with size" << itemMetadata.documentSize() << "to storage usage for account" << qDomainIdentifier << "with total size" << storageUsage; qMaterialisedItems.append(itemMetadata); - _storageUsage.insert(qDomainIdentifier, storageUsage); } + _storageUsage.insert(qDomainIdentifier, storageUsage); _materialisedFiles.insert(qDomainIdentifier, qMaterialisedItems); emit q->localStorageUsageForAccountChanged(qDomainIdentifier);