Extended password input API to allow for custom messages.

Autotype now dispays an info message when the database needs to be unlocked
This commit is contained in:
Michael Starke
2018-11-05 18:38:16 +01:00
parent c260202924
commit 0ff6597487
6 changed files with 23 additions and 6 deletions

View File

@@ -22,6 +22,7 @@
#import "MPAutotypeDaemon.h"
#import "MPDocument.h"
#import "MPDocumentWindowController.h"
#import "MPAutotypeCommand.h"
#import "MPAutotypeContext.h"
#import "MPAutotypePaste.h"
@@ -208,7 +209,10 @@ static MPAutotypeDaemon *_sharedInstance;
[NSApp activateIgnoringOtherApps:YES];
[NSApp.mainWindow makeKeyAndOrderFront:self];
/* show the actual document window to the user */
[documents.firstObject showWindows];
MPDocument *document = documents.firstObject;
[document showWindows];
MPDocumentWindowController *wc = document.windowControllers.firstObject;
[wc showPasswordInputWithMessage:NSLocalizedString(@"AUTOTYPE_MESSAGE_UNLOCK_DATABASE", @"Message displayed to the user to unlock the database to perform global autotype")];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didUnlockDatabase:) name:MPDocumentDidUnlockDatabaseNotification object:nil];
return; // wait for the unlock to happen
}