diff --git a/KeePassKit b/KeePassKit index a8103614..ecc58b8a 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit a8103614ebdcfc4375eaf25c9218b73aaebdeec0 +Subproject commit ecc58b8a561385462f72b7aa38b1b78e4928e731 diff --git a/MacPass/GroupInspectorView.xib b/MacPass/GroupInspectorView.xib index d5488b0c..0f967dd1 100644 --- a/MacPass/GroupInspectorView.xib +++ b/MacPass/GroupInspectorView.xib @@ -19,18 +19,18 @@ - + - + - + - + @@ -39,7 +39,7 @@ - + @@ -51,8 +51,11 @@ - + @@ -97,7 +100,7 @@ - + @@ -111,11 +114,11 @@ - + - + @@ -124,7 +127,7 @@ - + @@ -132,8 +135,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -141,20 +166,24 @@ + + + + + - diff --git a/MacPass/MPAutotypeContext.m b/MacPass/MPAutotypeContext.m index fb7b12e6..86faa74e 100644 --- a/MacPass/MPAutotypeContext.m +++ b/MacPass/MPAutotypeContext.m @@ -27,7 +27,7 @@ } - (instancetype)initWithDefaultSequenceForEntry:(KPKEntry *)entry { - self = [self initWithEntry:entry andSequence:entry.autotype.defaultSequence]; + self = [self initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence]; return self; } diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index 769163c9..376fad4f 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -84,9 +84,7 @@ NSString *const kMPApplciationNameKey = @"applicationName"; */ NSDictionary *frontApplicationInfoDict = [self _frontMostApplicationInfoDict]; NSString *windowTitle = frontApplicationInfoDict[kMPWindowTitleKey]; - self.lastFrontMostApplication = frontApplicationInfoDict[kMPApplciationNameKey]; - //NSLog(@"Looking for entries matching window title:%@ of applciation: %@", windowTitle, applicationName); - + self.lastFrontMostApplication = frontApplicationInfoDict[kMPApplciationNameKey]; /* Query the document to generate a autotype command list for the window title We do not care where this came form, just get the autotype commands @@ -137,6 +135,10 @@ NSString *const kMPApplciationNameKey = @"applicationName"; NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID)); for(NSDictionary *windowDict in currentWindows) { + NSString *windowTitle = windowDict[(NSString *)kCGWindowName]; + if([windowTitle length] <= 0) { + continue; + } NSNumber *processId = windowDict[(NSString *)kCGWindowOwnerPID]; if(processId && [processId isEqualToNumber:@(frontApplication.processIdentifier)]) { return @{ @@ -172,11 +174,14 @@ NSString *const kMPApplciationNameKey = @"applicationName"; } + (void)_orderApplicationToFront:(NSString *)applicationName { - NSLog(@"Moving %@ to the front.", applicationName); + //NSLog(@"Moving %@ to the front.", applicationName); NSString *appleScript = [[NSString alloc] initWithFormat:@"activate application \"%@\"", applicationName]; NSAppleScript *script = [[NSAppleScript alloc] initWithSource:appleScript]; NSDictionary *error; NSAppleEventDescriptor *descriptor = [script executeAndReturnError:&error]; + if(descriptor) { + NSLog(@"Error trying to execure %@: %@", script, error); + } } diff --git a/MacPass/MPDocument+Autotype.m b/MacPass/MPDocument+Autotype.m index 7c4d6c70..2aa452a3 100644 --- a/MacPass/MPDocument+Autotype.m +++ b/MacPass/MPDocument+Autotype.m @@ -41,7 +41,7 @@ NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch]; MPAutotypeContext *context; if(titleRange.location != NSNotFound && titleRange.length != 0) { - context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultSequence]; + context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence]; } /* search in Autotype entries for match */ else { diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 006e3aa2..79b52068 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -86,30 +86,30 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self _addScrollViewWithView:self.generalView atTab:MPEntryTabGeneral]; [self _addScrollViewWithView:self.autotypView atTab:MPEntryTabAutotype]; - [self.infoTabControl bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil]; - [self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil]; + [self.infoTabControl bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil]; + [self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil]; /* Set background to clearcolor so we can draw in the scrollview */ [self.attachmentTableView setBackgroundColor:[NSColor clearColor]]; - [self.attachmentTableView bind:NSContentBinding toObject:_attachmentsController withKeyPath:@"arrangedObjects" options:nil]; + [self.attachmentTableView bind:NSContentBinding toObject:_attachmentsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; [self.attachmentTableView setDelegate:_attachmentTableDelegate]; [self.attachmentTableView setDataSource:_attachmentDataSource]; [self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]]; /* Set background to clearcolor so we can draw in the scrollview */ [self.customFieldsTableView setBackgroundColor:[NSColor clearColor]]; - [self.customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:@"arrangedObjects" options:nil]; + [self.customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; [self.customFieldsTableView setDelegate:_customFieldTableDelegate]; [self.windowAssociationsTableView setBackgroundColor:[NSColor clearColor]]; [self.windowAssociationsTableView setDelegate:_windowAssociationsTableDelegate]; - [self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:@"arrangedObjects" options:nil]; + [self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; - [self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil]; - [self.togglePassword bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil]; + [self.passwordTextField bind:NSStringFromSelector(@selector(showPassword)) toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil]; + [self.togglePassword bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil]; } - (void)setupBindings:(MPDocument *)document { - [self bind:@"entry" toObject:document withKeyPath:@"selectedEntry" options:nil]; + [self bind:NSStringFromSelector(@selector(entry)) toObject:document withKeyPath:NSStringFromSelector(@selector(selectedEntry)) options:nil]; } - (void)setEntry:(KPKEntry *)entry { @@ -336,16 +336,16 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { - (void)_bindEntry { if(self.entry) { - [self.titleTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"title" options:nil]; - [self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"password" options:nil]; - [self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"username" options:nil]; - [self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"url" options:nil]; + [self.titleTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(title)) options:nil]; + [self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(password)) options:nil]; + [self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(username)) options:nil]; + [self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(url)) options:nil]; [self.expiresCheckButton bind:NSTitleBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expiryTime)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }]; - [self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:@"expires" options:nil]; - [self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:@"tags" options:nil]; + [self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil]; + [self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(tags)) options:nil]; } else { [self.titleTextField unbind:NSValueBinding]; @@ -359,7 +359,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { - (void)_bindAttachments { if(self.entry) { - [_attachmentsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"binaries" options:nil]; + [_attachmentsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(binaries)) options:nil]; } else if([_attachmentsController content] != nil){ [_attachmentsController unbind:NSContentArrayBinding]; @@ -369,7 +369,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { - (void)_bindCustomFields { if(self.entry) { - [_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:@"customAttributes" options:nil]; + [_customFieldsController bind:NSContentArrayBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(customAttributes)) options:nil]; } else if ([_customFieldsController content] != nil ) { [_customFieldsController unbind:NSContentArrayBinding]; @@ -379,10 +379,10 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { - (void)_bindAutotype { if(self.entry) { - [self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" options:nil]; - [self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:@"isEnabled" options:nil]; - [self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:@"defaultSequence" options:nil]; - [_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:@"associations" options:nil]; + [self.enableAutotypeCheckButton bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil]; + [self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil]; + [self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(defaultKeystrokeSequence)) options:nil]; + [_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(associations)) options:nil]; } else { [self.enableAutotypeCheckButton unbind:NSValueBinding];