Welcome window now displays a list of recent documents.

also the window now gets closed when a document is loaded
This commit is contained in:
Michael Starke
2018-09-28 16:49:11 +02:00
parent 5aacbc66fe
commit 66118d50c3
19 changed files with 319 additions and 160 deletions

View File

@@ -39,6 +39,7 @@
#import "MPTemporaryFileStorageCenter.h"
#import "MPValueTransformerHelper.h"
#import "MPUserNotificationCenterDelegate.h"
#import "MPWelcomeViewController.h"
#import "NSApplication+MPAdditions.h"
@@ -55,6 +56,8 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
BOOL _shouldOpenFile; // YES if app was started to open a
}
@property (strong) NSWindow *welcomeWindow;
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
@property (strong, nonatomic) MPSettingsWindowController *settingsController;
@property (strong, nonatomic) MPPasswordCreatorViewController *passwordCreatorController;
@@ -249,10 +252,25 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
}
- (void)showWelcomeWindow {
[self _loadWelcomeWindow];
if(!self.welcomeWindow) {
self.welcomeWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable
backing:NSBackingStoreBuffered
defer:NO];
self.welcomeWindow.releasedWhenClosed = NO;
}
if(!self.welcomeWindow.contentViewController) {
self.welcomeWindow.contentViewController = [[MPWelcomeViewController alloc] init];
}
[self.welcomeWindow center];
[self.welcomeWindow makeKeyAndOrderFront:nil];
}
- (void)hideWelcomeWindow {
[self.welcomeWindow orderOut:nil];
}
- (void)clearRememberdKeyFiles:(id)sender {
[NSUserDefaults.standardUserDefaults removeObjectForKey:kMPSettingsKeyRememeberdKeysForDatabases];
}
@@ -296,11 +314,4 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
}
}
- (void)_loadWelcomeWindow {
if(!_welcomeWindow) {
NSArray *topLevelObject;
[NSBundle.mainBundle loadNibNamed:@"WelcomeWindow" owner:self topLevelObjects:&topLevelObject];
}
}
@end