|
|
|
|
@@ -170,7 +170,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|
|
|
|
NSLocalizedRecoverySuggestionErrorKey : NSLocalizedString(@"WARNING_ON_SAVE_NO_PASSWORD_OR_KEY_SET_SUGGESTION", ""),
|
|
|
|
|
NSLocalizedRecoveryOptionsErrorKey : @[ NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", ""), NSLocalizedString(@"CANCEL", "") ],
|
|
|
|
|
NSRecoveryAttempterErrorKey : recovery
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
if(outError != NULL) {
|
|
|
|
|
*outError = [NSError errorWithDomain:MPDefaultErrorDomain code:MPErrorNoPasswordOrKeyFile userInfo:userInfo];
|
|
|
|
|
}
|
|
|
|
|
@@ -423,17 +423,17 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|
|
|
|
[passwordInputController requestPasswordWithMessage:NSLocalizedString(@"EXTERN_CHANGE_OF_MASTERKEY", @"The master key was changed by an external program!")
|
|
|
|
|
cancelLabel:NSLocalizedString(@"ABORT_MERGE_KEEP_MINE", @"Button label to abort a merge on a file with changed master key!")
|
|
|
|
|
completionHandler:^BOOL(NSString *password, NSURL *keyURL, BOOL didCancel, NSError *__autoreleasing *error) {
|
|
|
|
|
[self.windowForSheet endSheet:sheet returnCode:(didCancel ? NSModalResponseCancel : NSModalResponseOK)];
|
|
|
|
|
if(!didCancel) {
|
|
|
|
|
NSData *keyFileData = keyURL ? [NSData dataWithContentsOfURL:keyURL] : nil;
|
|
|
|
|
KPKCompositeKey *compositeKey = [[KPKCompositeKey alloc] init];
|
|
|
|
|
[compositeKey addKey:[KPKKey keyWithPassword:password]];
|
|
|
|
|
[compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]];
|
|
|
|
|
[self _mergeWithContentsFromURL:url key:compositeKey options:options];
|
|
|
|
|
}
|
|
|
|
|
// just return yes regardless since we will display the sheet again if needed!
|
|
|
|
|
return YES;
|
|
|
|
|
}];
|
|
|
|
|
[self.windowForSheet endSheet:sheet returnCode:(didCancel ? NSModalResponseCancel : NSModalResponseOK)];
|
|
|
|
|
if(!didCancel) {
|
|
|
|
|
NSData *keyFileData = keyURL ? [NSData dataWithContentsOfURL:keyURL] : nil;
|
|
|
|
|
KPKCompositeKey *compositeKey = [[KPKCompositeKey alloc] init];
|
|
|
|
|
[compositeKey addKey:[KPKKey keyWithPassword:password]];
|
|
|
|
|
[compositeKey addKey:[KPKKey keyWithKeyFileData:keyFileData]];
|
|
|
|
|
[self _mergeWithContentsFromURL:url key:compositeKey options:options];
|
|
|
|
|
}
|
|
|
|
|
// just return yes regardless since we will display the sheet again if needed!
|
|
|
|
|
return YES;
|
|
|
|
|
}];
|
|
|
|
|
sheet.contentViewController = passwordInputController;
|
|
|
|
|
[self.windowForSheet beginSheet:sheet completionHandler:^(NSModalResponse returnCode) { /* nothing to do, rest is done in other handler! */ }];
|
|
|
|
|
}
|
|
|
|
|
@@ -714,9 +714,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|
|
|
|
|
|
|
|
|
newGroup.title = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
|
|
|
|
newGroup.iconId = MPIconFolder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KPK_SCOPED_DISABLE_UNDO_END;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[newGroup addToGroup:parent];
|
|
|
|
|
[newGroup.undoManager setActionName:NSLocalizedString(@"NEW_GROUP", "Action name for a newly created group")];
|
|
|
|
|
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidAddGroupNotification
|
|
|
|
|
@@ -851,12 +851,12 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|
|
|
|
}
|
|
|
|
|
[self.undoManager setActionName:[NSString stringWithFormat:NSLocalizedString(@"DUPLICATE_ENTRIES_ACTION_NAME", @"Action name for duplicating entries"), self.selectedEntries.count]];
|
|
|
|
|
if(lastDuplicate) {
|
|
|
|
|
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidAddEntryNotification
|
|
|
|
|
object:self
|
|
|
|
|
userInfo:@{ MPDocumentEntryKey: lastDuplicate }];
|
|
|
|
|
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidAddEntryNotification
|
|
|
|
|
object:self
|
|
|
|
|
userInfo:@{ MPDocumentEntryKey: lastDuplicate }];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)duplicateGroup:(id)sender {
|
|
|
|
|
for(KPKGroup *group in self.selectedGroups) {
|
|
|
|
|
@@ -888,7 +888,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|
|
|
|
|
|
|
|
|
KPKEntry *targetEntry = targetEntries.count == 1 ? targetEntries.firstObject : nil;
|
|
|
|
|
KPKGroup *targetGroup = targetGroups.count == 1 ? targetGroups.firstObject : nil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(self.encrypted || self.isReadOnly) {
|
|
|
|
|
if(anItem.action == @selector(revertDocumentToSaved:) ||
|
|
|
|
|
anItem.action == @selector(browseDocumentVersions:)) {
|
|
|
|
|
|