aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-10-06 15:40:05 +0000
committerstuconnolly <stuart02@gmail.com>2010-10-06 15:40:05 +0000
commitc42b7483546e0cdfa1dd82cdda1d18313e6af111 (patch)
tree9bd8b4987def2c078506e7d9a36cbd33aef5ab2e /Source
parent294af53678cda18e5f6e5f2007daa0893c1250d0 (diff)
downloadsequelpro-c42b7483546e0cdfa1dd82cdda1d18313e6af111.tar.gz
sequelpro-c42b7483546e0cdfa1dd82cdda1d18313e6af111.tar.bz2
sequelpro-c42b7483546e0cdfa1dd82cdda1d18313e6af111.zip
When the user cancels a conenction attempt, which subsequently results in an error, don't bother displaying the error sheet. Also, disable the 'cancel' connection button once pressed.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.m16
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index baa09262..44b35d8d 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -306,6 +306,8 @@
*/
- (IBAction)cancelMySQLConnection:(id)sender
{
+ [connectButton setEnabled:NO];
+
[progressIndicatorText setStringValue:NSLocalizedString(@"Cancelling...", @"cancelling task status message")];
[progressIndicatorText display];
@@ -354,11 +356,14 @@
* Currently only cleans up the SSH connection (MySQL connection isn't threaded)
*/
- (void)cancelConnection
-{
+{
if (!sshTunnel) return;
+
cancellingConnection = YES;
+
[sshTunnel disconnect];
[sshTunnel release];
+
sshTunnel = nil;
}
@@ -442,8 +447,9 @@
[delegate connectionControllerConnectAttemptFailed:self];
}
- // Only display the connection error message if there is a window visible
- if ([[tableDocument parentWindow] isVisible]) {
+ // Only display the connection error message if there is a window visible and the connection attempt
+ // wasn't cancelled even though it failed.
+ if ([[tableDocument parentWindow] isVisible] && (!mySQLConnectionCancelled)) {
SPBeginAlertSheet(theTitle, NSLocalizedString(@"OK", @"OK button"), (errorDetail) ? NSLocalizedString(@"Show Detail", @"Show detail button") : nil, (isSSHTunnelBindError) ? NSLocalizedString(@"Use Standard Connection", @"use standard connection button") : nil, [tableDocument parentWindow], self, @selector(connectionFailureSheetDidEnd:returnCode:contextInfo:), @"connect", theErrorMessage);
}
}
@@ -453,7 +459,6 @@
*/
- (void)connectionFailureSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
-
// Restore the passwords from keychain for editing if appropriate
if (connectionKeychainItemName) {
[self setPassword:[keychain getPasswordForName:connectionKeychainItemName account:connectionKeychainItemAccount]];
@@ -1322,6 +1327,9 @@
// Must be performed on the main thread
if (![NSThread isMainThread]) return [[self onMainThread] _restoreConnectionInterface];
+ // Reset the window title
+ [[tableDocument parentWindow] setTitle:[tableDocument displayName]];
+
// Stop the current tab's progress indicator
[tableDocument setIsProcessing:NO];