Skip to content

Commit

Permalink
Store materialised file metadata in file provider settings controller
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Sep 28, 2023
1 parent 777bb9f commit 00ce50e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/macOS/fileprovidersettingscontroller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,21 @@ void fetchMaterialisedFilesStorageUsage()
}

const NSUInteger usage = storageUseObserver.usage;
NSSet<id<NSFileProviderItem>> *const items = storageUseObserver.materialisedItems;

// Remember that OCC::Account::userIdAtHost == domain.identifier for us
NSMutableDictionary<NSString *, NSNumber *> *const mutableStorageDictCopy = _storageUsage.mutableCopy;
NSMutableDictionary<NSString *, NSSet<id<NSFileProviderItem>> *> *const mutableFilesDictCopy = _materialisedFiles.mutableCopy;

qCDebug(lcFileProviderSettingsController) << "Local storage use for"
<< domain.identifier
<< usage;

[mutableStorageDictCopy setObject:@(usage) forKey:domain.identifier];
[mutableFilesDictCopy setObject:items forKey:domain.identifier];

_storageUsage = mutableStorageDictCopy.copy;
_materialisedFiles = mutableFilesDictCopy.copy;

const auto qDomainIdentifier = QString::fromNSString(domain.identifier);
emit q->localStorageUsageForAccountChanged(qDomainIdentifier);
Expand Down Expand Up @@ -252,6 +257,7 @@ void initialCheck()
NSUserDefaults *_userDefaults = NSUserDefaults.standardUserDefaults;
NSString *_accountsKey = [NSString stringWithUTF8String:enabledAccountsSettingsKey];
NSDictionary <NSString *, NSNumber *> *_storageUsage = @{};
NSDictionary <NSString *, NSSet<id<NSFileProviderItem>> *> *_materialisedFiles = @{};
};

FileProviderSettingsController *FileProviderSettingsController::instance()
Expand Down

0 comments on commit 00ce50e

Please sign in to comment.