mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 03:32:40 +00:00
HotKey is not Updated correctly
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="89" id="Mia-b8-HCZ"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="" drawsBackground="YES" id="sW8-rh-bhD" customClass="DDHotKeyTextFieldCell">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="" drawsBackground="YES" id="sW8-rh-bhD" customClass="DDHotKeyTextFieldCell">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
@interface MPIntegrationSettingsController ()
|
||||
|
||||
@property (nonatomic, copy) NSData *globalAutotypeKeyData;
|
||||
@property (nonatomic, strong) DDHotKey *hotKey;
|
||||
|
||||
@end
|
||||
|
||||
@@ -39,25 +39,30 @@
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
self.hotKey = [DDHotKey defaultHotKey];
|
||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||
NSString *serverKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableHttpServer];
|
||||
NSString *globalAutotypeKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableGlobalAutotype];
|
||||
NSString *enableGlobalAutotypeKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableGlobalAutotype];
|
||||
NSString *quicklookKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableQuicklookPreview];
|
||||
NSString *globalAutotypeDataKeyPath = [MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyGlobalAutotypeKeyDataKey];
|
||||
[self.enableServerCheckbutton bind:NSValueBinding toObject:defaultsController withKeyPath:serverKeyPath options:nil];
|
||||
[self.enableServerCheckbutton setEnabled:NO];
|
||||
[self.enableGlobalAutotypeCheckbutton bind:NSValueBinding toObject:defaultsController withKeyPath:globalAutotypeKeyPath options:nil];
|
||||
[self.enableGlobalAutotypeCheckbutton bind:NSValueBinding toObject:defaultsController withKeyPath:enableGlobalAutotypeKeyPath options:nil];
|
||||
[self.enableQuicklookCheckbutton bind:NSValueBinding toObject:defaultsController withKeyPath:quicklookKeyPath options:nil];
|
||||
[self.globalAutotypeKeyData bind:NSValueBinding toObject:defaultsController withKeyPath:globalAutotypeDataKeyPath options:nil];
|
||||
[self.hotKeyTextField bind:NSEnabledBinding toObject:defaultsController withKeyPath:enableGlobalAutotypeKeyPath options:nil];
|
||||
[self.hotKeyTextField bind:NSStringFromSelector(@selector(hotKey)) toObject:self withKeyPath:NSStringFromSelector(@selector(hotKey)) options:nil];
|
||||
}
|
||||
|
||||
#pragma mark Properties
|
||||
- (void)setGlobalAutotypeKeyData:(NSData *)globalAutotypeKeyData {
|
||||
if(![_globalAutotypeKeyData isEqualToData:globalAutotypeKeyData]) {
|
||||
_globalAutotypeKeyData = [globalAutotypeKeyData copy];
|
||||
- (void)setHotKey:(DDHotKey *)hotKey {
|
||||
static NSData *defaultHotKeyData = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
defaultHotKeyData = [[DDHotKey defaultHotKey] keyData];
|
||||
});
|
||||
NSData *newData = [hotKey keyData];
|
||||
if(![newData isEqualToData:defaultHotKeyData]) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:newData forKey:kMPSettingsKeyGlobalAutotypeKeyDataKey];
|
||||
}
|
||||
DDHotKey *hotKey = [[DDHotKey alloc] initWithKeyData:_globalAutotypeKeyData];
|
||||
self.hotKeyTextField.hotKey = hotKey;
|
||||
_hotKey = hotKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyLegacyHideUsername;
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyLegacyHidePassword;
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyLegacyHideNotes;
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyLegacyHideURL;
|
||||
|
||||
/* Document/Key Location store */
|
||||
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyLastDatabasePath; // Path to the last opened Database. Workaround if users have disabled the feautere in the OS
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyRememeberdKeysForDatabases; // NSDictionary of all db file urls and the corresponding key file url
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyRememberKeyFilesForDatabases; // YES if key files should be rememberd
|
||||
|
||||
Reference in New Issue
Block a user