12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // KMSavePanelAccessoryController.swift
- // PDF Reader Pro
- //
- // Created by wanjun on 2023/10/10.
- //
- import Cocoa
- private let KMAutoOpenDocumentKey = "KMAutoOpenDocumentKey"
- @objcMembers
- class KMSavePanelAccessoryController: NSViewController {
- @IBOutlet weak var openAutomaticButton: NSButton!
- var _needOpen: Bool = false
-
- override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) {
- super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
- }
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- }
- override func awakeFromNib() {
- super.awakeFromNib()
-
- openAutomaticButton.title = NSLocalizedString("Open the document after saving", comment: "")
- let autoOpen = KMDataManager.ud_bool(forKey: KMAutoOpenDocumentKey)
- openAutomaticButton.state = autoOpen ? .on : .off
- _needOpen = autoOpen
- }
- @IBAction func buttonClickedOpenAutomatic(_ sender: NSButton) {
- _needOpen = sender.state == NSControl.StateValue.on
-
- KMDataManager.ud_set(_needOpen, forKey: KMAutoOpenDocumentKey)
- }
-
- //MARK: Get、Set
-
- var needOpen: Bool {
- return _needOpen
- }
- }
|