Added duplicate entry with options

This commit is contained in:
michael starke
2017-06-08 15:40:08 +02:00
parent 6771d68454
commit 8dd465866e
10 changed files with 172 additions and 42 deletions

View File

@@ -15,6 +15,7 @@
#import "MPDatabaseSettingsWindowController.h"
#import "MPDocument.h"
#import "MPDocumentWindowDelegate.h"
#import "MPDuplicateEntryOptionsWindowController.h"
#import "MPEntryViewController.h"
#import "MPFixAutotypeWindowController.h"
#import "MPInspectorViewController.h"
@@ -397,6 +398,27 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[self.document deleteNode:node];
}
}
- (void)duplicateEntryWithOptions:(id)sender {
MPDuplicateEntryOptionsWindowController *wc = [[MPDuplicateEntryOptionsWindowController alloc] init];
__weak MPDocumentWindowController *welf = self;
[self.window beginSheet:wc.window completionHandler:^(NSModalResponse returnCode) {
if(returnCode == NSModalResponseOK) {
KPKCopyOptions options = kKPKCopyOptionNone;
if(wc.referenceUsername) {
options |= kKPKCopyOptionReferenceUsername;
}
if(wc.referencePassword) {
options |= kKPKCopyOptionReferencePassword;
}
if(wc.duplicateHistory) {
options |= kKPKCopyOptionCopyHistory;
}
[((MPDocument *)welf.document) duplicateEntryWithOptions:options];
}
}];
}
- (void)pickExpiryDate:(id)sender {
[self.inspectorViewController pickExpiryDate:sender];