Make save button functional in share view
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 4 Mar 2024 13:40:01 +0000 (21:40 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 17 Apr 2024 08:38:55 +0000 (16:38 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift
shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib

index 3a46cb3fa3300c3d3297507b8309ff9b18c8ace0..02f2b95fa77febcf364cbb0bcaddd558d0f3e162 100644 (file)
@@ -85,4 +85,31 @@ class ShareOptionsView: NSView {
         saveButton.isEnabled = enabled
         deleteButton.isEnabled = enabled
     }
+
+    @IBAction func save(_ sender: Any) {
+        Task { @MainActor in
+            let password = passwordProtectCheckbox.state == .on
+                ? passwordSecureField.stringValue
+                : ""
+            let expireDate = expirationDateCheckbox.state == .on
+                ? NKShare.formattedDateString(date: expirationDatePicker.dateValue)
+                : ""
+            let note = noteForRecipientCheckbox.state == .on
+                ? noteTextField.stringValue
+                : ""
+            let label = labelTextField.stringValue
+            let hideDownload = hideDownloadCheckbox.state == .on
+
+            setAllFields(enabled: false)
+            deleteButton.isEnabled = false
+            saveButton.isEnabled = false
+            _ = await controller?.save(
+                password: password,
+                expireDate: expireDate,
+                note: note,
+                label: label,
+                hideDownload: hideDownload
+            )
+        }
+    }
 }
index 488fb85624f6e0d0c2e98fc13b39b74182b82688..ff0ea39a56532aab624a1d51329f297fc82acd3b 100644 (file)
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <connections>
+                                                        <action selector="save:" target="EXb-m8-yzj" id="O4N-dj-SlN"/>
+                                                    </connections>
                                                 </button>
                                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bmf-yY-Y7V">
                                                     <rect key="frame" x="227" y="-7" width="240" height="32"/>