|
@@ -33,6 +33,8 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
@IBOutlet weak var cancelButton: NSButton!
|
|
|
@IBOutlet weak var confirmButton: NSButton!
|
|
|
|
|
|
+ var confirmButtonVC: KMDesignButton?
|
|
|
+
|
|
|
static var myDocumentURL: URL!
|
|
|
var documentURL: URL {
|
|
|
get {
|
|
@@ -115,6 +117,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
despLabel.stringValue = NSLocalizedString("is protected, please enter the password to unlock it.", comment: "")
|
|
|
self.despLabel.textColor = NSColor.titleColor()
|
|
|
despLabel.font = NSFont.SFProTextRegular(14)
|
|
|
+ despLabel.isSelectable = false
|
|
|
let ps = NSMutableParagraphStyle()
|
|
|
ps.lineSpacing = 5
|
|
|
despLabel.maximumNumberOfLines = 2
|
|
@@ -147,7 +150,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
clearButton.action = #selector(clearButtonAction)
|
|
|
rightView.isHidden = true
|
|
|
|
|
|
- secureTextFiled.becomeFirstResponderHandler = { [self] securetextFiled in
|
|
|
+ secureTextFiled.becomeFirstResponderHandler = { [unowned self] securetextFiled in
|
|
|
let mySecureTextField: KMSecureTextFiled = securetextFiled as! KMSecureTextFiled
|
|
|
mySecureTextField.backgroundView.wantsLayer = true
|
|
|
mySecureTextField.backgroundView.layer?.borderColor = NSColor(hex: "#1770F4").cgColor
|
|
@@ -156,7 +159,7 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
self.passwordErrorLabel.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
- secureTextFiled.valueDidChange = { [self] string in
|
|
|
+ secureTextFiled.valueDidChange = { [unowned self] string in
|
|
|
self.secureTextFiled.backgroundView.layer?.borderColor = NSColor(hex: "#1770F4").cgColor
|
|
|
if self.passwordErrorLabel != nil {
|
|
|
self.passwordErrorLabel.isHidden = true
|
|
@@ -188,18 +191,41 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
if ((button?.isEqual(to: cancelButton))!) {
|
|
|
button?.layer?.borderWidth = 1
|
|
|
button?.layer?.borderColor = NSColor.buttonBorderColor().cgColor
|
|
|
- button?.title = NSLocalizedString("Cancel", comment: "")
|
|
|
- button?.setTitleColor(NSColor.buttonTitleColor())
|
|
|
- button?.font = NSFont.SFProTextRegular(14)
|
|
|
- button?.action = #selector(cancelButtonAction)
|
|
|
+// button?.title = NSLocalizedString("Cancel", comment: "")
|
|
|
+ button?.title = ""
|
|
|
+// button?.setTitleColor(NSColor.buttonTitleColor())
|
|
|
+// button?.font = NSFont.SFProTextRegular(14)
|
|
|
+// button?.action = #selector(cancelButtonAction)
|
|
|
} else {
|
|
|
- button?.title = NSLocalizedString("Open", comment: "")
|
|
|
- button?.attributedTitle = NSMutableAttributedString(string: button!.title, attributes: [.foregroundColor : NSColor.white])
|
|
|
- button?.font = NSFont.SFProTextRegular(14)
|
|
|
- button?.action = #selector(confirmButtonAction)
|
|
|
+// button?.title = NSLocalizedString("Open", comment: "")
|
|
|
+// button?.attributedTitle = NSMutableAttributedString(string: button!.title, attributes: [.foregroundColor : NSColor.white])
|
|
|
+// button?.font = NSFont.SFProTextRegular(14)
|
|
|
+// button?.action = #selector(confirmButtonAction)
|
|
|
+ button?.title = ""
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ let cancelButtonVC = KMDesignButton(withType: .Text)
|
|
|
+ self.cancelButton.addSubview(cancelButtonVC.view)
|
|
|
+ cancelButtonVC.view.frame = self.cancelButton.bounds
|
|
|
+ cancelButtonVC.view.autoresizingMask = [.width, .height]
|
|
|
+ cancelButtonVC.stringValue = NSLocalizedString("Cancel", comment: "")
|
|
|
+ cancelButtonVC.button(type: .Sec_Icon, size: .m)
|
|
|
+ cancelButtonVC.target = self
|
|
|
+ cancelButtonVC.action = #selector(cancelButtonAction)
|
|
|
+ cancelButtonVC.button.keyEquivalent = KMKeyEquivalent.esc.string()
|
|
|
+
|
|
|
+ let confirmButtonVC = KMDesignButton(withType: .Text)
|
|
|
+ self.confirmButton.addSubview(confirmButtonVC.view)
|
|
|
+ confirmButtonVC.view.frame = self.confirmButton.bounds
|
|
|
+ confirmButtonVC.view.autoresizingMask = [.width, .height]
|
|
|
+ confirmButtonVC.stringValue = NSLocalizedString("Open", comment: "")
|
|
|
+ confirmButtonVC.button(type: .Cta, size: .m)
|
|
|
+ confirmButtonVC.target = self
|
|
|
+ confirmButtonVC.action = #selector(confirmButtonAction)
|
|
|
+ self.confirmButtonVC = confirmButtonVC
|
|
|
+ self.confirmButtonVC?.button.keyEquivalent = KMKeyEquivalent.enter
|
|
|
+
|
|
|
dealConfirmButtonEnabledState(enabled: false)
|
|
|
}
|
|
|
}
|
|
@@ -325,14 +351,18 @@ private var passwordInputWindow: KMPasswordInputWindow?
|
|
|
if confirmButton != nil {
|
|
|
KMPasswordInputWindow.canEncrpty = enabled
|
|
|
|
|
|
- confirmButton.wantsLayer = true
|
|
|
- confirmButton.layer?.backgroundColor = NSColor.buttonFunctionBackgroundColor(enabled: enabled).cgColor
|
|
|
- confirmButton?.title = NSLocalizedString("Open", comment: "")
|
|
|
- var color = NSColor.buttonTitleColor(enabled: enabled)
|
|
|
- if (enabled) {
|
|
|
- color = NSColor(hex: "#FFFFFF")
|
|
|
- }
|
|
|
- confirmButton?.attributedTitle = NSMutableAttributedString(string: confirmButton!.title, attributes: [.foregroundColor : color])
|
|
|
+// confirmButton.wantsLayer = true
|
|
|
+// confirmButton.layer?.backgroundColor = NSColor.buttonFunctionBackgroundColor(enabled: enabled).cgColor
|
|
|
+// confirmButton?.title = NSLocalizedString("Open", comment: "")
|
|
|
+// var color = NSColor.buttonTitleColor(enabled: enabled)
|
|
|
+// if (enabled) {
|
|
|
+// color = NSColor(hex: "#FFFFFF")
|
|
|
+// }
|
|
|
+// confirmButton?.attributedTitle = NSMutableAttributedString(string: confirmButton!.title, attributes: [.foregroundColor : color])
|
|
|
+
|
|
|
+ if (self.confirmButtonVC != nil) {
|
|
|
+ self.confirmButtonVC?.enabled = enabled
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|