From f5a99e49839174bdfa2364fbba1c963da4a3481b Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 8 Feb 2011 21:02:48 +0000 Subject: When the user cancels the SSH password prompt, prevent further prompts and also suppress the error detail dialog. Fixes issue #975. --- Source/SPConnectionController.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Source/SPConnectionController.m') diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index c521213c..41f44a1d 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -382,16 +382,28 @@ - (void)sshTunnelCallback:(SPSSHTunnel *)theTunnel { if (cancellingConnection) return; + NSInteger newState = [theTunnel state]; + + // If the user cancelled the password prompt dialog + if ([theTunnel passwordPromptCancelled]) { + [self _restoreConnectionInterface]; + + return; + } if (newState == PROXY_STATE_IDLE) { [tableDocument setTitlebarStatus:NSLocalizedString(@"SSH Disconnected", @"SSH disconnected titlebar marker")]; + [self failConnectionWithTitle:NSLocalizedString(@"SSH connection failed!", @"SSH connection failed title") errorMessage:[theTunnel lastError] detail:[sshTunnel debugMessages]]; [self _restoreConnectionInterface]; - } else if (newState == PROXY_STATE_CONNECTED) { + } + else if (newState == PROXY_STATE_CONNECTED) { [tableDocument setTitlebarStatus:NSLocalizedString(@"SSH Connected", @"SSH connected titlebar marker")]; + [self initiateMySQLConnection]; - } else { + } + else { [tableDocument setTitlebarStatus:NSLocalizedString(@"SSH Connecting…", @"SSH connecting titlebar marker")]; } } -- cgit v1.2.3