Fixed more issues with sheets being displayed when database is locked

This commit is contained in:
michael starke
2017-10-18 16:26:51 +02:00
parent 5c240ded7f
commit c4bd138ecb
3 changed files with 9 additions and 3 deletions

View File

@@ -525,16 +525,23 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[alert addButtonWithTitle:NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", "")];
[alert beginSheetModalForWindow:[self.document windowForSheet] completionHandler:^(NSModalResponse returnCode) {
/* if sheet was stopped any other way, do nothing */
if(returnCode != NSAlertFirstButtonReturn) {
return;
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self editPasswordWithCompetionHandler:^(NSInteger result) {
/* if password was changed, reset change key and dismiss */
if(NSModalResponseOK == result) {
document.tree.metaData.enforceMasterKeyChangeOnce = NO;
}
else {
else if(NSModalResponseCancel) {
/* password was not changes, so keep nagging the user! */
[self _presentPasswordIntervalAlerts];
}
else {
// We might have been killed by locking so do nothing!
}
}];
});
}];