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

@@ -917,6 +917,8 @@
4CE39AC316ECE4F7000FE29D /* MPPopupImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPopupImageView.m; sourceTree = "<group>"; };
4CE3E62417AB0D2D00D9E4B4 /* MPAttachmentTableDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAttachmentTableDataSource.h; sourceTree = "<group>"; };
4CE3E62517AB0D2D00D9E4B4 /* MPAttachmentTableDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAttachmentTableDataSource.m; sourceTree = "<group>"; };
4CE5012C1BBC13C100FB819D /* KPKWindowAssociation+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKWindowAssociation+Private.h"; sourceTree = "<group>"; };
4CE5012F1BBC15B600FB819D /* KPKAutotype+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKAutotype+Private.h"; sourceTree = "<group>"; };
4CE5B548173AFBA700207B39 /* MPDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocument.h; sourceTree = "<group>"; };
4CE5B549173AFBA700207B39 /* MPDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MPDocument.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
4CE76DAC17B3AD010043B82B /* KPKHashedDataTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKHashedDataTest.m; sourceTree = "<group>"; };
@@ -1861,8 +1863,10 @@
4CFC873C179DF200000DFC03 /* KPKTimeInfo.h */,
4CFC873D179DF200000DFC03 /* KPKTimeInfo.m */,
4C68456817BC21DD00FCDBFC /* KPKAutotype.h */,
4CE5012F1BBC15B600FB819D /* KPKAutotype+Private.h */,
4C68456917BC21DD00FCDBFC /* KPKAutotype.m */,
4C68456B17BC227B00FCDBFC /* KPKWindowAssociation.h */,
4CE5012C1BBC13C100FB819D /* KPKWindowAssociation+Private.h */,
4C68456C17BC227B00FCDBFC /* KPKWindowAssociation.m */,
4C8EB8BF18D399FD00438B08 /* KPKTag.h */,
4C8EB8C018D399FD00438B08 /* KPKTag.m */,

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 -