diff --git a/src/gui/macOS/fileprovidersettingscontroller.h b/src/gui/macOS/fileprovidersettingscontroller.h index 2db4ae8836..6bc7fc010a 100644 --- a/src/gui/macOS/fileprovidersettingscontroller.h +++ b/src/gui/macOS/fileprovidersettingscontroller.h @@ -51,6 +51,7 @@ public: public slots: void setVfsEnabledForAccount(const QString &userIdAtHost, const bool setEnabled); + void setFastEnumerationEnabledForAccount(const QString &userIdAtHost, const bool setEnabled); void createEvictionWindowForAccount(const QString &userIdAtHost); void signalFileProviderDomain(const QString &userIdAtHost); @@ -61,6 +62,8 @@ signals: void localStorageUsageForAccountChanged(const QString &userIdAtHost); void remoteStorageUsageForAccountChanged(const QString &userIdAtHost); void materialisedItemsForAccountChanged(const QString &userIdAtHost); + void fastEnumerationEnabledForAccountChanged(const QString &userIdAtHost); + void fastEnumerationSetForAccountChanged(const QString &userIdAtHost); private: explicit FileProviderSettingsController(QObject *parent = nullptr); diff --git a/src/gui/macOS/fileprovidersettingscontroller_mac.mm b/src/gui/macOS/fileprovidersettingscontroller_mac.mm index b94224c7d6..3265f059b4 100644 --- a/src/gui/macOS/fileprovidersettingscontroller_mac.mm +++ b/src/gui/macOS/fileprovidersettingscontroller_mac.mm @@ -374,6 +374,20 @@ bool FileProviderSettingsController::fastEnumerationEnabledForAccount(const QStr return false; } +void FileProviderSettingsController::setFastEnumerationEnabledForAccount(const QString &userIdAtHost, const bool setEnabled) +{ + const auto xpc = FileProvider::instance()->xpc(); + if (!xpc) { + // Reset state of UI elements + emit fastEnumerationEnabledForAccountChanged(userIdAtHost); + emit fastEnumerationSetForAccountChanged(userIdAtHost); + return; + } + xpc->setFastEnumerationEnabledForExtension(userIdAtHost, setEnabled); + emit fastEnumerationEnabledForAccountChanged(userIdAtHost); + emit fastEnumerationSetForAccountChanged(userIdAtHost); +} + unsigned long long FileProviderSettingsController::localStorageUsageForAccount(const QString &userIdAtHost) const { return d->localStorageUsageForAccount(userIdAtHost);