diff --git a/src/gui/macOS/fileprovidersettingscontroller_mac.mm b/src/gui/macOS/fileprovidersettingscontroller_mac.mm index 7e97c6b8ed8c..9d083300c6b4 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);