diff --git a/MacPass/Kdb3Entry+KVOAdditions.m b/MacPass/Kdb3Entry+KVOAdditions.m index 7a3fe98a..1a889586 100644 --- a/MacPass/Kdb3Entry+KVOAdditions.m +++ b/MacPass/Kdb3Entry+KVOAdditions.m @@ -14,16 +14,16 @@ return (self.binary != nil ? 1 : 0); } - (id)objectInBinariesAtIndex:(NSUInteger)index { - if(self.binary) { - return @"Dummy"; - } - return nil; + return self.binary; } - (void)removeObjectFromBinariesAtIndex:(NSUInteger)index { - return; // Stubb + if(self.binary ) { + self.binary = nil; + self.binaryDesc = nil; + } } - (void)insertObject:(id)binary inBinariesAtIndex:(NSUInteger)index { - return; //Stubb + return;// } diff --git a/MacPass/MPDatabaseSettingsWindowController.m b/MacPass/MPDatabaseSettingsWindowController.m index 449eaaef..e5267ef5 100644 --- a/MacPass/MPDatabaseSettingsWindowController.m +++ b/MacPass/MPDatabaseSettingsWindowController.m @@ -202,7 +202,7 @@ if(hasKey) { keyOk = [self.keyURL checkResourceIsReachableAndReturnError:nil]; } - BOOL hasPassword = ![password isEmpty]; + BOOL hasPassword = ![NSString isEmptyString:password]; BOOL passwordOk = YES; if(hasPassword ) { passwordOk = [password isEqualToString:repeat] || self.showPassword; diff --git a/MacPass/MPDocument+Attachments.m b/MacPass/MPDocument+Attachments.m index 908f6829..f016df5c 100644 --- a/MacPass/MPDocument+Attachments.m +++ b/MacPass/MPDocument+Attachments.m @@ -105,6 +105,14 @@ [self.treeV4.binaries removeObject:binary]; } +- (void)removeAttachmentFromEntry:(KdbEntry *)anEntry { + if(self.version != MPDatabaseVersion3) { + return; + } + Kdb3Entry *entry = (Kdb3Entry *)anEntry; + [entry removeObjectFromBinariesAtIndex:0]; +} + - (Binary *)findBinary:(BinaryRef *)reference { if(self.version != MPDatabaseVersion4) { return nil; diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index b97cbedd..a4fcd720 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -99,6 +99,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; - (void)saveAttachmentFromEntry:(KdbEntry *)anEntry toLocation:(NSURL *)location; - (void)saveAttachment:(BinaryRef *)reference toLocation:(NSURL *)location; - (void)removeAttachment:(BinaryRef *)reference fromEntry:(KdbEntry *)anEntry; +- (void)removeAttachmentFromEntry:(KdbEntry *)anEntry; - (NSUInteger)nextBinaryId; - (Binary *)findBinary:(BinaryRef *)reference; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index c6db59b0..28af9080 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -384,9 +384,9 @@ enum { - (IBAction)removeAttachment:(id)sender { MPDocument *document = [[self windowController] document]; if(document.version == MPDatabaseVersion3) { - // Handle entry + [document removeAttachmentFromEntry:self.selectedEntry]; } - if(document.version == MPDatabaseVersion4) { + else if(document.version == MPDatabaseVersion4) { Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; BinaryRef *reference = entry.binaries[[sender tag]]; [document removeAttachment:reference fromEntry:self.selectedEntry]; diff --git a/MiniKeePassLib b/MiniKeePassLib index f23dd68c..8f034d65 160000 --- a/MiniKeePassLib +++ b/MiniKeePassLib @@ -1 +1 @@ -Subproject commit f23dd68cb4fe701e089042672cf7322877a8deed +Subproject commit 8f034d65246546b90fb75c082c4b9aabd1f4409b