mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-25 00:39:25 +00:00
Combined KeePassHttp and Autotype preferences in one window
Added enable auto type preferences key
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user