mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 12:52:21 +00:00
Fixed regression in reopening documents introduced in previous commit
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
|
||||
@property (strong) IBOutlet NSWindow *welcomeWindow;
|
||||
|
||||
- (IBAction)showPreferences:(id)sender;
|
||||
- (IBAction)showPasswordCreator:(id)sender;
|
||||
- (IBAction)createNewDatabase:(id)sender;
|
||||
- (IBAction)openDatabase:(id)sender;
|
||||
|
||||
@@ -24,15 +24,13 @@
|
||||
MPServerDaemon *serverDaemon;
|
||||
MPLockDaemon *lockDaemon;
|
||||
MPAutotypeDaemon *autotypeDaemon;
|
||||
BOOL _restoredWindows;
|
||||
BOOL _shouldOpenFile;
|
||||
BOOL _restoredWindows; // YES if windows where restored at launch
|
||||
BOOL _shouldOpenFile; // YES if app was started to open a
|
||||
}
|
||||
|
||||
@property (strong, nonatomic) MPSettingsWindowController *settingsController;
|
||||
@property (strong, nonatomic) MPPasswordCreatorViewController *passwordCreatorController;
|
||||
|
||||
- (IBAction)showPreferences:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPAppDelegate
|
||||
@@ -68,16 +66,14 @@
|
||||
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
|
||||
BOOL reopen = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch];
|
||||
_restoredWindows = NO;
|
||||
_shouldOpenFile = NO;
|
||||
if(reopen) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_applicationDidFinishRestoringWindows:)
|
||||
name:NSApplicationDidFinishRestoringWindowsNotification
|
||||
object:nil];
|
||||
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_applicationDidFinishRestoringWindows:)
|
||||
name:NSApplicationDidFinishRestoringWindowsNotification
|
||||
object:nil];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
|
||||
@@ -93,7 +89,7 @@
|
||||
autotypeDaemon = [[MPAutotypeDaemon alloc] init];
|
||||
|
||||
BOOL reopen = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch];
|
||||
BOOL showWelcomeScreen = !_shouldOpenFile;
|
||||
BOOL showWelcomeScreen = !_restoredWindows && !_shouldOpenFile;
|
||||
if(reopen && !_restoredWindows && !_shouldOpenFile) {
|
||||
showWelcomeScreen = ![self _reopenLastDocument];
|
||||
}
|
||||
@@ -162,7 +158,6 @@
|
||||
if(!_welcomeWindow) {
|
||||
NSArray *topLevelObject;
|
||||
[[NSBundle mainBundle] loadNibNamed:@"WelcomeWindow" owner:self topLevelObjects:&topLevelObject];
|
||||
//CFRelease((__bridge CFTypeRef)_welcomeWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user