From 3a40c098d3752f26320f0e18e3a3da8d90a1c96f Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 29 Sep 2023 01:25:10 +0800 Subject: [PATCH] Add method to get qtified file provider item metadata for account in FileProviderSettingsController Signed-off-by: Claudio Cambra --- .../fileprovidersettingscontroller_mac.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gui/macOS/fileprovidersettingscontroller_mac.mm b/src/gui/macOS/fileprovidersettingscontroller_mac.mm index 77348fc14ea82..bc29a308981ff 100644 --- a/src/gui/macOS/fileprovidersettingscontroller_mac.mm +++ b/src/gui/macOS/fileprovidersettingscontroller_mac.mm @@ -18,6 +18,7 @@ #include "gui/systray.h" #include "gui/userinfo.h" +#include "gui/macOS/fileprovideritemmetadata.h" // Objective-C imports #import @@ -154,6 +155,24 @@ float gbFromBytesWithOneDecimal(const unsigned long long bytes) return storageUsage.unsignedLongLongValue; } + [[nodiscard]] QVector materialisedItemsForAccount(const QString &userIdAtHost) const + { + const auto materialisedItems = [_materialisedFiles objectForKey:userIdAtHost.toNSString()]; + if (materialisedItems == nil) { + return {}; + } + + QVector qMaterialisedItems; + qMaterialisedItems.reserve(materialisedItems.count); + + for (const id item in materialisedItems) { + const auto itemMetadata = FileProviderItemMetadata::fromNSFileProviderItem(item); + qMaterialisedItems.append(itemMetadata); + } + + return qMaterialisedItems; + } + private: [[nodiscard]] NSArray *nsEnabledAccounts() const {