Adapt visibility of password field upon toggling password checkbox

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-03-07 01:30:57 +08:00
parent d12cdebf48
commit 4be8bace48
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import Combine
import NextcloudKit
import OSLog
// TODO: Handle shareWith!
// TODO: Handle visibility of textfields on relevant checkbox toggle
class ShareOptionsView: NSView {
@IBOutlet private weak var optionsTitleTextField: NSTextField!
@IBOutlet private weak var shareRecipientTextField: NSTextField! // Hide if public link share
@ -133,6 +135,10 @@ class ShareOptionsView: NSView {
deleteButton.isEnabled = enabled
}
@IBAction func passwordCheckboxAction(_ sender: Any) {
passwordSecureField.isHidden = passwordProtectCheckbox.state == .off
}
@IBAction func save(_ sender: Any) {
Task { @MainActor in
let password = passwordProtectCheckbox.state == .on

View File

@ -294,6 +294,9 @@
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="passwordCheckboxAction:" target="EXb-m8-yzj" id="QMn-RM-jdf"/>
</connections>
</button>
<secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pkv-9L-nhv">
<rect key="frame" x="0.0" y="123" width="460" height="22"/>