Combined KeePassHttp and Autotype preferences in one window

Added enable auto type preferences key
This commit is contained in:
michael starke
2014-02-18 13:00:56 +01:00
parent e976398a5e
commit 81bcd15d80
18 changed files with 184 additions and 83 deletions

View File

@@ -12,6 +12,7 @@
#import "MPDocument.h"
#import "MPDocument+Autotype.h"
#import "MPAutotypeCommand.h"
#import "MPSettingsHelper.h"
#import "KPKEntry.h"
@@ -20,16 +21,31 @@
NSString *const kMPWindowTitleKey = @"windowTitle";
NSString *const kMPApplciationNameKey = @"applicationName";
@interface MPAutotypeDaemon ()
@property (nonatomic, assign) BOOL enabled;
@end
@implementation MPAutotypeDaemon
- (id)init {
self = [super init];
if (self) {
[self _registerHotKey];
_enabled = NO;
[[NSUserDefaults standardUserDefaults] bind:kMPSettingsKeyEnableGlobalAutotype toObject:self withKeyPath:@"enabled" options:nil];
}
return self;
}
#pragma mark Properties
- (void)setEnabled:(BOOL)enabled {
if(_enabled != enabled) {
_enabled = enabled;
self.enabled ? [self _registerHotKey] : [self _unregisterHotKey];
}
}
- (void)exectureAutotypeForEntry:(KPKEntry *)entry withWindowTitle:(NSString *)title {
NSAssert(NO,@"Not Implemented");
}
@@ -101,6 +117,10 @@ NSString *const kMPApplciationNameKey = @"applicationName";
object:nil];
}
- (void)_unregisterHotKey {
[[DDHotKeyCenter sharedHotKeyCenter] unregisterHotKeysWithTarget:self action:@selector(_didPressHotKey)];
}
- (NSDictionary *)_frontMostApplicationInfoDict {
NSRunningApplication *frontApplication = [[NSWorkspace sharedWorkspace] frontmostApplication];
NSString *name = frontApplication.localizedName;