Browse Source

【填写与签名】KMProfileInfoWindowController OC转Swift

tangchao 1 year ago
parent
commit
dcaf431436

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

@@ -2261,9 +2261,6 @@
 		BB2F615B2966B69D001CB369 /* KMWatermarkPropertyHomeController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F61572966B69D001CB369 /* KMWatermarkPropertyHomeController.xib */; };
 		BB2F615C2966B69D001CB369 /* KMWatermarkPropertyHomeController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F61572966B69D001CB369 /* KMWatermarkPropertyHomeController.xib */; };
 		BB2F615D2966B69D001CB369 /* KMWatermarkPropertyHomeController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F61572966B69D001CB369 /* KMWatermarkPropertyHomeController.xib */; };
-		BB2F9AA32AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */; };
-		BB2F9AA42AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */; };
-		BB2F9AA52AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */; };
 		BB2F9AA62AFC8D5A00F9DD93 /* KMProfileInfoWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */; };
 		BB2F9AA72AFC8D5A00F9DD93 /* KMProfileInfoWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */; };
 		BB2F9AA82AFC8D5A00F9DD93 /* KMProfileInfoWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */; };
@@ -4523,8 +4520,6 @@
 		BB2F614F2966A91D001CB369 /* KMBackgroundPropertyHomeController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMBackgroundPropertyHomeController.xib; sourceTree = "<group>"; };
 		BB2F61562966B69D001CB369 /* KMWatermarkPropertyHomeController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMWatermarkPropertyHomeController.swift; sourceTree = "<group>"; };
 		BB2F61572966B69D001CB369 /* KMWatermarkPropertyHomeController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMWatermarkPropertyHomeController.xib; sourceTree = "<group>"; };
-		BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMProfileInfoWindowController.m; sourceTree = "<group>"; };
-		BB2F9AA12AFC8D5900F9DD93 /* KMProfileInfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMProfileInfoWindowController.h; sourceTree = "<group>"; };
 		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>"; };
@@ -7820,8 +7815,6 @@
 		BB2F9A9F2AFC8D1100F9DD93 /* Window */ = {
 			isa = PBXGroup;
 			children = (
-				BB2F9AA12AFC8D5900F9DD93 /* KMProfileInfoWindowController.h */,
-				BB2F9AA02AFC8D5900F9DD93 /* KMProfileInfoWindowController.m */,
 				BB2F9AB22AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift */,
 				BB2F9AA22AFC8D5900F9DD93 /* KMProfileInfoWindowController.xib */,
 			);
@@ -11023,7 +11016,6 @@
 				AD68782129A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
 				AD8F06172999DB5900D93CBC /* KMPrintDrawPage.swift in Sources */,
 				BB14702F299DC0D100784A6A /* OIDTokenUtilities.m in Sources */,
-				BB2F9AA32AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */,
 				89752E042939DB42003FF08E /* KMToolbarViewController.swift in Sources */,
 				BB146FD5299DC0D100784A6A /* GTLRObject.m in Sources */,
 				8942F7F02926087200389627 /* KMSearchViewController.swift in Sources */,
@@ -12054,7 +12046,6 @@
 				ADD1B6B829420B2300C3FFF7 /* KMPrintChooseView.swift in Sources */,
 				9FCFEC9D2AD152FA00EAD2CB /* CustomAlertView.swift in Sources */,
 				BB147000299DC0D100784A6A /* OIDRedirectHTTPHandler.m in Sources */,
-				BB2F9AA42AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */,
 				BB147003299DC0D100784A6A /* OIDScopeUtilities.m in Sources */,
 				AD867FA729DFB77500F00440 /* KMAnnotationOutlineView.swift in Sources */,
 				BBB9B32C299A5D6D004F3235 /* GTMOAuth2KeychainCompatibility.m in Sources */,
@@ -12471,7 +12462,6 @@
 				9FCFEC762AC56ECE00EAD2CB /* CPDFListStampAnnotation.swift in Sources */,
 				BBA388152AEF9A42004FE93F /* NSWindow+KMExtension.swift in Sources */,
 				9FD0D2A92AD4EFB000DA3FF8 /* KMSavePanelAccessoryController.swift in Sources */,
-				BB2F9AA52AFC8D5A00F9DD93 /* KMProfileInfoWindowController.m in Sources */,
 				9F1FE4D129406E4700E952CA /* CTTabController.m in Sources */,
 				9F8539E029470A0700DF644E /* KMTabStripView.swift in Sources */,
 				BBA8B7AC2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */,

+ 0 - 32
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -452,37 +452,5 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "4D93AA09-0E5B-4BA4-8FA1-A4C5CD46424B"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "317"
-            endingLineNumber = "317"
-            landmarkName = "defaultsDidRevert()"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "C2E1DBEB-7852-4C5E-B4FB-F109704A80B7"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Preference/Window/KMPreferenceController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "460"
-            endingLineNumber = "460"
-            landmarkName = "_resetCurrentSheetDidEnd(_:_:_:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 2 - 2
PDF Office/PDF Master/Class/Common/Category/NSUserDefaultsController+KMExtension.swift

@@ -28,8 +28,8 @@ extension NSUserDefaultsController {
         self.removeObserver(anObserver, forKeyPath: "values.\(key)")
     }
     
-    @objc func revertToInitialValues(forKeys keys: [String]) {
-        for key in keys {
+    @objc func revertToInitialValues(forKeys keys: [String]?) {
+        for key in keys ?? [] {
             (self.values as? NSMutableDictionary)?.setValue(self.initialValues?[key], forKey: key)
         }
     }

+ 0 - 21
PDF Office/PDF Master/Class/PDFTools/SelfSign/Window/KMProfileInfoWindowController.h

@@ -1,21 +0,0 @@
-//
-//  KMProfileInfoWindowController.h
-//  PDF Reader Pro Edition
-//
-//  Created by 蒋志鹏 on 2019-07-19.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@class SKMainWindowController;
-
-NS_ASSUME_NONNULL_BEGIN
-typedef void(^profileInfoAddtoDocCallBack)(NSString *string);
-
-@interface KMProfileInfoWindowController : NSWindowController
-
-@property (nonatomic, copy) profileInfoAddtoDocCallBack callBack;//回调
-
-@end
-
-NS_ASSUME_NONNULL_END

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

@@ -1,917 +0,0 @@
-//
-//  KMProfileInfoWindowController.m
-//  PDF Reader Pro Edition
-//
-//  Created by 蒋志鹏 on 2019-07-19.
-//
-
-#import "KMProfileInfoWindowController.h"
-//#import "NSWindowController_SKExtensions.h"
-//#import "KMProfileCellView.h"
-//#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 {
-//    if (![fullName isEqualToString:_fullName]) {
-////        [_fullName release];
-////        _fullName = [fullName retain];
-//
-//        _fullName = fullName;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setFirstName:(NSString *)firstName {
-//    if (![_firstName isEqualToString:firstName]) {
-////        [_firstName release];
-////        _firstName = [firstName retain];
-//
-//        _firstName = firstName;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setMiddleName:(NSString *)middleName {
-//    if (![_middleName isEqualToString:middleName]) {
-////        [_middleName release];
-////        _middleName = [middleName retain];
-//
-//        _middleName = middleName;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setLastName:(NSString *)lastName {
-//    if (![_lastName isEqualToString:lastName]) {
-////        [_lastName release];
-////        _lastName = [lastName retain];
-//        _lastName = lastName;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setStreet1:(NSString *)street1 {
-//    if (![_street1 isEqualToString:street1]) {
-////        [_street1 release];
-////        _street1 = [street1 retain];
-//
-//        _street1 = street1;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setStreet2:(NSString *)street2 {
-//    if (![_street2 isEqualToString:street2]) {
-////        [_street2 release];
-////        _street2 = [street2 retain];
-//
-//        _street2 = street2;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setCity:(NSString *)city {
-//    if (![_city isEqualToString:city]) {
-////        [_city release];
-////        _city = [city retain];
-//
-//        _city = city;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setState:(NSString *)state {
-//    if (![_state isEqualToString:state]) {
-////        [_state release];
-////        _state = [state retain];
-//
-//        _state = state;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setZip:(NSString *)zip {
-//    if (![_zip isEqualToString:zip]) {
-////        [_zip release];
-////        _zip = [zip retain];
-//
-//        _zip = zip;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setCountry:(NSString *)country {
-//    if (![_country isEqualToString:country]) {
-////        [_country release];
-////        _country = [country retain];
-//
-//        _country = country;
-//        [self saveInfo];
-//    }
-//}
-//
-//
-//- (void)setEmail:(NSString *)email {
-//    if (![_email isEqualToString:email]) {
-////        [_email release];
-////        _email = [email retain];
-//
-//        _email = email;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setTel:(NSString *)tel {
-//    if (![_tel isEqualToString:tel]) {
-////        [_tel release];
-////        _tel = [tel retain];
-//        _tel = tel;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setBirthDate:(NSString *)birthDate {
-//    if (![_birthDate isEqualToString:birthDate]) {
-////        [_birthDate release];
-////        _birthDate = [birthDate retain];
-//
-//        _birthDate = birthDate;
-//        [self saveInfo];
-//    }
-//}
-//
-//- (void)setCustomInfoArray:(NSMutableArray *)customInfoArray {
-//    if (![customInfoArray isEqual:customInfoArray]) {
-////        [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
-
-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
-
-@implementation KMProfileInfoWindowController
-
-- (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] replaceObjectInCustomInfoArrayAt:customIndex with:newDict];
-            } else if ([textField isEqual:cellView.detailtextField]){
-                NSDictionary *newDict = @{originalKey:textField.stringValue};
-                [[KMProfileInfo sharedInstance] replaceObjectInCustomInfoArrayAt:customIndex with: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 inCustomInfoArrayAt:[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] removeObjectFromCustomInfoArrayAt: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] removeObjectFromCustomInfoArrayAt: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

File diff suppressed because it is too large
+ 597 - 624
PDF Office/PDF Master/Class/PDFTools/SelfSign/Window/KMProfileInfoWindowController.swift


+ 5 - 5
PDF Office/PDF Master/Class/PDFTools/SelfSign/Window/KMProfileInfoWindowController.xib

@@ -128,7 +128,7 @@ DQ
                         </constraints>
                     </customView>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HcI-gL-dgj">
-                        <rect key="frame" x="38" y="400" width="37" height="18"/>
+                        <rect key="frame" x="38" y="398" width="37" height="18"/>
                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="YeK-uM-b3g">
                             <font key="font" size="13" name="PingFangSC-Regular"/>
                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -136,13 +136,13 @@ DQ
                         </textFieldCell>
                     </textField>
                     <scrollView autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P2P-jH-JNm">
-                        <rect key="frame" x="40" y="74" width="584" height="325"/>
+                        <rect key="frame" x="40" y="74" width="584" height="323"/>
                         <clipView key="contentView" id="Txz-Kp-TvA">
-                            <rect key="frame" x="1" y="1" width="582" height="323"/>
+                            <rect key="frame" x="1" y="1" width="582" height="321"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="ldR-2V-TXt">
-                                    <rect key="frame" x="0.0" y="0.0" width="582" height="323"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="582" height="321"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                     <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
@@ -204,7 +204,7 @@ DQ
                                                         <outlet property="textField" destination="jaJ-ef-ZVq" id="GzH-wx-MQQ"/>
                                                     </connections>
                                                 </tableCellView>
-                                                <tableCellView identifier="TitleCell" id="FUh-ze-Iiz" customClass="KMProfileTitleCellView">
+                                                <tableCellView identifier="TitleCell" id="FUh-ze-Iiz" customClass="KMProfileTitleCellView" customModule="PDF_Master" customModuleProvider="target">
                                                     <rect key="frame" x="0.0" y="17" width="518" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>

+ 3 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

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

+ 3 - 1
PDF Office/PDF Master/Class/Preference/Controller/KMDisplayPreferences.swift

@@ -131,5 +131,7 @@ import Cocoa
 }
 
 extension KMDisplayPreferences: KMPreferencePane {
-    
+    func defaultsDidRevert() {
+        
+    }
 }

+ 7 - 12
PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift

@@ -14,9 +14,10 @@ class KMGeneralPreferences: NSViewController {
      #define AUTOMATICALLYCHECKSFORUPDATES_KEY @"automaticallyChecksForUpdates"
      #define UPDATECHECKINTERVAL_KEY @"updateCheckInterval"
 
-     #define SUScheduledCheckIntervalKey @"SUScheduledCheckInterval"
+     
      */
     private let UPDATEINTERVAL_KEY = "updateInterval"
+    private let SUScheduledCheckIntervalKey = "SUScheduledCheckInterval"
     
     @IBOutlet var updateIntervalPopUpButton: NSPopUpButton!
     
@@ -255,16 +256,6 @@ class KMGeneralPreferences: NSViewController {
              [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
      }
 
-     #pragma mark Hooks
-
-     - (void)defaultsDidRevert {
-         NSTimeInterval interval = [[[NSBundle mainBundle] objectForInfoDictionaryKey:SUScheduledCheckIntervalKey] doubleValue];
-     #if VERSION_DMG
-         [[SUUpdater sharedUpdater] setUpdateCheckInterval:interval];
-         [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:interval > 0.0];
-     #endif
-     }
-
      @end
 
      */
@@ -313,6 +304,10 @@ extension KMGeneralPreferences {
 
 extension KMGeneralPreferences: KMPreferencePane {
     func defaultsDidRevert() {
-        
+        let interval = Bundle.main.object(forInfoDictionaryKey: SUScheduledCheckIntervalKey)
+    #if VERSION_DMG
+//        [[SUUpdater sharedUpdater] setUpdateCheckInterval:interval];
+//        [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:interval > 0.0];
+    #endif
     }
 }

+ 3 - 1
PDF Office/PDF Master/Class/Preference/Controller/KMNotesPreferences.swift

@@ -136,5 +136,7 @@ class KMNotesPreferences: NSViewController {
 }
 
 extension KMNotesPreferences: KMPreferencePane {
-    
+    func defaultsDidRevert() {
+        
+    }
 }

+ 37 - 62
PDF Office/PDF Master/Class/Preference/Window/KMPreferenceController.swift

@@ -29,6 +29,9 @@ class KMPreferenceController: NSWindowController {
     var history: [NSViewController]?
     var historyIndex: Int = 0
     var currentPane: KMPreferencePane?
+    
+    private let INITIALUSERDEFAULTS_KEY = "InitialUserDefaults"
+    private let RESETTABLEKEYS_KEY = "ResettableKeys"
     /*
      @class SKIBArray;
      @protocol ;
@@ -151,14 +154,6 @@ class KMPreferenceController: NSWindowController {
     
     
     /*
-
-     #define INITIALUSERDEFAULTS_KEY @"InitialUserDefaults"
-     #define RESETTABLEKEYS_KEY @"ResettableKeys"
-
-     //@synthesize resetButtons;
-
-
-
      - (void)selectPaneWithIdentifier:(NSString *)itemIdentifier {
          [self selectPane:[self preferencePaneForItemIdentifier:itemIdentifier]];
      }
@@ -167,36 +162,6 @@ class KMPreferenceController: NSWindowController {
 
      #pragma mark Actions
 
-
-
-     - (void)resetAllSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
-         if (returnCode == NSAlertFirstButtonReturn) {
-             [[NSUserDefaultsController sharedUserDefaultsController] revertToInitialValues:nil];
-             for (NSViewController<SKPreferencePane> *pane in preferencePanes) {
-                 if ([pane respondsToSelector:@selector(defaultsDidRevert)])
-                     [pane defaultsDidRevert];
-             }
-             
-             //重置OCR后,记录切换值
-             [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"KMStatusPlanPopUpBtnKey"];
-             [[NSUserDefaults standardUserDefaults] synchronize];
-         }
-     }
-
-     - (IBAction)resetAll:(id)sender {
-         NSAlert *alert = [[NSAlert alloc] init];
-         [alert setMessageText:NSLocalizedString(@"Reset all preferences to their original values?", @"Message in alert dialog when pressing Reset All button")];
-         [alert setInformativeText:NSLocalizedString(@"Choosing Reset will restore all settings to the state they were in when PDF Reader Pro Edition was first installed.", @"Informative text in alert dialog when pressing Reset All button")];
-         [alert addButtonWithTitle:NSLocalizedString(@"Reset", @"Button title")];
-         [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Button title")];
-         [alert beginSheetModalForWindow:[self window]
-                           modalDelegate:self
-                          didEndSelector:@selector(resetAllSheetDidEnd:returnCode:contextInfo:)
-                             contextInfo:NULL];
-     }
-
-
-
      - (IBAction)doGoToNextPage:(id)sender {
          NSUInteger itemIndex = [preferencePanes indexOfObject:currentPane];
          if (itemIndex != NSNotFound && ++itemIndex < [preferencePanes count])
@@ -319,18 +284,6 @@ class KMPreferenceController: NSWindowController {
             return
         }
         
-//        NSString *label = [currentPane title];
-//        NSAlert *alert = [[NSAlert alloc] init];
-//        [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Reset %@ preferences to their original values?", @"Message in alert dialog when pressing Reset All button"), label]];
-//        [alert setInformativeText:[NSString stringWithFormat:, label]];
-//        [alert addButtonWithTitle:NSLocalizedString(@"Reset", @"Button title")];
-//        [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Button title")];
-//        [alert beginSheetModalForWindow:[self window]
-//                          modalDelegate:self
-////                         didEndSelector:@selector(resetCurrentSheetDidEnd:returnCode:contextInfo:)
-//                            contextInfo:NULL];
-        
-        
         let label = (self.currentPane as? NSViewController)?.title ?? ""
         let alert = NSAlert()
         alert.messageText = String(format: KMLocalizedString("Reset %@ preferences to their original values?", "Message in alert dialog when pressing Reset All button"), label)
@@ -339,7 +292,26 @@ class KMPreferenceController: NSWindowController {
         alert.addButton(withTitle: KMLocalizedString("Cancel", "Button title"))
         alert.beginSheetModal(for: self.window!, modalDelegate: self, didEnd: #selector(_resetCurrentSheetDidEnd), contextInfo: nil)
     }
-
+    
+    @IBAction func resetAll(_ sender: AnyObject?) {
+        let alert = NSAlert()
+        alert.messageText = KMLocalizedString("Reset all preferences to their original values?", "Message in alert dialog when pressing Reset All button")
+        alert.informativeText = KMLocalizedString("Choosing Reset will restore all settings to the state they were in when PDF Reader Pro Edition was first installed.", "Informative text in alert dialog when pressing Reset All button")
+        alert.addButton(withTitle: KMLocalizedString("Reset", "Button title"))
+        alert.addButton(withTitle: KMLocalizedString("Cancel", "Button title"))
+        
+        let response = alert.runModal()
+        if (response == .alertFirstButtonReturn) {
+            NSUserDefaultsController.shared.revertToInitialValues(forKeys: nil)
+            for pane in self.preferencePanes! {
+                pane.defaultsDidRevert?()
+            }
+            
+            //重置OCR后,记录切换值
+//            [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"KMStatusPlanPopUpBtnKey"];
+//            [[NSUserDefaults standardUserDefaults] synchronize];
+        }
+    }
 }
 
 // MARK: - Private Methods
@@ -446,17 +418,20 @@ extension KMPreferenceController {
     }
     
     @objc private func _resetCurrentSheetDidEnd(_ alert: NSAlert, _ returnCode: Int, _ contextInfo: Any) {
-//        if (returnCode == NSAlertFirstButtonReturn) {
-//            NSURL *initialUserDefaultsURL = [[NSBundle mainBundle] URLForResource:INITIALUSERDEFAULTS_KEY withExtension:@"plist"];
-//            NSArray *resettableKeys = [[[NSDictionary dictionaryWithContentsOfURL:initialUserDefaultsURL] objectForKey:RESETTABLEKEYS_KEY] objectForKey:[currentPane nibName]];
-//            [[NSUserDefaultsController sharedUserDefaultsController] revertToInitialValuesForKeys:resettableKeys];
-//            if ([currentPane respondsToSelector:@selector(defaultsDidRevert)])
-//                [currentPane defaultsDidRevert];
-//            if ([[currentPane title] isEqualToString:@"OCR"]) { //重置OCR后,记录切换值
-//                [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"KMStatusPlanPopUpBtnKey"];
-//                [[NSUserDefaults standardUserDefaults] synchronize];
-//            }
-//        }
+        if (returnCode == NSApplication.ModalResponse.alertFirstButtonReturn.rawValue) {
+            let initialUserDefaultsURL = Bundle.main.url(forResource: INITIALUSERDEFAULTS_KEY, withExtension: "plist")
+            if let _currentPane = self.currentPane as? NSViewController {
+                let resettableKeys = (NSDictionary(contentsOf: initialUserDefaultsURL!)?.object(forKey: RESETTABLEKEYS_KEY) as? NSDictionary)?.object(forKey: _currentPane.nibName!)
+                if let data = resettableKeys as? [String] {
+                    NSUserDefaultsController.shared.revertToInitialValues(forKeys: data)
+                }
+                self.currentPane?.defaultsDidRevert?()
+//                if ([[currentPane title] isEqualToString:@"OCR"]) { //重置OCR后,记录切换值
+//                    [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"KMStatusPlanPopUpBtnKey"];
+//                    [[NSUserDefaults standardUserDefaults] synchronize];
+//                }
+            }
+        }
     }
 }
 

+ 0 - 2
PDF Office/PDF Master/PDF_Master-Bridging-Header.h

@@ -57,5 +57,3 @@
 #import "KMConvertURLToPDF.h"
 
 #import "NSImage_SKExtensions.h"
-
-#import "KMProfileInfoWindowController.h"