123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- //
- // IdentifyPreferense.swift
- // PDF Reader Pro
- //
- // Created by Niehaoyu on 2024/6/28.
- //
- import Cocoa
- class IdentifyPreferense: NSViewController {
-
- @IBOutlet var contendView: NSView!
-
- @IBOutlet var loginLabel: NSTextField!
- @IBOutlet var loginValueLabel: NSTextField!
-
- @IBOutlet var nameLabel: NSTextField!
- @IBOutlet var nameField: NSTextField!
-
- @IBOutlet var headNameLabel: NSTextField!
- @IBOutlet var headNameField: NSTextField!
-
- @IBOutlet var organizeNameLabel: NSTextField!
- @IBOutlet var organizeNameField: NSTextField!
-
- @IBOutlet var organizePartLabel: NSTextField!
- @IBOutlet var organizePartField: NSTextField!
-
- @IBOutlet var emailLabel: NSTextField!
- @IBOutlet var emailField: NSTextField!
-
- @IBOutlet var descriptionLabel: NSTextField!
-
-
- override var nibName: NSNib.Name? {
- return "IdentifyPreferense"
- }
-
- override func loadView() {
- super.loadView()
-
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- let loginName = NSFullUserName()
- if loginName.isEmpty == false {
- self.loginValueLabel.stringValue = loginName
- } else {
- self.loginValueLabel.stringValue = ""
- }
-
- self.loginLabel.stringValue = NSLocalizedString("Login Name", comment: "") + ":"
- self.nameLabel.stringValue = NSLocalizedString("Name", comment: "") + ":"
- self.headNameLabel.stringValue = NSLocalizedString("Title", comment: "") + ":"
- self.organizeNameLabel.stringValue = NSLocalizedString("Organization Name", comment: "") + ":"
- self.organizePartLabel.stringValue = NSLocalizedString("Organization Unit", comment: "") + ":"
- self.emailLabel.stringValue = NSLocalizedString("Email Address", comment: "") + ":"
-
- self.descriptionLabel.stringValue = NSLocalizedString("Your identifying information will be used for annotations, comments, and digital signatures. The information will only be used for this program and will not be transmitted outside without your permission.", comment: "")
-
- self.nameField.stringValue = KMProfileInfo.shared().fullName
- self.headNameField.stringValue = KMProfileInfo.shared().headName
- self.organizeNameField.stringValue = KMProfileInfo.shared().OrganizeName
- self.organizePartField.stringValue = KMProfileInfo.shared().OrganizePart
- self.emailField.stringValue = KMProfileInfo.shared().email
-
- // self.nameField.font = NSFont.SFProTextRegularFont(14)
- // self.headNameField.font = NSFont.SFProTextRegularFont(14)
- // self.organizeNameField.font = NSFont.SFProTextRegularFont(14)
- // self.organizePartField.font = NSFont.SFProTextRegularFont(14)
- // self.emailField.font = NSFont.SFProTextRegularFont(14)
- // self.descriptionLabel.font = NSFont.SFProTextRegularFont(14)
-
- self.nameField.textColor = KMAppearance.Layout.h0Color()
- self.headNameField.textColor = KMAppearance.Layout.h0Color()
- self.organizeNameField.textColor = KMAppearance.Layout.h0Color()
- self.organizePartField.textColor = KMAppearance.Layout.h0Color()
- self.emailField.textColor = KMAppearance.Layout.h0Color()
- self.descriptionLabel.textColor = KMAppearance.Layout.h0Color()
-
- self.nameField.delegate = self
- self.headNameField.delegate = self
- self.organizeNameField.delegate = self
- self.organizePartField.delegate = self
- self.emailField.delegate = self
-
- }
-
- override var title: String? {
- set {
- super.title = newValue
- }
- get {
- return KMLocalizedString("Identity", "Preference pane label")
- }
- }
-
-
- }
- extension IdentifyPreferense: KMPreferencePane {
- func defaultsDidRevert() {
-
- self.nameField.stringValue = KMProfileInfo.shared().fullName
- self.headNameField.stringValue = KMProfileInfo.shared().headName
- self.organizeNameField.stringValue = KMProfileInfo.shared().OrganizeName
- self.organizePartField.stringValue = KMProfileInfo.shared().OrganizePart
- self.emailField.stringValue = KMProfileInfo.shared().email
-
- }
- }
- extension IdentifyPreferense: NSTextFieldDelegate {
-
- func controlTextDidEndEditing(_ obj: Notification) {
- if let textView = obj.object as? NSTextField, textView == self.nameField {
- KMProfileInfo.shared().fullName = self.nameField.stringValue
- } else if let textView = obj.object as? NSTextField, textView == self.headNameField {
- KMProfileInfo.shared().headName = self.headNameField.stringValue
- } else if let textView = obj.object as? NSTextField, textView == self.organizeNameField {
- KMProfileInfo.shared().OrganizeName = self.organizeNameField.stringValue
- } else if let textView = obj.object as? NSTextField, textView == self.organizePartField {
- KMProfileInfo.shared().OrganizePart = self.organizePartField.stringValue
- } else if let textView = obj.object as? NSTextField, textView == self.emailField {
- KMProfileInfo.shared().email = self.emailField.stringValue
- }
- }
-
- }
|