diff options
author | rowanbeentje <rowan@beent.je> | 2012-06-23 13:37:16 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-06-23 13:37:16 +0000 |
commit | efaf41faf367c778185545f0d47b02dee5424c4e (patch) | |
tree | d25da49d315382845e5318b4657e6f605100c6d7 /Source/SPAppController.m | |
parent | 7d06e2efcc6874ac0a605920fdd62ec8cc433602 (diff) | |
download | sequelpro-efaf41faf367c778185545f0d47b02dee5424c4e.tar.gz sequelpro-efaf41faf367c778185545f0d47b02dee5424c4e.tar.bz2 sequelpro-efaf41faf367c778185545f0d47b02dee5424c4e.zip |
- Fix issues opening new windows when Sequel Pro is opened in the background, eg as a result of an application quarantine dialog. This addresses Issue #1375.
- Fix exceptions and multiple errors when opening locked or encrypted session files where opening is cancelled.
Diffstat (limited to 'Source/SPAppController.m')
-rw-r--r-- | Source/SPAppController.m | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m index ca5887c9..fa9dbc4a 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -134,6 +134,15 @@ YY_BUFFER_STATE yy_scan_string (const char *); [self reloadBundles:self]; + // If no documents are open, open one + if (![self frontDocument]) { + [self newWindow:self]; + + // Set autoconnection if appropriate + if ([[NSUserDefaults standardUserDefaults] boolForKey:SPAutoConnectToDefault]) { + [[self frontDocument] connect]; + } + } } /** @@ -447,7 +456,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); [newWindowController addNewConnection:self]; [[self frontDocument] setIsSavedInBundle:isBundleFile]; - [[self frontDocument] setStateFromConnectionFile:fileName]; + if (![[self frontDocument] setStateFromConnectionFile:fileName]) { + break; + } } } else { @@ -2083,24 +2094,6 @@ YY_BUFFER_STATE yy_scan_string (const char *); #pragma mark Other methods /** - * Override the default open-blank-document methods to automatically connect automatically opened windows - * if the preference is set - */ -- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender -{ - // Manually open a table document - [self newWindow:self]; - - // Set autoconnection if appropriate - if ([[NSUserDefaults standardUserDefaults] boolForKey:SPAutoConnectToDefault]) { - [[self frontDocument] connect]; - } - - // Return NO to the automatic opening - return NO; -} - -/** * Implement this method to prevent the above being called in the case of a reopen (for example, clicking * the dock icon) where we don't want the auto-connect to kick in. */ |