Browse Source

【填写与签名】KMProfileInfo OC转Swift

tangchao 1 year ago
parent
commit
f27c1833d6

+ 24 - 0
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -2240,6 +2240,12 @@
 		BB2F9AAF2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AAE2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift */; };
 		BB2F9AB02AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AAE2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift */; };
 		BB2F9AB12AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AAE2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift */; };
+		BB2F9AB32AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */; };
+		BB2F9AB42AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */; };
+		BB2F9AB52AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */; };
+		BB2F9AB82AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB72AFCC3AD00F9DD93 /* KMProfileInfo.swift */; };
+		BB2F9AB92AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB72AFCC3AD00F9DD93 /* KMProfileInfo.swift */; };
+		BB2F9ABA2AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AB72AFCC3AD00F9DD93 /* KMProfileInfo.swift */; };
 		BB3198122AC5142900107371 /* NSMenu+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3198112AC5142900107371 /* NSMenu+KMExtension.swift */; };
 		BB3198132AC5142900107371 /* NSMenu+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3198112AC5142900107371 /* NSMenu+KMExtension.swift */; };
 		BB3198142AC5142900107371 /* NSMenu+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3198112AC5142900107371 /* NSMenu+KMExtension.swift */; };
@@ -4478,6 +4484,8 @@
 		BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMProfileInfoWindowController.xib; sourceTree = "<group>"; };
 		BB2F9AAA2AFCADA900F9DD93 /* KMProfileCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMProfileCellView.swift; sourceTree = "<group>"; };
 		BB2F9AAE2AFCAE1F00F9DD93 /* KMProfileTitleCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMProfileTitleCellView.swift; sourceTree = "<group>"; };
+		BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMProfileInfoWindowController.swift; sourceTree = "<group>"; };
+		BB2F9AB72AFCC3AD00F9DD93 /* KMProfileInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMProfileInfo.swift; sourceTree = "<group>"; };
 		BB3198112AC5142900107371 /* NSMenu+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMenu+KMExtension.swift"; sourceTree = "<group>"; };
 		BB3198152AC55E6D00107371 /* CPDFDocument+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFDocument+KMExtension.swift"; sourceTree = "<group>"; };
 		BB3198192AC567B500107371 /* CPDFSelection+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFSelection+PDFListView.swift"; sourceTree = "<group>"; };
@@ -7718,6 +7726,7 @@
 		BB2F9A9E2AFC8D1100F9DD93 /* SelfSign */ = {
 			isa = PBXGroup;
 			children = (
+				BB2F9AB62AFCC39800F9DD93 /* Tools */,
 				BB2F9AA92AFCAB1A00F9DD93 /* View */,
 				BB2F9A9F2AFC8D1100F9DD93 /* Window */,
 			);
@@ -7729,6 +7738,7 @@
 			children = (
 				BB2F9AA12AFC8D5900F9DD93 /* KMProfileInfoWindowController.h */,
 				BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */,
+				BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */,
 				BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */,
 			);
 			path = Window;
@@ -7743,6 +7753,14 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		BB2F9AB62AFCC39800F9DD93 /* Tools */ = {
+			isa = PBXGroup;
+			children = (
+				BB2F9AB72AFCC3AD00F9DD93 /* KMProfileInfo.swift */,
+			);
+			path = Tools;
+			sourceTree = "<group>";
+		};
 		BB32BF212A5EA02900D11348 /* Analytics */ = {
 			isa = PBXGroup;
 			children = (
@@ -10911,6 +10929,7 @@
 				9F1FE4AE29406E4700E952CA /* CTPresentationModeController.m in Sources */,
 				BB146FC0299DC0D100784A6A /* GTMSessionFetcherLogging.m in Sources */,
 				AD1CA4212A061D190070541F /* KMAnnotationScreenAuthorViewItem.swift in Sources */,
+				BB2F9AB82AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */,
 				BBC3481C295593F0008D2CD1 /* KMBackgroundListController.swift in Sources */,
 				9F5664872988B16F00020985 /* KMTextfieldVC.swift in Sources */,
 				9F1F82DA292F84D60092C4B4 /* KMHomeInsertActionViewController.swift in Sources */,
@@ -11158,6 +11177,7 @@
 				BBB9B31C299A5D6D004F3235 /* KMCloudOperation.m in Sources */,
 				BB981E592AD4F70D001988CA /* KMWelcomeWindowController.swift in Sources */,
 				BB8B173C2907CDD9001C5EA5 /* NibLoadable.swift in Sources */,
+				BB2F9AB32AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */,
 				ADE3C1AB29A4779E00793B13 /* KMPrintAccessoryController.swift in Sources */,
 				BB8F4557295AA1270037EA22 /* KMHeaderFooterPropertyInfoController.swift in Sources */,
 				BB6347C42AF24F6300F5438E /* KMBatchoperateConvertCollectionViewItem.swift in Sources */,
@@ -11971,6 +11991,7 @@
 				BB897225294B07960045787C /* KMWatermarkAdjectiveTopBarItemView.swift in Sources */,
 				ADDEEA6F2AD3E16100EF675D /* KMSigntureViewItem.swift in Sources */,
 				BB14703F299DC0D200784A6A /* OIDEndSessionResponse.m in Sources */,
+				BB2F9AB42AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */,
 				BBFE6E802930EBD400142C01 /* KMCompressWindowController.swift in Sources */,
 				ADAFDA572AEB451600F084BC /* KMHomeContentView.swift in Sources */,
 				BBFE6E66293097A600142C01 /* KMPageRangePickerWindowController.swift in Sources */,
@@ -12036,6 +12057,7 @@
 				ADE8BC3F29F9458700570F89 /* KMRecommondInfo.m in Sources */,
 				ADDEEA672AD3C4BE00EF675D /* KMPDFSignatureImageView.swift in Sources */,
 				ADDEEA732AD3EFE200EF675D /* KMButton.swift in Sources */,
+				BB2F9AB92AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */,
 				BB146FE5299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				9F1FE4F129406E4700E952CA /* BackgroundGradientView.m in Sources */,
 				89E4E6E42963CD82002DBA6F /* KMGeneralAnnotationViewController.m in Sources */,
@@ -12167,6 +12189,7 @@
 				BBC745F9296178BD0072C2ED /* KMCropTools.swift in Sources */,
 				ADBC2D21299CDA29006280C8 /* NSView+Layer.swift in Sources */,
 				BB65A06D2AF8D8A1003A27A0 /* KMNotesPreferences.swift in Sources */,
+				BB2F9ABA2AFCC3AD00F9DD93 /* KMProfileInfo.swift in Sources */,
 				BB003028298CF7EC002DD1A0 /* KMPreferenceDisplayController.swift in Sources */,
 				9F0CB48929683DC400007028 /* KMPropertiesPanelPresetColorSubVC.swift in Sources */,
 				BB99ACC4292DE22E0048AFD9 /* KMMergeViewController.swift in Sources */,
@@ -12238,6 +12261,7 @@
 				BB147034299DC0D200784A6A /* OIDTokenResponse.m in Sources */,
 				BBB14A592978E75D00936EDB /* KMRedactMutilPageFlagWindowController.swift in Sources */,
 				9FCFEC8E2AD10A4400EAD2CB /* KMTextFieldSheetController.swift in Sources */,
+				BB2F9AB52AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */,
 				BB1BFF942AEA6352003EB179 /* KMImageToPDFMethod.swift in Sources */,
 				899700E128F3A9F2009AF911 /* KMHomeWindowController.swift in Sources */,
 				BB9DCCA12A0A2B0A0024A6F1 /* KMConvertSettingView.swift in Sources */,

+ 354 - 0
PDF Office/PDF Master/Class/PDFTools/SelfSign/Tools/KMProfileInfo.swift

@@ -0,0 +1,354 @@
+//
+//  KMProfileInfo.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/11/9.
+//
+
+import Cocoa
+
+private var _shared: KMProfileInfo?
+
+@objcMembers class KMProfileInfo: NSObject, NSCoding {
+    private static let KMProfileUnarchiveKey = "KMProfileUnarchiveKeyTemp1"
+    
+    private let KMProfileSaveInfoFullNameKey = "KMProfileSaveInfoFullNameKey"
+    private let KMProfileSaveInfoFirstNameKey = "KMProfileSaveInfoFirstNameKey"
+    private let KMProfileSaveInfoMiddleNameKey = "KMProfileSaveInfoMiddleNameKey"
+    private let KMProfileSaveInfoLastNameKey = "KMProfileSaveInfoLastNameKey"
+
+    private let KMProfileSaveInfoStreet1Key = "KMProfileSaveInfoStreet1Key"
+    private let KMProfileSaveInfoStreet2Key = "KMProfileSaveInfoStreet2Key"
+    private let KMProfileSaveInfoCityKey = "KMProfileSaveInfoCityKey"
+    private let KMProfileSaveInfoStateKey = "KMProfileSaveInfoStateKey"
+    private let KMProfileSaveInfoZipKey = "KMProfileSaveInfoZipKey"
+    private let KMProfileSaveInfoCountryKey = "KMProfileSaveInfoCountryKey"
+
+    private let KMProfileSaveInfoEmailKey = "KMProfileSaveInfoEmailKey"
+    private let KMProfileSaveInfoTelKey = "KMProfileSaveInfoTelKey"
+    private let KMProfileSaveInfoBirthDateKey = "KMProfileSaveInfoBirthDateKey"
+    private let KMProfileSaveInfoCustomInfoKey = "KMProfileSaveInfoCustomInfoKey"
+    
+    private var _fullName: String = ""
+    var fullName: String {
+        get {
+            return self._fullName
+        }
+        set {
+            if (self._fullName != newValue) {
+                self._fullName = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _firstName: String = ""
+    var firstName: String {
+        get {
+            return self._firstName
+        }
+        set {
+            if (self._firstName != newValue) {
+                self._firstName = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _middleName: String = ""
+    var middleName: String {
+        get {
+            return self._middleName
+        }
+        set {
+            if (self._middleName != newValue) {
+                self._middleName = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+
+    private var _lastName: String = ""
+    var lastName: String {
+        get {
+            return self._lastName
+        }
+        set {
+            if (self._lastName != newValue) {
+                self._lastName = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _street1: String = ""
+    var street1: String {
+        get {
+            return self._street1
+        }
+        set {
+            if (self._street1 != newValue) {
+                self._street1 = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _street2: String = ""
+    var street2: String {
+        get {
+            return self._street2
+        }
+        set {
+            if (self._street2 != newValue) {
+                self._street2 = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _city: String = ""
+    var city: String {
+        get {
+            return self._city
+        }
+        set {
+            if (self._city != newValue) {
+                self._city = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _state: String = ""
+    var state: String {
+        get {
+            return self._state
+        }
+        set {
+            if (self._state != newValue) {
+                self._state = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _zip: String = ""
+    var zip: String {
+        get {
+            return self._zip
+        }
+        set {
+            if (self._zip != newValue) {
+                self._zip = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _country: String = ""
+    var country: String {
+        get {
+            return self._country
+        }
+        set {
+            if (self._country != newValue) {
+                self._country = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _email: String = ""
+    var email: String {
+        get {
+            return self._email
+        }
+        set {
+            if (self._email != newValue) {
+                self._email = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+
+    private var _tel: String = ""
+    var tel: String {
+        get {
+            return self._tel
+        }
+        set {
+            if (self._tel != newValue) {
+                self._tel = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _birthDate: String = ""
+    var birthDate: String {
+        get {
+            return self._birthDate
+        }
+        set {
+            if (self._birthDate != newValue) {
+                self._birthDate = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    private var _customInfoArray: [Any] = []
+    var customInfoArray: [Any] {
+        get {
+            return self._customInfoArray
+        }
+        set {
+            if NSMutableArray(array: self.customInfoArray).isEqual(newValue) == false {
+                self._customInfoArray = newValue
+                
+                self._saveInfo()
+            }
+        }
+    }
+    
+    @objc (sharedInstance)
+    static func shared() -> KMProfileInfo {
+        if let instanch = _shared {
+            return instanch
+        }
+        
+        let defaults = UserDefaults.standard
+        if let encodedObject = defaults.object(forKey: KMProfileUnarchiveKey) as? Data {
+            NSKeyedUnarchiver.setClass(Self.self, forClassName: "KMProfileInfo")
+            let instance = NSKeyedUnarchiver.unarchiveObject(with: encodedObject)
+            _shared = (instance as! KMProfileInfo)
+        } else {
+            let instance = KMProfileInfo()
+            instance._setBaseInfo()
+            instance._saveInfo()
+            _shared = instance
+        }
+        
+        return _shared!
+    }
+    
+    override init() {
+        super.init()
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init()
+        
+        self._fullName = coder.decodeObject(forKey: KMProfileSaveInfoFullNameKey) as? String ?? ""
+        self._firstName = coder.decodeObject(forKey: KMProfileSaveInfoFirstNameKey) as? String ?? ""
+        self._middleName = coder.decodeObject(forKey: KMProfileSaveInfoMiddleNameKey) as? String ?? ""
+        self._lastName = coder.decodeObject(forKey: KMProfileSaveInfoLastNameKey) as? String ?? ""
+        
+        self._street1 = coder.decodeObject(forKey: KMProfileSaveInfoStreet1Key) as? String ?? ""
+        self._street2 = coder.decodeObject(forKey: KMProfileSaveInfoStreet2Key) as? String ?? ""
+        self._city = coder.decodeObject(forKey: KMProfileSaveInfoCityKey) as? String ?? ""
+        self._state = coder.decodeObject(forKey: KMProfileSaveInfoStateKey) as? String ?? ""
+        self._zip = coder.decodeObject(forKey: KMProfileSaveInfoZipKey) as? String ?? ""
+        self._country = coder.decodeObject(forKey: KMProfileSaveInfoCountryKey) as? String ?? ""
+        
+        self._email = coder.decodeObject(forKey: KMProfileSaveInfoEmailKey) as? String ?? ""
+        
+        self._tel = coder.decodeObject(forKey: KMProfileSaveInfoTelKey) as? String ?? ""
+        
+        self._birthDate = coder.decodeObject(forKey: KMProfileSaveInfoBirthDateKey) as? String ?? ""
+        
+        self._customInfoArray = coder.decodeObject(forKey: KMProfileSaveInfoCustomInfoKey) as? [String] ?? []
+    }
+    
+    func encode(with coder: NSCoder) {
+        coder.encode(self.fullName, forKey: KMProfileSaveInfoFullNameKey)
+        coder.encode(self.firstName, forKey: KMProfileSaveInfoFirstNameKey)
+        coder.encode(self.middleName, forKey: KMProfileSaveInfoMiddleNameKey)
+        coder.encode(self.lastName, forKey: KMProfileSaveInfoLastNameKey)
+        
+        coder.encode(self.street1, forKey: KMProfileSaveInfoStreet1Key)
+        coder.encode(self.street2, forKey: KMProfileSaveInfoStreet2Key)
+        coder.encode(self.city, forKey: KMProfileSaveInfoCityKey)
+        coder.encode(self.state, forKey: KMProfileSaveInfoStateKey)
+        coder.encode(self.zip, forKey: KMProfileSaveInfoZipKey)
+        coder.encode(self.country, forKey: KMProfileSaveInfoCountryKey)
+        
+        coder.encode(self.email, forKey: KMProfileSaveInfoEmailKey)
+        coder.encode(self.tel, forKey: KMProfileSaveInfoTelKey)
+        
+        coder.encode(self.birthDate, forKey: KMProfileSaveInfoBirthDateKey)
+        coder.encode(self.customInfoArray, forKey: KMProfileSaveInfoCustomInfoKey)
+    }
+    
+    func replaceObjectInCustomInfoArray(at index: Int, with object: Any) {
+        self._customInfoArray[index] = object 
+        self._saveInfo()
+    }
+    
+    
+    func insertObject(_ object: Any, inCustomInfoArrayAt index: Int) {
+        self._customInfoArray.insert(object, at: index)
+        self._saveInfo()
+    }
+    
+    func removeObjectFromCustomInfoArray(at index: Int) {
+        self.customInfoArray.remove(at: index)
+        self._saveInfo()
+    }
+    /*
+
+     - (void):(NSUInteger)index {
+
+     }
+
+     #pragma mark - NSCoding
+     
+     - (NSString *)description {
+         return [NSString stringWithFormat:@"fullName:%@,firstName:%@,middleName:%@,lastName:%@,street1:%@,street2:%@,city:%@,zip:%@,country:%@,email:%@,tel:%@,birthdate:%@,customInfo:%@",self.fullName,self.firstName,self.middleName,self.lastName,self.street1,self.street2,self.city,self.zip,self.country,self.email,self.tel,self.birthDate,self.customInfoArray];
+     }
+     */
+}
+
+// MARK: - Private Methods
+
+extension KMProfileInfo {
+    private func _saveInfo() {
+        let encodedObject = NSKeyedArchiver.archivedData(withRootObject: self)
+        let defaults = UserDefaults.standard
+        defaults.set(encodedObject, forKey: KMProfileInfo.KMProfileUnarchiveKey)
+        defaults.synchronize()
+    }
+    
+    private func _setBaseInfo() {
+        self._fullName = ""
+        self._firstName = ""
+        self._middleName = ""
+        self._lastName = ""
+        
+        self._street1 = ""
+        self._street2 = ""
+        self._city = ""
+        self._state = ""
+        self._zip = ""
+        self._country = ""
+        
+        self._email = ""
+        self._tel = ""
+        
+        self._customInfoArray = []
+    }
+}

+ 279 - 279
PDF Office/PDF Master/Class/PDFTools/SelfSign/Window/KMProfileInfoWindowController.m

@@ -11,308 +11,308 @@
 //#import "NSButton+TitleColor.h"
 #import <PDF_Master-Swift.h>
 
-static NSString *KMProfileUnarchiveKey = @"KMProfileUnarchiveKeyTemp1";
-
-static NSString *KMProfileSaveInfoFullNameKey = @"KMProfileSaveInfoFullNameKey";
-static NSString *KMProfileSaveInfoFirstNameKey = @"KMProfileSaveInfoFirstNameKey";
-static NSString *KMProfileSaveInfoMiddleNameKey = @"KMProfileSaveInfoMiddleNameKey";
-static NSString *KMProfileSaveInfoLastNameKey = @"KMProfileSaveInfoLastNameKey";
-
-static NSString *KMProfileSaveInfoStreet1Key = @"KMProfileSaveInfoStreet1Key";
-static NSString *KMProfileSaveInfoStreet2Key = @"KMProfileSaveInfoStreet2Key";
-static NSString *KMProfileSaveInfoCityKey = @"KMProfileSaveInfoCityKey";
-static NSString *KMProfileSaveInfoStateKey = @"KMProfileSaveInfoStateKey";
-static NSString *KMProfileSaveInfoZipKey = @"KMProfileSaveInfoZipKey";
-static NSString *KMProfileSaveInfoCountryKey = @"KMProfileSaveInfoCountryKey";
-
-static NSString *KMProfileSaveInfoEmailKey = @"KMProfileSaveInfoEmailKey";
-static NSString *KMProfileSaveInfoTelKey = @"KMProfileSaveInfoTelKey";
-static NSString *KMProfileSaveInfoBirthDateKey = @"KMProfileSaveInfoBirthDateKey";
-static NSString *KMProfileSaveInfoCustomInfoKey = @"KMProfileSaveInfoCustomInfoKey";
-
-@interface KMProfileInfo : NSObject <NSCoding>
-
-@property (nonatomic, retain) NSString *fullName;
-@property (nonatomic, retain) NSString *firstName;
-@property (nonatomic, retain) NSString *middleName;
-@property (nonatomic, retain) NSString *lastName;
-
-@property (nonatomic, retain) NSString *street1;
-@property (nonatomic, retain) NSString *street2;
-@property (nonatomic, retain) NSString *city;
-@property (nonatomic, retain) NSString *state;
-@property (nonatomic, retain) NSString *zip;
-@property (nonatomic, retain) NSString *country;
-
-@property (nonatomic, retain) NSString *email;
-@property (nonatomic, retain) NSString *tel;
-
-@property (nonatomic, retain) NSString *birthDate;
-
-@property (nonatomic, retain) NSMutableArray *customInfoArray;
-
-@end
-
-@implementation KMProfileInfo
-
-#pragma mark - Getter & setter
-
-- (void)setFullName:(NSString *)fullName {
+//static NSString *KMProfileUnarchiveKey = @"KMProfileUnarchiveKeyTemp1";
+//
+//static NSString *KMProfileSaveInfoFullNameKey = @"KMProfileSaveInfoFullNameKey";
+//static NSString *KMProfileSaveInfoFirstNameKey = @"KMProfileSaveInfoFirstNameKey";
+//static NSString *KMProfileSaveInfoMiddleNameKey = @"KMProfileSaveInfoMiddleNameKey";
+//static NSString *KMProfileSaveInfoLastNameKey = @"KMProfileSaveInfoLastNameKey";
+//
+//static NSString *KMProfileSaveInfoStreet1Key = @"KMProfileSaveInfoStreet1Key";
+//static NSString *KMProfileSaveInfoStreet2Key = @"KMProfileSaveInfoStreet2Key";
+//static NSString *KMProfileSaveInfoCityKey = @"KMProfileSaveInfoCityKey";
+//static NSString *KMProfileSaveInfoStateKey = @"KMProfileSaveInfoStateKey";
+//static NSString *KMProfileSaveInfoZipKey = @"KMProfileSaveInfoZipKey";
+//static NSString *KMProfileSaveInfoCountryKey = @"KMProfileSaveInfoCountryKey";
+//
+//static NSString *KMProfileSaveInfoEmailKey = @"KMProfileSaveInfoEmailKey";
+//static NSString *KMProfileSaveInfoTelKey = @"KMProfileSaveInfoTelKey";
+//static NSString *KMProfileSaveInfoBirthDateKey = @"KMProfileSaveInfoBirthDateKey";
+//static NSString *KMProfileSaveInfoCustomInfoKey = @"KMProfileSaveInfoCustomInfoKey";
+//
+//@interface KMProfileInfo : NSObject <NSCoding>
+//
+//@property (nonatomic, retain) NSString *fullName;
+//@property (nonatomic, retain) NSString *firstName;
+//@property (nonatomic, retain) NSString *middleName;
+//@property (nonatomic, retain) NSString *lastName;
+//
+//@property (nonatomic, retain) NSString *street1;
+//@property (nonatomic, retain) NSString *street2;
+//@property (nonatomic, retain) NSString *city;
+//@property (nonatomic, retain) NSString *state;
+//@property (nonatomic, retain) NSString *zip;
+//@property (nonatomic, retain) NSString *country;
+//
+//@property (nonatomic, retain) NSString *email;
+//@property (nonatomic, retain) NSString *tel;
+//
+//@property (nonatomic, retain) NSString *birthDate;
+//
+//@property (nonatomic, retain) NSMutableArray *customInfoArray;
+//
+//@end
+//
+//@implementation KMProfileInfo
+//
+//#pragma mark - Getter & setter
+//
+//- (void)setFullName:(NSString *)fullName {
 //    if (![fullName isEqualToString:_fullName]) {
-//        [_fullName release];
-//        _fullName = [fullName retain];
-        
-    _fullName = fullName;
-        [self saveInfo];
+////        [_fullName release];
+////        _fullName = [fullName retain];
+//
+//        _fullName = fullName;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setFirstName:(NSString *)firstName {
+//}
+//
+//- (void)setFirstName:(NSString *)firstName {
 //    if (![_firstName isEqualToString:firstName]) {
-//        [_firstName release];
-//        _firstName = [firstName retain];
-        
-    _firstName = firstName;
-        [self saveInfo];
+////        [_firstName release];
+////        _firstName = [firstName retain];
+//
+//        _firstName = firstName;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setMiddleName:(NSString *)middleName {
+//}
+//
+//- (void)setMiddleName:(NSString *)middleName {
 //    if (![_middleName isEqualToString:middleName]) {
-//        [_middleName release];
-//        _middleName = [middleName retain];
-        
-    _middleName = middleName;
-        [self saveInfo];
+////        [_middleName release];
+////        _middleName = [middleName retain];
+//
+//        _middleName = middleName;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setLastName:(NSString *)lastName {
+//}
+//
+//- (void)setLastName:(NSString *)lastName {
 //    if (![_lastName isEqualToString:lastName]) {
-//        [_lastName release];
-//        _lastName = [lastName retain];
-    _lastName = lastName;
-        [self saveInfo];
+////        [_lastName release];
+////        _lastName = [lastName retain];
+//        _lastName = lastName;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setStreet1:(NSString *)street1 {
+//}
+//
+//- (void)setStreet1:(NSString *)street1 {
 //    if (![_street1 isEqualToString:street1]) {
-//        [_street1 release];
-//        _street1 = [street1 retain];
-        
-    _street1 = street1;
-        [self saveInfo];
+////        [_street1 release];
+////        _street1 = [street1 retain];
+//
+//        _street1 = street1;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setStreet2:(NSString *)street2 {
+//}
+//
+//- (void)setStreet2:(NSString *)street2 {
 //    if (![_street2 isEqualToString:street2]) {
-//        [_street2 release];
-//        _street2 = [street2 retain];
-        
-    _street2 = street2;
-        [self saveInfo];
+////        [_street2 release];
+////        _street2 = [street2 retain];
+//
+//        _street2 = street2;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setCity:(NSString *)city {
+//}
+//
+//- (void)setCity:(NSString *)city {
 //    if (![_city isEqualToString:city]) {
-//        [_city release];
-//        _city = [city retain];
-        
-    _city = city;
-        [self saveInfo];
+////        [_city release];
+////        _city = [city retain];
+//
+//        _city = city;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setState:(NSString *)state {
+//}
+//
+//- (void)setState:(NSString *)state {
 //    if (![_state isEqualToString:state]) {
-//        [_state release];
-//        _state = [state retain];
-        
-    _state = state;
-        [self saveInfo];
+////        [_state release];
+////        _state = [state retain];
+//
+//        _state = state;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setZip:(NSString *)zip {
+//}
+//
+//- (void)setZip:(NSString *)zip {
 //    if (![_zip isEqualToString:zip]) {
-//        [_zip release];
-//        _zip = [zip retain];
-        
-    _zip = zip;
-        [self saveInfo];
+////        [_zip release];
+////        _zip = [zip retain];
+//
+//        _zip = zip;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setCountry:(NSString *)country {
+//}
+//
+//- (void)setCountry:(NSString *)country {
 //    if (![_country isEqualToString:country]) {
-//        [_country release];
-//        _country = [country retain];
-        
-    _country = country;
-        [self saveInfo];
+////        [_country release];
+////        _country = [country retain];
+//
+//        _country = country;
+//        [self saveInfo];
 //    }
-}
-
-
-- (void)setEmail:(NSString *)email {
+//}
+//
+//
+//- (void)setEmail:(NSString *)email {
 //    if (![_email isEqualToString:email]) {
-//        [_email release];
-//        _email = [email retain];
-        
-    _email = email;
-        [self saveInfo];
+////        [_email release];
+////        _email = [email retain];
+//
+//        _email = email;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setTel:(NSString *)tel {
+//}
+//
+//- (void)setTel:(NSString *)tel {
 //    if (![_tel isEqualToString:tel]) {
-//        [_tel release];
-//        _tel = [tel retain];
-    _tel = tel;
-        [self saveInfo];
+////        [_tel release];
+////        _tel = [tel retain];
+//        _tel = tel;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setBirthDate:(NSString *)birthDate {
+//}
+//
+//- (void)setBirthDate:(NSString *)birthDate {
 //    if (![_birthDate isEqualToString:birthDate]) {
-//        [_birthDate release];
-//        _birthDate = [birthDate retain];
-        
-    _birthDate = birthDate;
-        [self saveInfo];
+////        [_birthDate release];
+////        _birthDate = [birthDate retain];
+//
+//        _birthDate = birthDate;
+//        [self saveInfo];
 //    }
-}
-
-- (void)setCustomInfoArray:(NSMutableArray *)customInfoArray {
+//}
+//
+//- (void)setCustomInfoArray:(NSMutableArray *)customInfoArray {
 //    if (![customInfoArray isEqual:customInfoArray]) {
-//        [customInfoArray release];
-//        _customInfoArray  = [customInfoArray retain];
-        
-    _customInfoArray = customInfoArray;
-        [self saveInfo];
+////        [customInfoArray release];
+////        _customInfoArray  = [customInfoArray retain];
+//
+//        _customInfoArray = customInfoArray;
+//        [self saveInfo];
 //    }
-}
-
-#pragma mark -  Init Methods
-
-+ (instancetype)sharedInstance {
-    static dispatch_once_t onceToken;
-    static KMProfileInfo *manager = nil;
-    dispatch_once(&onceToken, ^{
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        NSData *encodedObject = [defaults objectForKey:KMProfileUnarchiveKey];
-        if (!encodedObject) {
-            manager = [[KMProfileInfo alloc] init];
-            [manager setBaseInfo];
-            [manager saveInfo];
-        } else {
-            manager = [NSKeyedUnarchiver unarchiveObjectWithData:encodedObject];
-        }
-        
-    });
-    return manager;
-}
-
-#pragma mark - Private Methods
-
-- (void)saveInfo {
-    NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:self];
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:encodedObject forKey:KMProfileUnarchiveKey];
-    [defaults synchronize];
-}
-
-- (void)setBaseInfo {
-    _fullName = @"";
-    _firstName = @"";
-    _middleName = @"";
-    _lastName = @"";
-    
-    _street1 = @"";
-    _street2 = @"";
-    _city = @"";
-    _state = @"";
-    _zip = @"";
-    _country = @"";
-    
-    _email = @"";
-    _tel = @"";
-    
-    _birthDate = @"";
-    _customInfoArray = [NSMutableArray array];
-}
-
-
-- (void)replaceObjectInCustomInfoArrayAtIndex:(NSInteger)index withObject:(id)object {
-    [self.customInfoArray replaceObjectAtIndex:index withObject:object];
-    [self saveInfo];
-}
-
-- (void)removeObjectFromCustomInfoArrayAtIndex:(NSUInteger)index {
-    [self.customInfoArray removeObjectAtIndex:index];
-    [self saveInfo];
-}
-
-- (void)insertObject:(id)object inCustomInfoArrayAtIndex:(NSInteger)index {
-    [self.customInfoArray insertObject:object atIndex:index];
-    [self saveInfo];
-}
-
-#pragma mark - NSCoding
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
-    [aCoder encodeObject:self.fullName forKey:KMProfileSaveInfoFullNameKey];
-    [aCoder encodeObject:self.firstName forKey:KMProfileSaveInfoFirstNameKey];
-    [aCoder encodeObject:self.middleName forKey:KMProfileSaveInfoMiddleNameKey];
-    [aCoder encodeObject:self.lastName forKey:KMProfileSaveInfoLastNameKey];
-    
-    [aCoder encodeObject:self.street1 forKey:KMProfileSaveInfoStreet1Key];
-    [aCoder encodeObject:self.street2 forKey:KMProfileSaveInfoStreet2Key];
-    [aCoder encodeObject:self.city forKey:KMProfileSaveInfoCityKey];
-    [aCoder encodeObject:self.state forKey:KMProfileSaveInfoStateKey];
-    [aCoder encodeObject:self.zip forKey:KMProfileSaveInfoZipKey];
-    [aCoder encodeObject:self.country forKey:KMProfileSaveInfoCountryKey];
-    
-    [aCoder encodeObject:self.email forKey:KMProfileSaveInfoEmailKey];
-    [aCoder encodeObject:self.tel forKey:KMProfileSaveInfoTelKey];
-    
-    [aCoder encodeObject:self.birthDate forKey:KMProfileSaveInfoBirthDateKey];
-    [aCoder encodeObject:self.customInfoArray forKey:KMProfileSaveInfoCustomInfoKey];
-}
-
-- (instancetype)initWithCoder:(NSCoder *)aDecoder {
-    if (self = [super init]) {
-        _fullName = [aDecoder decodeObjectForKey:KMProfileSaveInfoFullNameKey] ?:@"";
-        _firstName = [aDecoder decodeObjectForKey:KMProfileSaveInfoFirstNameKey] ?:@"";
-        _middleName = [aDecoder decodeObjectForKey:KMProfileSaveInfoMiddleNameKey] ?:@"";
-        _lastName = [aDecoder decodeObjectForKey:KMProfileSaveInfoLastNameKey] ?:@"";
-        
-        _street1 = [aDecoder decodeObjectForKey:KMProfileSaveInfoStreet1Key] ?:@"";
-        _street2 = [aDecoder decodeObjectForKey:KMProfileSaveInfoStreet2Key] ?:@"";
-        _city = [aDecoder decodeObjectForKey:KMProfileSaveInfoCityKey] ?:@"";
-        _state = [aDecoder decodeObjectForKey:KMProfileSaveInfoStateKey] ?:@"";
-        _zip = [aDecoder decodeObjectForKey:KMProfileSaveInfoZipKey] ?:@"";
-        _country = [aDecoder decodeObjectForKey:KMProfileSaveInfoCountryKey] ?:@"";
-        
-        _email = [aDecoder decodeObjectForKey:KMProfileSaveInfoEmailKey] ?:@"";
-        
-        _tel = [aDecoder decodeObjectForKey:KMProfileSaveInfoTelKey] ?:@"";
-        
-        _birthDate = [aDecoder decodeObjectForKey:KMProfileSaveInfoBirthDateKey] ?:@"";
-        _customInfoArray = [aDecoder decodeObjectForKey:KMProfileSaveInfoCustomInfoKey]?: [NSMutableArray array];
-    }
-    return self;
-}
-
-- (NSString *)description {
-    return [NSString stringWithFormat:@"fullName:%@,firstName:%@,middleName:%@,lastName:%@,street1:%@,street2:%@,city:%@,zip:%@,country:%@,email:%@,tel:%@,birthdate:%@,customInfo:%@",self.fullName,self.firstName,self.middleName,self.lastName,self.street1,self.street2,self.city,self.zip,self.country,self.email,self.tel,self.birthDate,self.customInfoArray];
-}
-
-
-@end
+//}
+//
+//#pragma mark -  Init Methods
+//
+//+ (instancetype)sharedInstance {
+//    static dispatch_once_t onceToken;
+//    static KMProfileInfo *manager = nil;
+//    dispatch_once(&onceToken, ^{
+//        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+//        NSData *encodedObject = [defaults objectForKey:KMProfileUnarchiveKey];
+//        if (!encodedObject) {
+//            manager = [[KMProfileInfo alloc] init];
+//            [manager setBaseInfo];
+//            [manager saveInfo];
+//        } else {
+//            manager = [NSKeyedUnarchiver unarchiveObjectWithData:encodedObject];
+//        }
+//
+//    });
+//    return manager;
+//}
+//
+//#pragma mark - Private Methods
+//
+//- (void)saveInfo {
+//    NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:self];
+//    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+//    [defaults setObject:encodedObject forKey:KMProfileUnarchiveKey];
+//    [defaults synchronize];
+//}
+//
+//- (void)setBaseInfo {
+//    _fullName = @"";
+//    _firstName = @"";
+//    _middleName = @"";
+//    _lastName = @"";
+//
+//    _street1 = @"";
+//    _street2 = @"";
+//    _city = @"";
+//    _state = @"";
+//    _zip = @"";
+//    _country = @"";
+//
+//    _email = @"";
+//    _tel = @"";
+//
+//    _birthDate = @"";
+//    _customInfoArray = [NSMutableArray array];
+//}
+//
+//
+//- (void)replaceObjectInCustomInfoArrayAtIndex:(NSInteger)index withObject:(id)object {
+//    [self.customInfoArray replaceObjectAtIndex:index withObject:object];
+//    [self saveInfo];
+//}
+//
+//- (void)removeObjectFromCustomInfoArrayAtIndex:(NSUInteger)index {
+//    [self.customInfoArray removeObjectAtIndex:index];
+//    [self saveInfo];
+//}
+//
+//- (void)insertObject:(id)object inCustomInfoArrayAtIndex:(NSInteger)index {
+//    [self.customInfoArray insertObject:object atIndex:index];
+//    [self saveInfo];
+//}
+//
+//#pragma mark - NSCoding
+//
+//- (void)encodeWithCoder:(NSCoder *)aCoder {
+//    [aCoder encodeObject:self.fullName forKey:KMProfileSaveInfoFullNameKey];
+//    [aCoder encodeObject:self.firstName forKey:KMProfileSaveInfoFirstNameKey];
+//    [aCoder encodeObject:self.middleName forKey:KMProfileSaveInfoMiddleNameKey];
+//    [aCoder encodeObject:self.lastName forKey:KMProfileSaveInfoLastNameKey];
+//
+//    [aCoder encodeObject:self.street1 forKey:KMProfileSaveInfoStreet1Key];
+//    [aCoder encodeObject:self.street2 forKey:KMProfileSaveInfoStreet2Key];
+//    [aCoder encodeObject:self.city forKey:KMProfileSaveInfoCityKey];
+//    [aCoder encodeObject:self.state forKey:KMProfileSaveInfoStateKey];
+//    [aCoder encodeObject:self.zip forKey:KMProfileSaveInfoZipKey];
+//    [aCoder encodeObject:self.country forKey:KMProfileSaveInfoCountryKey];
+//
+//    [aCoder encodeObject:self.email forKey:KMProfileSaveInfoEmailKey];
+//    [aCoder encodeObject:self.tel forKey:KMProfileSaveInfoTelKey];
+//
+//    [aCoder encodeObject:self.birthDate forKey:KMProfileSaveInfoBirthDateKey];
+//    [aCoder encodeObject:self.customInfoArray forKey:KMProfileSaveInfoCustomInfoKey];
+//}
+//
+//- (instancetype)initWithCoder:(NSCoder *)aDecoder {
+//    if (self = [super init]) {
+//        _fullName = [aDecoder decodeObjectForKey:KMProfileSaveInfoFullNameKey] ?:@"";
+//        _firstName = [aDecoder decodeObjectForKey:KMProfileSaveInfoFirstNameKey] ?:@"";
+//        _middleName = [aDecoder decodeObjectForKey:KMProfileSaveInfoMiddleNameKey] ?:@"";
+//        _lastName = [aDecoder decodeObjectForKey:KMProfileSaveInfoLastNameKey] ?:@"";
+//
+//        _street1 = [aDecoder decodeObjectForKey:KMProfileSaveInfoStreet1Key] ?:@"";
+//        _street2 = [aDecoder decodeObjectForKey:KMProfileSaveInfoStreet2Key] ?:@"";
+//        _city = [aDecoder decodeObjectForKey:KMProfileSaveInfoCityKey] ?:@"";
+//        _state = [aDecoder decodeObjectForKey:KMProfileSaveInfoStateKey] ?:@"";
+//        _zip = [aDecoder decodeObjectForKey:KMProfileSaveInfoZipKey] ?:@"";
+//        _country = [aDecoder decodeObjectForKey:KMProfileSaveInfoCountryKey] ?:@"";
+//
+//        _email = [aDecoder decodeObjectForKey:KMProfileSaveInfoEmailKey] ?:@"";
+//
+//        _tel = [aDecoder decodeObjectForKey:KMProfileSaveInfoTelKey] ?:@"";
+//
+//        _birthDate = [aDecoder decodeObjectForKey:KMProfileSaveInfoBirthDateKey] ?:@"";
+//        _customInfoArray = [aDecoder decodeObjectForKey:KMProfileSaveInfoCustomInfoKey]?: [NSMutableArray array];
+//    }
+//    return self;
+//}
+//
+//- (NSString *)description {
+//    return [NSString stringWithFormat:@"fullName:%@,firstName:%@,middleName:%@,lastName:%@,street1:%@,street2:%@,city:%@,zip:%@,country:%@,email:%@,tel:%@,birthdate:%@,customInfo:%@",self.fullName,self.firstName,self.middleName,self.lastName,self.street1,self.street2,self.city,self.zip,self.country,self.email,self.tel,self.birthDate,self.customInfoArray];
+//}
+//
+//
+//@end
 
 static NSString  *TitleCellIdentifier = @"TitleCell";
 static NSString  *NormalCellIdentifier = @"Normal";
@@ -618,10 +618,10 @@ static NSString  *NormalCellIdentifier = @"Normal";
             NSString *originalValue = dict.allValues.firstObject;
             if ([textField isEqual:cellView.textField]) {
                 NSDictionary *newDict = @{textField.stringValue : originalValue};
-                [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAtIndex:customIndex withObject:newDict];
+                [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAt:customIndex with:newDict];
             } else if ([textField isEqual:cellView.detailtextField]){
                 NSDictionary *newDict = @{originalKey:textField.stringValue};
-                [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAtIndex:customIndex withObject:newDict];
+                [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAt:customIndex with:newDict];
             }
         }
     }
@@ -749,7 +749,7 @@ static NSString  *NormalCellIdentifier = @"Normal";
 
 - (IBAction)buttonClicked_addNewInfo:(id)sender {
     NSDictionary *dict = @{@"":@""};
-    [[KMProfileInfo sharedInstance] insertObject:dict inCustomInfoArrayAtIndex:[KMProfileInfo sharedInstance].customInfoArray.count];
+    [[KMProfileInfo sharedInstance] insertObject:dict inCustomInfoArrayAt:[KMProfileInfo sharedInstance].customInfoArray.count];
     [self fetchDisplayKeys];
     [self.tableView reloadData];
     if (self.tableView.numberOfRows > 1) {
@@ -767,7 +767,7 @@ static NSString  *NormalCellIdentifier = @"Normal";
     NSInteger  editIndex = self.tableView.selectedRow;
     NSUInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
     if (editIndex - customIndex - 1 < [KMProfileInfo sharedInstance].customInfoArray.count) {
-        [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAtIndex:editIndex - customIndex - 1];
+        [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAt:editIndex - customIndex - 1];
         [self fetchDisplayKeys];
         [self.tableView reloadData];
         self.removeNewInfoButton.enabled = NO;
@@ -863,7 +863,7 @@ static NSString  *NormalCellIdentifier = @"Normal";
                 break;
         }
     } else {
-        [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAtIndex:editIndex - customIndex - 1];
+        [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAt:editIndex - customIndex - 1];
     }
     
     [self fetchDisplayKeys];

+ 633 - 0
PDF Office/PDF Master/Class/PDFTools/SelfSign/Window/KMProfileInfoWindowController.swift

@@ -0,0 +1,633 @@
+//
+//  KMProfileInfoWindowController.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/11/9.
+//
+
+import Cocoa
+
+//class KMProfileInfoWindowController: NSWindowController {
+//    
+//    /*
+//     typedef void(^profileInfoAddtoDocCallBack)(NSString *string);
+//
+//     @interface KMProfileInfoWindowController : NSWindowController
+//
+//     @property (nonatomic, copy) profileInfoAddtoDocCallBack callBack;//回调
+//
+//     @end
+//     */
+//    
+//    /*
+//     static NSString  *TitleCellIdentifier = @"TitleCell";
+//     static NSString  *NormalCellIdentifier = @"Normal";
+//
+//     @interface KMProfileInfoWindowController () <NSTableViewDelegate, NSTableViewDataSource, NSTextFieldDelegate>
+//
+//     @property (assign) IBOutlet NSTextField *titleLabel;
+//     @property (assign) IBOutlet NSTableView *tableView;
+//     @property (nonatomic, retain) NSMutableArray *tableContents;
+//     @property (assign) IBOutlet NSButton *backButton;
+//     @property (assign) IBOutlet NSButton *addButton;
+//     @property (assign) IBOutlet NSButton *addNewInfoButton;
+//     @property (assign) IBOutlet NSButton *removeNewInfoButton;
+//
+//     @end
+//     */
+//
+//    override func windowDidLoad() {
+//        super.windowDidLoad()
+//    
+//        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+//    }
+//    
+//    /*
+//     - (void)dealloc {
+//         
+//     //    [_tableContents release];
+//         [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
+//         
+//     //    [super dealloc];
+//     }
+//
+//     #pragma mark - Life Cycle
+//     - (void)windowDidLoad {
+//         [super windowDidLoad];
+//         
+//         [self configuViews];
+//         [self fetchDisplayKeys];
+//         [self.tableView reloadData];
+//         [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
+//     }
+//
+//     #pragma mark - Private Methods
+//
+//     - (void)configuViews {
+//         
+//         self.titleLabel.stringValue = NSLocalizedString(@"My Profile", nil);
+//
+//         //Button Part
+//         self.backButton.title = NSLocalizedString(@"Cancel", nil);
+//         self.addButton.title = NSLocalizedString(@"Add to Doc", nil);
+//         self.addButton.enabled = NO;
+//         self.removeNewInfoButton.enabled = NO;
+//         //NSMenu Part
+//         NSMenuItem *editItem = [self.tableView.menu itemAtIndex:0];
+//         NSMenuItem *addItem = [self.tableView.menu itemAtIndex:1];
+//         NSMenuItem *deleteItem = [self.tableView.menu itemAtIndex:2];
+//         
+//         editItem.title = NSLocalizedString(@"Edit", nil);
+//         addItem.title = NSLocalizedString(@"Add to Doc", nil);
+//         deleteItem.title = NSLocalizedString(@"Delete", nil);
+//     }
+//
+//     - (void)fetchDisplayKeys {
+//         _tableContents = [NSMutableArray array];
+//         [_tableContents addObject:NSLocalizedString(@"Name", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Full Name", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"First Name", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Middle Name", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Last Name", nil)];
+//         
+//         [_tableContents addObject:NSLocalizedString(@"Address", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Street 1", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Street 2", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"City", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"State ", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Zip", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Country", nil)];
+//         
+//         [_tableContents addObject:NSLocalizedString(@"Contact Information", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Email", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Tel", nil)];
+//         
+//         [_tableContents addObject:NSLocalizedString(@"Dates", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Date", nil)];
+//         [_tableContents addObject:NSLocalizedString(@"Birth Date", nil)];
+//         if ([KMProfileInfo sharedInstance].customInfoArray.count > 0) {
+//             [_tableContents addObject:NSLocalizedString(@"Custom", nil)];
+//             for (NSUInteger i = 0 ; i < [KMProfileInfo sharedInstance].customInfoArray.count; i ++) {
+//                 NSDictionary *dict = [[KMProfileInfo sharedInstance].customInfoArray objectAtIndex:i];
+//                 [_tableContents addObject:dict.allKeys.firstObject];
+//             }
+//         }
+//     }
+//
+//     - (void)configuTextField:(KMProfileCellView *)cellView {
+//         NSTextField * textField = cellView.detailtextField;
+//         NSInteger tag = textField.tag;
+//         NSString *placeHoldString = @"";
+//         NSString *nameString = @"";
+//
+//         if (tag == 1) {
+//             placeHoldString = NSLocalizedString(@"Add Full Name", nil);
+//             nameString = [KMProfileInfo sharedInstance].fullName;
+//         } else if (tag == 2) {
+//             placeHoldString = NSLocalizedString(@"Add First Name", nil);
+//             nameString = [KMProfileInfo sharedInstance].firstName;
+//         } else if (tag == 3) {
+//             placeHoldString = NSLocalizedString(@"Add Middle Name", nil);
+//             nameString = [KMProfileInfo sharedInstance].middleName;
+//         } else if (tag == 4) {
+//             placeHoldString = NSLocalizedString(@"Add Last Name", nil);
+//             nameString = [KMProfileInfo sharedInstance].lastName;
+//         } else if (tag == 6) {
+//             placeHoldString = NSLocalizedString(@"Add Street 1", nil);
+//             nameString = [KMProfileInfo sharedInstance].street1;
+//         } else if (tag == 7) {
+//             placeHoldString = NSLocalizedString(@"Add Street 2", nil);
+//             nameString = [KMProfileInfo sharedInstance].street2;
+//         } else if (tag == 8) {
+//
+//             placeHoldString = NSLocalizedString(@"Add City", nil);
+//             nameString = [KMProfileInfo sharedInstance].city;
+//         } else if (tag == 9) {
+//             placeHoldString = NSLocalizedString(@"Add State", nil);
+//             nameString = [KMProfileInfo sharedInstance].state;
+//         } else if (tag == 10) {
+//             placeHoldString = NSLocalizedString(@"Add Zip", nil);
+//             nameString = [KMProfileInfo sharedInstance].zip;
+//         } else if (tag == 11) {
+//             placeHoldString = NSLocalizedString(@"Add Country", nil);
+//             nameString = [KMProfileInfo sharedInstance].country;
+//         } else if (tag == 13) {
+//             placeHoldString = NSLocalizedString(@"Add Email", nil);
+//             nameString = [KMProfileInfo sharedInstance].email;
+//         } else if (tag == 14) {
+//             placeHoldString = NSLocalizedString(@"Add Tel", nil);
+//             nameString = [KMProfileInfo sharedInstance].tel;
+//         } else if (tag == 16) {
+//             placeHoldString = NSLocalizedString(@"Add Date", nil);
+//             NSDate *date = [NSDate date];
+//             NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+//             [formatter setDateFormat:@"YYYY/MM/dd"];
+//             nameString = [formatter stringFromDate:date];
+//         } else if (tag == 17) {
+//             placeHoldString = NSLocalizedString(@"Add Birth Date", nil);
+//             nameString = [KMProfileInfo sharedInstance].birthDate;
+//         }
+//         textField.stringValue = nameString;
+//         if (nameString.length > 0) {
+//             textField.hidden = NO;
+//             cellView.addButton.hidden = YES;
+//         } else {
+//             cellView.addButton.title = placeHoldString;
+//             textField.placeholderString = placeHoldString;
+//             textField.hidden = YES;
+//             cellView.addButton.tag = tag;
+//             cellView.addButton.target = self;
+//             [cellView.addButton setAction:@selector(addFileName_Add:)];
+//             [cellView.addButton setTitleColor:[NSColor systemBlueColor]];
+//             cellView.addButton.hidden = NO;
+//
+//         }
+//     }
+//
+//     #pragma mark - NSTableViewDelegate / NSTableViewDataSources
+//
+//     - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+//         return self.tableContents.count;
+//     }
+//
+//     - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
+//         NSString *addingString = [self.tableContents objectAtIndex:row];
+//         NSInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         if (([addingString isEqualToString:NSLocalizedString(@"Name", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Address", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Contact Information", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Dates", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Custom", nil)])
+//             && row <= customIndex) {
+//             return 24.0;
+//         } else {
+//             return 36.0;
+//         }
+//     }
+//
+//     - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
+//         NSString *addingString = [self.tableContents objectAtIndex:row];
+//         NSInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         NSTableCellView *tableCellView = nil;
+//         if (([addingString isEqualToString:NSLocalizedString(@"Name", nil)] ||
+//             [addingString isEqualToString:NSLocalizedString(@"Address", nil)] ||
+//             [addingString isEqualToString:NSLocalizedString(@"Contact Information", nil)] ||
+//             [addingString isEqualToString:NSLocalizedString(@"Dates", nil)] ||
+//             [addingString isEqualToString:NSLocalizedString(@"Custom", nil)])
+//             && row <= customIndex) {
+//             tableCellView = [tableView makeViewWithIdentifier:TitleCellIdentifier owner:tableColumn];
+//             KMProfileTitleCellView *cellView = (KMProfileTitleCellView *)tableCellView;
+//             cellView.textField.stringValue = addingString;
+//             cellView.textField.editable = NO;
+//             cellView.wantsLayer = YES;
+//             if ([KMAppearance isSupportNewColor]) {
+//                 if ([KMAppearance isDarkMode]) {
+//                     cellView.layer.backgroundColor = [NSColor colorWithRed:73/255.0 green:75/255.0 blue:77/255.0 alpha:1.0].CGColor;
+//                 } else {
+//                     cellView.layer.backgroundColor = [NSColor colorWithRed:219/255.0 green:219/255.0 blue:219/255.0 alpha:1.0].CGColor;
+//                 }
+//             } else {
+//                 cellView.layer.backgroundColor = [NSColor colorWithRed:235.0/255.0 green:235.0/255.0 blue:235.0/255.0 alpha:1.0].CGColor;
+//             }
+//             
+//         } else {
+//             tableCellView = [tableView makeViewWithIdentifier:NormalCellIdentifier owner:tableColumn];
+//             KMProfileCellView *cellView = (KMProfileCellView *)tableCellView;
+//             cellView.textField.stringValue = addingString;
+//             if([cellView isKindOfClass:[KMProfileCellView class]]){
+//                 cellView.detailtextField.hidden = NO;
+//             }
+//             cellView.textField.textColor = [KMAppearance KMColor_Layout_H0];
+//             if (customIndex > row) {
+//                 cellView.detailtextField.tag = row;
+//                 [self configuTextField:cellView];
+//                 cellView.textField.editable = NO;
+//                 cellView.textField.selectable = NO;
+//                 if ([addingString isEqualToString:NSLocalizedString(@"Date", nil)]) {
+//                     cellView.detailtextField.editable = NO;
+//                     cellView.detailtextField.selectable = NO;
+//                 }
+//
+//                 cellView.detailtextField.delegate = self;
+//             } else {
+//                 NSInteger index = row - customIndex - 1;
+//                 NSDictionary *dict = [[KMProfileInfo sharedInstance].customInfoArray objectAtIndex:index];
+//                 cellView.addButton.hidden = YES;
+//                 cellView.detailtextField.stringValue = dict.allValues.firstObject;
+//                 cellView.detailtextField.placeholderString = NSLocalizedString(@"Type Value Here", nil);
+//                 cellView.textField.placeholderString = NSLocalizedString(@"Type Label Here", nil);
+//                 cellView.textField.editable = YES;
+//                 cellView.textField.selectable = YES;
+//                 cellView.detailtextField.editable = YES;
+//                 cellView.detailtextField.selectable = YES;
+//                 cellView.textField.delegate = self;
+//                 cellView.detailtextField.delegate = self;
+//
+//             }
+//         }
+//         return tableCellView;
+//     }
+//
+//     - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row {
+//         NSString *addingString = [self.tableContents objectAtIndex:row];
+//         NSInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         if (([addingString isEqualToString:NSLocalizedString(@"Name", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Address", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Contact Information", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Dates", nil)] ||
+//              [addingString isEqualToString:NSLocalizedString(@"Custom", nil)])
+//             && row <= customIndex) {
+//             return NO;
+//         }
+//         return YES;
+//     }
+//
+//
+//
+//     #pragma mark - NSTextFieldDelegate
+//
+//     - (void)controlTextDidChange:(NSNotification *)obj {
+//         
+//         NSInteger currentRow = self.tableView.selectedRow;
+//         if (currentRow == -1) {
+//             return;
+//         }
+//         NSTextField *textField = (NSTextField *)obj.object;
+//         KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:currentRow makeIfNecessary:NO];
+//         if (currentRow == 1) {
+//             [KMProfileInfo sharedInstance].fullName = textField.stringValue;
+//         } else if (currentRow == 2) {
+//             [KMProfileInfo sharedInstance].firstName = textField.stringValue;
+//         } else if (currentRow == 3) {
+//             [KMProfileInfo sharedInstance].middleName = textField.stringValue;
+//         } else if (currentRow == 4) {
+//             [KMProfileInfo sharedInstance].lastName = textField.stringValue;
+//         } else if (currentRow == 6) {
+//             [KMProfileInfo sharedInstance].street1 = textField.stringValue;
+//         } else if (currentRow == 7) {
+//             [KMProfileInfo sharedInstance].street2 = textField.stringValue;
+//         } else if (currentRow == 8) {
+//             [KMProfileInfo sharedInstance].city = textField.stringValue;
+//         } else if (currentRow == 9) {
+//             [KMProfileInfo sharedInstance].state = textField.stringValue;
+//         } else if (currentRow == 10) {
+//             [KMProfileInfo sharedInstance].zip = textField.stringValue;
+//         } else if (currentRow == 11) {
+//             [KMProfileInfo sharedInstance].country = textField.stringValue;
+//         } else if (currentRow == 13) {
+//             [KMProfileInfo sharedInstance].email = textField.stringValue;
+//         } else if (currentRow == 14) {
+//             [KMProfileInfo sharedInstance].tel = textField.stringValue;
+//         } else if (currentRow == 16) {
+//     //        [KMProfileInfo sharedInstance].date = textField.stringValue;
+//         } else if (currentRow == 17) {
+//             [KMProfileInfo sharedInstance].birthDate = textField.stringValue;
+//         } else if (currentRow >= 19 ) {
+//             NSInteger customIndex = currentRow - 19;
+//             if (cellView) {
+//                 NSDictionary *dict = [[KMProfileInfo sharedInstance].customInfoArray objectAtIndex:customIndex];
+//                 NSString *originalKey = dict.allKeys.firstObject;
+//                 NSString *originalValue = dict.allValues.firstObject;
+//                 if ([textField isEqual:cellView.textField]) {
+//                     NSDictionary *newDict = @{textField.stringValue : originalValue};
+//                     [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAtIndex:customIndex withObject:newDict];
+//                 } else if ([textField isEqual:cellView.detailtextField]){
+//                     NSDictionary *newDict = @{originalKey:textField.stringValue};
+//                     [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAtIndex:customIndex withObject:newDict];
+//                 }
+//             }
+//         }
+//         
+//         if (cellView.detailtextField.stringValue.length > 0 ) {
+//             self.addButton.enabled = YES;
+//         } else {
+//             self.addButton.enabled = NO;
+//         }
+//     }
+//
+//     - (void)controlTextDidBeginEditing:(NSNotification *)obj {
+//         NSTextField *textField = obj.object;
+//         BOOL isDarkMode = NO;
+//         if (@available(macOS 10.14, *)) {
+//             if ([[NSApplication sharedApplication].effectiveAppearance isEqual: [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]]) {
+//                 isDarkMode =YES;
+//             }
+//         }
+//
+//         textField.textColor = [NSColor labelColor];
+//     }
+//
+//     - (void)controlTextDidEndEditing:(NSNotification *)obj;
+//     {
+//         NSTextField *textField = obj.object;
+//         NSInteger tag = textField.tag;
+//         KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:textField.tag makeIfNecessary:NO];
+//
+//         if ([cellView isKindOfClass:[KMProfileCellView class]] && tag > 0) {
+//             NSString *placeHoldString = @"";
+//
+//             if (tag == 1) {
+//                 placeHoldString = NSLocalizedString(@"Add Full Name", nil);
+//             } else if (tag == 2) {
+//                 placeHoldString = NSLocalizedString(@"Add First Name", nil);
+//             } else if (tag == 3) {
+//                 placeHoldString = NSLocalizedString(@"Add Middle Name", nil);
+//             } else if (tag == 4) {
+//                 placeHoldString = NSLocalizedString(@"Add Last Name", nil);
+//             } else if (tag == 6) {
+//                 placeHoldString = NSLocalizedString(@"Add Street 1", nil);
+//             } else if (tag == 7) {
+//                 placeHoldString = NSLocalizedString(@"Add Street 2", nil);
+//             } else if (tag == 8) {
+//                 placeHoldString = NSLocalizedString(@"Add City", nil);
+//             } else if (tag == 9) {
+//                 placeHoldString = NSLocalizedString(@"Add State", nil);
+//             } else if (tag == 10) {
+//                 placeHoldString = NSLocalizedString(@"Add Zip", nil);
+//             } else if (tag == 11) {
+//                 placeHoldString = NSLocalizedString(@"Add Country", nil);
+//             } else if (tag == 13) {
+//                 placeHoldString = NSLocalizedString(@"Add Email", nil);
+//             } else if (tag == 14) {
+//                 placeHoldString = NSLocalizedString(@"Add Tel", nil);
+//             } else if (tag == 16) {
+//                 placeHoldString = NSLocalizedString(@"Add Date", nil);
+//             } else if (tag == 17) {
+//                 placeHoldString = NSLocalizedString(@"Add Birth Date", nil);
+//             }
+//
+//             if (textField.stringValue.length > 0) {
+//                 textField.textColor = [NSColor secondaryLabelColor];
+//                 textField.hidden = NO;
+//                 cellView.addButton.hidden = YES;
+//             } else {
+//     //            textField.hidden = YES; //自定义新增,输入Label后,value为空时推出编辑,就无法填写了
+//                 textField.placeholderString = @"";
+//                 cellView.addButton.hidden = NO;
+//                 cellView.addButton.tag = tag;
+//                 cellView.addButton.target = self;
+//                 [cellView.addButton setAction:@selector(addFileName_Add:)];
+//                 cellView.addButton.title = placeHoldString;
+//                 [cellView.addButton setTitleColor:[NSColor systemBlueColor]];
+//             }
+//         }
+//         
+//     }
+//
+//     - (void)tableViewSelectionDidChange:(NSNotification *)notification {
+//         if (self.tableView.selectedRow == NSNotFound || self.tableView.selectedRow == -1) {
+//             return;
+//         }
+//         KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.selectedRow makeIfNecessary:NO];
+//         self.addButton.enabled = cellView.detailtextField.stringValue.length > 0;
+//
+//         for (NSInteger i = 0; i < self.tableView.numberOfRows; i++) {
+//             NSTableCellView *cellView =  [self.tableView viewAtColumn:0 row:i makeIfNecessary:NO];
+//             if ([cellView isKindOfClass:[KMProfileCellView class]]) {
+//                 KMProfileCellView *cellView1 = (KMProfileCellView *)cellView;
+//                 if (i == self.tableView.selectedRow) {
+//                     cellView1.detailtextField.textColor = [NSColor whiteColor];
+//                     [cellView1.addButton setTitleColor:[NSColor whiteColor]];
+//                 } else {
+//                     cellView1.detailtextField.textColor = [NSColor secondaryLabelColor];
+//                     [cellView1.addButton setTitleColor:[NSColor systemBlueColor]];
+//                 }
+//             }
+//         }
+//         NSInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         if (self.tableView.selectedRow > customIndex) {
+//             self.removeNewInfoButton.enabled = YES;
+//         } else {
+//             self.removeNewInfoButton.enabled = NO;
+//         }
+//     }
+//
+//     #pragma  mark - Button Action
+//
+//     - (IBAction)buttonClicked_back:(id)sender {
+//     //    [self dismissSheet:sender];
+//     }
+//
+//     - (IBAction)buttonClicked_add:(id)sender {
+//         NSInteger selectRow =self.tableView.selectedRow;
+//         if (selectRow >= 0) {
+//             if (self.callBack) {
+//                 KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.selectedRow makeIfNecessary:NO];
+//                 self.callBack(cellView.detailtextField.stringValue);
+//     //            [self dismissSheet:sender];
+//             }
+//         }
+//     }
+//
+//     - (IBAction)buttonClicked_addNewInfo:(id)sender {
+//         NSDictionary *dict = @{@"":@""};
+//         [[KMProfileInfo sharedInstance] insertObject:dict inCustomInfoArrayAtIndex:[KMProfileInfo sharedInstance].customInfoArray.count];
+//         [self fetchDisplayKeys];
+//         [self.tableView reloadData];
+//         if (self.tableView.numberOfRows > 1) {
+//             [self.tableView scrollRowToVisible:self.tableView.numberOfRows - 1];
+//             NSIndexSet *set = [NSIndexSet indexSetWithIndex:self.tableView.numberOfRows - 1];
+//             [self.tableView selectRowIndexes:set byExtendingSelection:NO];
+//             KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.selectedRow makeIfNecessary:NO];
+//             cellView.addButton.hidden = YES;
+//             [cellView.textField becomeFirstResponder];
+//         };
+//     }
+//
+//     - (IBAction)buttonClicked_RemoveNewInfo:(id)sender
+//     {
+//         NSInteger  editIndex = self.tableView.selectedRow;
+//         NSUInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         if (editIndex - customIndex - 1 < [KMProfileInfo sharedInstance].customInfoArray.count) {
+//             [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAtIndex:editIndex - customIndex - 1];
+//             [self fetchDisplayKeys];
+//             [self.tableView reloadData];
+//             self.removeNewInfoButton.enabled = NO;
+//         }
+//     }
+//
+//     - (IBAction)addFileName_Add:(NSButton *)sender
+//     {
+//         [self.window makeFirstResponder:nil];
+//         NSInteger tag = sender.tag;
+//         KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:tag makeIfNecessary:NO];
+//         if ([cellView isKindOfClass:[KMProfileCellView class]]) {
+//             cellView.addButton.hidden = YES;
+//             cellView.detailtextField.hidden = NO;
+//             [cellView.detailtextField becomeFirstResponder];
+//         }
+//     }
+//
+//     #pragma mark - NSMenu Action
+//
+//     - (IBAction)menuItemClicked_Edit:(id)sender {
+//         KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.clickedRow makeIfNecessary:NO];
+//         NSIndexSet *set = [NSIndexSet indexSetWithIndex:self.tableView.clickedRow];
+//         [self.tableView selectRowIndexes:set byExtendingSelection:NO];
+//         if (cellView.textField.editable) {
+//             if (cellView.textField.stringValue.length == 0) {
+//                 [cellView.textField becomeFirstResponder];
+//             }else {
+//                 [cellView.detailtextField becomeFirstResponder];
+//             }
+//         } else {
+//             [cellView.detailtextField becomeFirstResponder];
+//         }
+//     }
+//
+//     - (IBAction)menuItemClicked_Add:(id)sender {
+//          KMProfileCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.clickedRow makeIfNecessary:NO];
+//         if (self.callBack) {
+//             self.callBack(cellView.detailtextField.stringValue);
+//     //        [self dismissSheet:sender];
+//         }
+//     }
+//
+//     - (IBAction)menuItemClicked_Delete:(id)sender {
+//         NSInteger  editIndex = self.tableView.clickedRow;
+//         NSInteger customIndex = [self.tableContents indexOfObject:NSLocalizedString(@"Custom", nil)];
+//         if (editIndex < customIndex ) {
+//             switch (editIndex) {
+//                 case 1:
+//                     [KMProfileInfo sharedInstance].fullName = @"";
+//                     break;
+//                 case 2:
+//                     [KMProfileInfo sharedInstance].firstName = @"";
+//                     break;
+//                 case 3:
+//                     [KMProfileInfo sharedInstance].middleName = @"";
+//                     break;
+//                 case 4:
+//                     [KMProfileInfo sharedInstance].lastName = @"";
+//                     break;
+//                     
+//                 case 6:
+//                     [KMProfileInfo sharedInstance].street1 = @"";
+//                     break;
+//                 case 7:
+//                     [KMProfileInfo sharedInstance].street2 = @"";
+//                     break;
+//                 case 8:
+//                     [KMProfileInfo sharedInstance].city = @"";
+//                     break;
+//                 case 9:
+//                     [KMProfileInfo sharedInstance].state = @"";
+//                     break;
+//                 case 10:
+//                     [KMProfileInfo sharedInstance].zip = @"";
+//                     break;
+//                 case 11:
+//                     [KMProfileInfo sharedInstance].country = @"";
+//                     break;
+//                 case 13:
+//                     [KMProfileInfo sharedInstance].email = @"";
+//                     break;
+//                 case 14:
+//                     [KMProfileInfo sharedInstance].tel = @"";
+//                     break;
+//                 case 16:
+//     //                [KMProfileInfo sharedInstance].date = @"";
+//                     break;
+//                 case 17:
+//                     [KMProfileInfo sharedInstance].birthDate = @"";
+//                     break;
+//                 default:
+//                     break;
+//             }
+//         } else {
+//             [[KMProfileInfo sharedInstance] removeObjectFromCustomInfoArrayAtIndex:editIndex - customIndex - 1];
+//         }
+//         
+//         [self fetchDisplayKeys];
+//         [self.tableView reloadData];
+//     }
+//
+//     - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+//         
+//         NSTableCellView *cellView = [self.tableView viewAtColumn:0 row:self.tableView.clickedRow makeIfNecessary:NO];
+//         if (menuItem.action == @selector(menuItemClicked_Edit:)) {
+//             if ([cellView isKindOfClass:[KMProfileTitleCellView class]]) {
+//                 return NO;
+//             } else {
+//                 KMProfileCellView *cellView1 = (KMProfileCellView *)cellView;
+//                 if ([cellView1.textField.stringValue isEqualToString:NSLocalizedString(@"Date", nil)]) {
+//                     return NO;
+//                 }
+//                 return YES;
+//             }
+//         } else if (menuItem.action == @selector(menuItemClicked_Add:)) {
+//             if ([cellView isKindOfClass:[KMProfileTitleCellView class]]) {
+//                 return NO;
+//             } else {
+//                 KMProfileCellView *cell = (KMProfileCellView *)cellView;
+//                 return cell.detailtextField.stringValue.length > 0;
+//             }
+//         } else if (menuItem.action == @selector(menuItemClicked_Delete:)) {
+//             if ([cellView isKindOfClass:[KMProfileTitleCellView class]]) {
+//                 return NO;
+//             } else {
+//                 KMProfileCellView *cellView1 = (KMProfileCellView *)cellView;
+//                 if ([cellView1.textField.stringValue isEqualToString:NSLocalizedString(@"Date", nil)]) {
+//                     return NO;
+//                 }
+//                 return YES;
+//             }
+//         }
+//         return NO;
+//     }
+//
+//     - (void)themeChanged:(NSNotification *)notification {
+//         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//             [self updateViewColor];
+//         });
+//     }
+//
+//     - (void)updateViewColor {
+//         [self.tableView reloadData];
+//     }
+//
+//     @end
+//
+//     */
+//
+//}

+ 5 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2954,6 +2954,11 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 } else if toolbarItem.itemIdentifier == KMToolbarToolProfileIdentifier {
                     Swift.debugPrint("KMToolbarToolProfileIdentifier ...")
                     let windowC = KMProfileInfoWindowController(windowNibName: "KMProfileInfoWindowController")
+//                    windowC.callback = { string in
+//                        if (string.length > 0) {
+//                            [blockSelf.pdfView addTextFieldWithSubType:KMSelfSignAnnotationFreeTextSubType_Profile string:string];
+//                        }
+//                    }
                     self.km_beginSheet(windowC: windowC)
                 } else if toolbarItem.itemIdentifier == KMToolbarViewSettingIdentifier {
                     Swift.debugPrint("KMToolbarViewSettingIdentifier ...")