From 4f8c3ece31e62e4e4c5e838a57bf4184a2dc891b Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 4 Mar 2024 21:40:01 +0800 Subject: [PATCH] Make save button functional in share view Signed-off-by: Claudio Cambra --- .../FileProviderUIExt/ShareOptionsView.swift | 27 +++++++++++++++++++ .../FileProviderUIExt/ShareViewController.xib | 3 +++ 2 files changed, 30 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift index 3a46cb3fa..02f2b95fa 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift @@ -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 + ) + } + } } diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib index 488fb8562..ff0ea39a5 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.xib @@ -254,6 +254,9 @@ + + +