diff options
-rw-r--r-- | English.lproj/DBView.nib/classes.nib | 2 | ||||
-rw-r--r-- | English.lproj/DBView.nib/keyedobjects.nib | bin | 169967 -> 167973 bytes | |||
-rw-r--r-- | TableDocument.h | 102 | ||||
-rw-r--r-- | TableDocument.m | 66 |
4 files changed, 87 insertions, 83 deletions
diff --git a/English.lproj/DBView.nib/classes.nib b/English.lproj/DBView.nib/classes.nib index f3a8fa90..30a1f5c9 100644 --- a/English.lproj/DBView.nib/classes.nib +++ b/English.lproj/DBView.nib/classes.nib @@ -509,6 +509,8 @@ <string>id</string> <key>connectProgressBar</key> <string>id</string> + <key>connectProgressStatusText</key> + <string>id</string> <key>connectSheet</key> <string>id</string> <key>consoleDrawer</key> diff --git a/English.lproj/DBView.nib/keyedobjects.nib b/English.lproj/DBView.nib/keyedobjects.nib Binary files differindex cced002a..28bcf518 100644 --- a/English.lproj/DBView.nib/keyedobjects.nib +++ b/English.lproj/DBView.nib/keyedobjects.nib diff --git a/TableDocument.h b/TableDocument.h index 0a870d47..afb3a489 100644 --- a/TableDocument.h +++ b/TableDocument.h @@ -30,60 +30,60 @@ @interface TableDocument : NSDocument { - -//IBOutlets - IBOutlet id keyChainInstance; - IBOutlet id tablesListInstance; - IBOutlet id tableSourceInstance; - IBOutlet id tableContentInstance; - IBOutlet id customQueryInstance; - IBOutlet id tableDumpInstance; - IBOutlet id tableStatusInstance; - - IBOutlet id tableWindow; - IBOutlet id connectSheet; - IBOutlet id databaseSheet; - IBOutlet id variablesSheet; - IBOutlet id createTableSyntaxSheet; - IBOutlet id tableOperationsSheet; - IBOutlet id consoleDrawer; - - IBOutlet id queryProgressBar; - IBOutlet id favoritesButton; - IBOutlet NSArrayController *favoritesController; - IBOutlet id hostField; - IBOutlet id socketField; - IBOutlet id userField; - IBOutlet id passwordField; - IBOutlet id portField; - IBOutlet id databaseField; - + //IBOutlets + IBOutlet id keyChainInstance; + IBOutlet id tablesListInstance; + IBOutlet id tableSourceInstance; + IBOutlet id tableContentInstance; + IBOutlet id customQueryInstance; + IBOutlet id tableDumpInstance; + IBOutlet id tableStatusInstance; + + IBOutlet id tableWindow; + IBOutlet id connectSheet; + IBOutlet id databaseSheet; + IBOutlet id variablesSheet; + IBOutlet id createTableSyntaxSheet; + IBOutlet id tableOperationsSheet; + IBOutlet id consoleDrawer; + + IBOutlet id queryProgressBar; + IBOutlet id favoritesButton; + IBOutlet NSArrayController *favoritesController; + IBOutlet id hostField; + IBOutlet id socketField; + IBOutlet id userField; + IBOutlet id passwordField; + IBOutlet id portField; + IBOutlet id databaseField; + IBOutlet id sshCheckbox; - IBOutlet id sshUserField; - IBOutlet id sshPasswordField; - IBOutlet id sshHostField; - IBOutlet id sshPortField; - - IBOutlet id connectProgressBar; - IBOutlet id databaseNameField; - IBOutlet id chooseDatabaseButton; - IBOutlet id consoleTextView; - IBOutlet id variablesTableView; - IBOutlet id createTableSyntaxView; - IBOutlet id chooseEncodingButton; - IBOutlet id chooseTableOperationButton; - IBOutlet NSTabView *tableTabView; - - CMMCPConnection *mySQLConnection; + IBOutlet id sshUserField; + IBOutlet id sshPasswordField; + IBOutlet id sshHostField; + IBOutlet id sshPortField; + + IBOutlet id connectProgressBar; + IBOutlet id connectProgressStatusText; + IBOutlet id databaseNameField; + IBOutlet id chooseDatabaseButton; + IBOutlet id consoleTextView; + IBOutlet id variablesTableView; + IBOutlet id createTableSyntaxView; + IBOutlet id chooseEncodingButton; + IBOutlet id chooseTableOperationButton; + IBOutlet NSTabView *tableTabView; + + CMMCPConnection *mySQLConnection; SSHTunnel *tunnel; - - NSArray *favorites; - NSArray *variables; - NSString *selectedDatabase; - NSString *selectedFavorite; - NSString *mySQLVersion; - NSUserDefaults *prefs; + + NSArray *favorites; + NSArray *variables; + NSString *selectedDatabase; + NSString *selectedFavorite; + NSString *mySQLVersion; + NSUserDefaults *prefs; } //start sheet 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 |