Using NSViewController presentation instead of manual NSPopup creation

This commit is contained in:
Michael Starke
2018-11-05 17:36:32 +01:00
parent d6b95118da
commit 1ed35a6eab
10 changed files with 40 additions and 95 deletions

View File

@@ -233,13 +233,19 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
- (void)showPasswordCreator:(id)sender {
if(!self.passwordCreatorWindow) {
[NSBundle.mainBundle loadNibNamed:@"PasswordCreatorWindow"owner:self topLevelObjects:nil];
self.passwordCreatorWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable
backing:NSBackingStoreBuffered
defer:NO];
self.passwordCreatorWindow.releasedWhenClosed = NO;
self.passwordCreatorWindow.title = NSLocalizedString(@"PASSWORD_CREATOR_WINDOW_TITLE", @"Window title for the stand-alone password creator window");
}
if(!self.passwordCreatorController) {
self.passwordCreatorController = [[MPPasswordCreatorViewController alloc] init];
self.passwordCreatorWindow.contentViewController = self.passwordCreatorController;
}
[self.passwordCreatorController reset];
[self.passwordCreatorWindow center];
[self.passwordCreatorWindow makeKeyAndOrderFront:self.passwordCreatorWindow];
}