Instantiate and hook up FileProviderFastEnumerationSettings within FileProviderSettings
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 19 Feb 2024 09:00:47 +0000 (17:00 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 6 Mar 2024 10:46:41 +0000 (18:46 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/macOS/ui/FileProviderSettings.qml

index f3844f2458c2026eed75c2ad72b158d284aa2f91..c9fc2f23cb74c6a5d94199947ba5520a53789d33 100644 (file)
@@ -60,6 +60,8 @@ Page {
     padding: Style.standardSpacing
 
     ColumnLayout {
+        id: rootColumn
+
         anchors {
             top: parent.top
             left: parent.left
@@ -100,6 +102,39 @@ Page {
                     syncStatus: root.controller.domainSyncStatusForAccount(root.accountUserIdAtHost)
                 }
 
+                FileProviderFastEnumerationSettings {
+                    id: fastEnumerationSettings
+
+                    Layout.fillWidth: true
+
+                    fastEnumerationSet: root.controller.fastEnumerationSetForAccount(root.accountUserIdAtHost)
+                    fastEnumerationEnabled: root.controller.fastEnumerationEnabledForAccount(root.accountUserIdAtHost)
+                    onFastEnumerationEnabledToggled: root.controller.setFastEnumerationEnabledForAccount(root.accountUserIdAtHost, enabled)
+
+                    padding: 0
+
+                    Connections {
+                        target: root.controller
+
+                        function updateFastEnumerationValues() {
+                            fastEnumerationSettings.fastEnumerationEnabled = root.controller.fastEnumerationEnabledForAccount(root.accountUserIdAtHost);
+                            fastEnumerationSettings.fastEnumerationSet = root.controller.fastEnumerationSetForAccount(root.accountUserIdAtHost);
+                        }
+
+                        function onFastEnumerationEnabledForAccountChanged(accountUserIdAtHost) {
+                            if (root.accountUserIdAtHost === accountUserIdAtHost) {
+                                updateFastEnumerationValues();
+                            }
+                        }
+
+                        function onFastEnumerationSetForAccountChanged(accountUserIdAtHost) {
+                            if (root.accountUserIdAtHost === accountUserIdAtHost) {
+                                updateFastEnumerationValues();
+                            }
+                        }
+                    }
+                }
+
                 FileProviderStorageInfo {
                     id: storageInfo
                     localUsedStorage: root.controller.localStorageUsageGbForAccount(root.accountUserIdAtHost)