Fixed #59 Password length input is nu read only. Not a nice solution but for now working

Attachments for Kdb and Kdbx Databases are now supported. Save, Add, Delete
This commit is contained in:
michael starke
2013-07-21 23:23:45 +02:00
parent 45cb4a2652
commit acc800c9e6
11 changed files with 181 additions and 110 deletions

View File

@@ -350,18 +350,26 @@ enum {
}
- (IBAction)saveAttachment:(id)sender {
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
BinaryRef *reference = entry.binaries[[sender tag]];
BOOL isVersion4 = [self.selectedEntry isKindOfClass:[Kdb4Entry class]];
id item = self.selectedEntry;
NSString *fileName = nil;
if(isVersion4) {
Kdb4Entry *entry= (Kdb4Entry *)self.selectedEntry;
item = entry.binaries[[sender tag]];
fileName = ((BinaryRef *)item).key;
}
else {
fileName = ((Kdb3Entry *)item).binaryDesc;
}
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setCanCreateDirectories:YES];
[savePanel setNameFieldStringValue:reference.key];
[savePanel setNameFieldStringValue:fileName];
[savePanel beginSheetModalForWindow:[[self windowController] window] completionHandler:^(NSInteger result) {
if(result == NSFileHandlingPanelOKButton) {
MPDocument *document = [[self windowController] document];
[document saveAttachment:reference toLocation:[savePanel URL]];
[document saveAttachmentForItem:item toLocation:[savePanel URL]];
}
}];
}