Adopting new KeePassKit API

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-09-30 15:10:08 +02:00
parent 224b28d390
commit 6e3af144bc
5 changed files with 15 additions and 18 deletions

View File

@@ -108,7 +108,7 @@
}
/* Fall back to preferred Entry if no match was found */
if(contexts.count == 0 && usePreferredEntry) {
if(usePreferredEntry && contexts.count == 0 ) {
context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence];
if(context.valid) {
[contexts addObject:context];

View File

@@ -127,6 +127,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
}
}
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didAddEntry:)
@@ -198,7 +199,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
}
- (void)addWindowAssociation:(id)sender {
KPKWindowAssociation *associtation = [[KPKWindowAssociation alloc] initWithWindow:NSLocalizedString(@"DEFAULT_WINDOW_TITLE", "") keystrokeSequence:nil];
KPKWindowAssociation *associtation = [[KPKWindowAssociation alloc] initWithWindowTitle:NSLocalizedString(@"DEFAULT_WINDOW_TITLE", "") keystrokeSequence:nil];
[self.entry.autotype addAssociation:associtation];
}
@@ -225,14 +226,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
}
}
- (void)beginEditing {
[self _toggleEditing:YES];
}
- (void)endEditing {
[self _toggleEditing:NO];
}
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
switch([MPActionHelper typeForAction:[menuItem action]]) {
case MPActionToggleQuicklook: {

View File

@@ -146,7 +146,7 @@ NSString *const kMPIconCell = @"IconCell";
}
else {
BOOL isMalformed = [MPDocument isCandidateForMalformedAutotype:item];
BOOL isDefault = [entry.autotype hasDefaultKeystrokeSequence] || [group hasDefaultAutotypeSequence] || [association hasDefaultKeystrokeSequence];
BOOL isDefault = entry.autotype.hasDefaultKeystrokeSequence || group.hasDefaultAutotypeSequence || association.hasDefaultKeystrokeSequence;
if([[tableColumn identifier] isEqualToString:kMPIsDefaultCell]) {
return isDefault ? @"Yes" : @"No";
}
@@ -162,13 +162,13 @@ NSString *const kMPIconCell = @"IconCell";
id item = [self entriesAndGroups][row];
if([item isKindOfClass:[KPKEntry class]]) {
[[item autotype] setDefaultKeystrokeSequence:object];
((KPKEntry *)item).autotype.defaultKeystrokeSequence = object;
}
else if([item isKindOfClass:[KPKGroup class]]) {
[item setDefaultAutoTypeSequence:object];
((KPKGroup *)item).defaultAutoTypeSequence = object;
}
else if([item isKindOfClass:[KPKWindowAssociation class]]) {
[item setKeystrokeSequence:object];
((KPKWindowAssociation *)item).keystrokeSequence = object;
}
}
@@ -176,7 +176,7 @@ NSString *const kMPIconCell = @"IconCell";
#pragma mark NSTableViewDelegate
- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
return [[tableColumn identifier] isEqualToString:kMPAutotypeCell];
return [tableColumn.identifier isEqualToString:kMPAutotypeCell];
}
- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row {
@@ -188,10 +188,10 @@ NSString *const kMPIconCell = @"IconCell";
#pragma mark MenuItem Validation
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
if(!([menuItem action] == @selector(clearAutotype:))) {
if(!(menuItem.action == @selector(clearAutotype:))) {
return NO;
}
return ([[self.tableView selectedRowIndexes] count] > 0);
return (self.tableView.selectedRowIndexes.count > 0);
}
#pragma mark -