mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 01:12:31 +00:00
Fixed more issues with sheets being displayed when database is locked
This commit is contained in:
@@ -216,7 +216,7 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
|||||||
|
|
||||||
- (void)lockAllDocuments {
|
- (void)lockAllDocuments {
|
||||||
for(NSDocument *document in ((NSDocumentController *)[NSDocumentController sharedDocumentController]).documents) {
|
for(NSDocument *document in ((NSDocumentController *)[NSDocumentController sharedDocumentController]).documents) {
|
||||||
for(id windowController in document.windowControllers) {
|
for(id windowController in [document.windowControllers reverseObjectEnumerator]) {
|
||||||
if([windowController respondsToSelector:@selector(lock:)]) {
|
if([windowController respondsToSelector:@selector(lock:)]) {
|
||||||
[windowController lock:self];
|
[windowController lock:self];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -661,7 +661,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
|||||||
- (KPKAttribute *)createCustomAttribute:(KPKEntry *)entry {
|
- (KPKAttribute *)createCustomAttribute:(KPKEntry *)entry {
|
||||||
NSString *title = NSLocalizedString(@"DEFAULT_CUSTOM_FIELD_TITLE", @"Default Titel for new Custom-Fields");
|
NSString *title = NSLocalizedString(@"DEFAULT_CUSTOM_FIELD_TITLE", @"Default Titel for new Custom-Fields");
|
||||||
NSString *value = NSLocalizedString(@"DEFAULT_CUSTOM_FIELD_VALUE", @"Default Value for new Custom-Fields");
|
NSString *value = NSLocalizedString(@"DEFAULT_CUSTOM_FIELD_VALUE", @"Default Value for new Custom-Fields");
|
||||||
title = [entry proposedKeyForAttributeKey:title];
|
|
||||||
KPKAttribute *newAttribute = [[KPKAttribute alloc] initWithKey:title value:value];
|
KPKAttribute *newAttribute = [[KPKAttribute alloc] initWithKey:title value:value];
|
||||||
[entry addCustomAttribute:newAttribute];
|
[entry addCustomAttribute:newAttribute];
|
||||||
return newAttribute;
|
return newAttribute;
|
||||||
|
|||||||
@@ -525,16 +525,23 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
|
|||||||
[alert addButtonWithTitle:NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", "")];
|
[alert addButtonWithTitle:NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", "")];
|
||||||
|
|
||||||
[alert beginSheetModalForWindow:[self.document windowForSheet] completionHandler:^(NSModalResponse returnCode) {
|
[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(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
[self editPasswordWithCompetionHandler:^(NSInteger result) {
|
[self editPasswordWithCompetionHandler:^(NSInteger result) {
|
||||||
/* if password was changed, reset change key and dismiss */
|
/* if password was changed, reset change key and dismiss */
|
||||||
if(NSModalResponseOK == result) {
|
if(NSModalResponseOK == result) {
|
||||||
document.tree.metaData.enforceMasterKeyChangeOnce = NO;
|
document.tree.metaData.enforceMasterKeyChangeOnce = NO;
|
||||||
}
|
}
|
||||||
else {
|
else if(NSModalResponseCancel) {
|
||||||
/* password was not changes, so keep nagging the user! */
|
/* password was not changes, so keep nagging the user! */
|
||||||
[self _presentPasswordIntervalAlerts];
|
[self _presentPasswordIntervalAlerts];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// We might have been killed by locking so do nothing!
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user