2
0

Make unlock window a sheet of the password window.

[IMPROVED]  Unlock alert a sheet of the password window.
This commit is contained in:
Maarten Billemont 2012-05-08 00:44:49 +02:00
parent f622b2c7d4
commit 1b90c9bfa3

View File

@ -133,10 +133,16 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
[alert setAccessoryView:passwordField];
[alert layout];
[passwordField becomeFirstResponder];
do {
NSInteger button = [alert runModal];
[alert beginSheetModalForWindow:self.passwordWindow.window modalDelegate:self
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:NULL];
if (button == 0)
[self printStore];
});
}
- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
if (returnCode == NSAlertAlternateReturn)
// "Change" button.
if ([[NSAlert alertWithMessageText:@"Changing Master Password"
defaultButton:nil alternateButton:[PearlStrings get].commonButtonCancel otherButton:nil
@ -145,19 +151,15 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
@"Note that you will only see the sites and passwords for the master password you log in with.\n"
@"If you log in with a different master password, your current sites will be unavailable.\n\n"
@"You can always change back to your current master password later.\n"
@"Your current sites and passwords will then become available again."] runModal] == 1) {
@"Your current sites and passwords will then become available again."] runModal] == 1)
[self forgetKey];
continue;
}
if (button == -1) {
if (returnCode == NSAlertOtherReturn)
// "Quit" button.
[[NSApplication sharedApplication] terminate:self];
break;
}
} while (![self tryMasterPassword:[passwordField stringValue]]);
[self printStore];
});
if (![self tryMasterPassword:[(NSSecureTextField *)alert.accessoryView stringValue]])
[self unlock:self];
}
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window {