Skip to content

Commit

Permalink
Start counting storage usage from 0 for macOS virtual files account
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Nov 5, 2024
1 parent 01da699 commit 4f8a83b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/macOS/fileprovidersettingscontroller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,17 @@ void enumerateMaterialisedFilesForDomainManager(NSFileProviderManager * const ma
const auto qDomainIdentifier = QString::fromNSString(domain.identifier);
QVector<FileProviderItemMetadata> qMaterialisedItems;
qMaterialisedItems.reserve(items.count);
unsigned long long storageUsage = 0;
for (const id<NSFileProviderItem> 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);
Expand Down

0 comments on commit 4f8a83b

Please sign in to comment.