diff options
author | abhibeckert <abhi@abhibeckert.com> | 2008-04-19 12:23:31 +0000 |
---|---|---|
committer | abhibeckert <abhi@abhibeckert.com> | 2008-04-19 12:23:31 +0000 |
commit | 485786d0f7013996f35a0737fb6f2de37afcfae3 (patch) | |
tree | d010623af97f09e5666c22826a014bfec546f60a /TableDocument.m | |
parent | 195bc36ff2e7115fc819504b142c52d3c70fe632 (diff) | |
download | sequelpro-485786d0f7013996f35a0737fb6f2de37afcfae3.tar.gz sequelpro-485786d0f7013996f35a0737fb6f2de37afcfae3.tar.bz2 sequelpro-485786d0f7013996f35a0737fb6f2de37afcfae3.zip |
redesign connect sheet
Diffstat (limited to 'TableDocument.m')
-rw-r--r-- | TableDocument.m | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/TableDocument.m b/TableDocument.m index 0beb77c4..b1e1f66a 100644 --- a/TableDocument.m +++ b/TableDocument.m @@ -153,8 +153,6 @@ alert-sheets when no success } } - -- (IBAction)connect:(id)sender /* invoked when user hits the connect-button of the connectSheet stops modal session with code: @@ -163,39 +161,43 @@ stops modal session with code: 3 when no connection to db 4 when hostField and socketField are empty */ +- (IBAction)connect:(id)sender { - int code; - - [connectProgressBar startAnimation:self]; - - code = 0; - if ( [[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""] ) { - code = 4; + int code; + + [connectProgressBar startAnimation:self]; + [connectProgressStatusText setHidden:NO]; + [connectProgressStatusText display]; + + code = 0; + if ( [[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""] ) { + code = 4; + } else { + if ( ![[socketField stringValue] isEqualToString:@""] ) { + //connect to socket + mySQLConnection = [[CMMCPConnection alloc] initToSocket:[socketField stringValue] + withLogin:[userField stringValue] + password:[passwordField stringValue]]; + [hostField setStringValue:@"localhost"]; } else { - if ( ![[socketField stringValue] isEqualToString:@""] ) { - //connect to socket - mySQLConnection = [[CMMCPConnection alloc] initToSocket:[socketField stringValue] - withLogin:[userField stringValue] - password:[passwordField stringValue]]; - [hostField setStringValue:@"localhost"]; - } else { - //connect to host - mySQLConnection = [[CMMCPConnection alloc] initToHost:[hostField stringValue] - withLogin:[userField stringValue] - password:[passwordField stringValue] - usingPort:[portField intValue]]; - } - if ( ![mySQLConnection isConnected] ) - code = 2; - if ( !code && ![[databaseField stringValue] isEqualToString:@""] ) - if ( ![mySQLConnection selectDB:[databaseField stringValue]] ) - code = 3; - if ( !code ) - code = 1; + //connect to host + mySQLConnection = [[CMMCPConnection alloc] initToHost:[hostField stringValue] + withLogin:[userField stringValue] + password:[passwordField stringValue] + usingPort:[portField intValue]]; } - [NSApp stopModalWithCode:code]; - - [connectProgressBar stopAnimation:self]; + if ( ![mySQLConnection isConnected] ) + code = 2; + if ( !code && ![[databaseField stringValue] isEqualToString:@""] ) + if ( ![mySQLConnection selectDB:[databaseField stringValue]] ) + code = 3; + if ( !code ) + code = 1; + } + [NSApp stopModalWithCode:code]; + + [connectProgressBar stopAnimation:self]; + [connectProgressStatusText setHidden:YES]; } - (IBAction)closeSheet:(id)sender |