aboutsummaryrefslogtreecommitdiffstats
path: root/TableDocument.m
diff options
context:
space:
mode:
authorabhibeckert <abhi@abhibeckert.com>2008-04-22 03:51:20 +0000
committerabhibeckert <abhi@abhibeckert.com>2008-04-22 03:51:20 +0000
commit6e35faaaa9d7c9059c1a104e0c4362decc1b23f9 (patch)
tree140da723d79a9b8c8e24c86036e2b0f424b2b990 /TableDocument.m
parentb290f9366a9d85b00c56501c67dacfbf5726303f (diff)
downloadsequelpro-6e35faaaa9d7c9059c1a104e0c4362decc1b23f9.tar.gz
sequelpro-6e35faaaa9d7c9059c1a104e0c4362decc1b23f9.tar.bz2
sequelpro-6e35faaaa9d7c9059c1a104e0c4362decc1b23f9.zip
Issue #8 completed - when the connect panel's "Add to favorites" checkbox is selected, the connection details will be added as a new favourite
Diffstat (limited to 'TableDocument.m')
-rw-r--r--TableDocument.m32
1 files changed, 26 insertions, 6 deletions
diff --git a/TableDocument.m b/TableDocument.m
index 753476a5..00daedb4 100644
--- a/TableDocument.m
+++ b/TableDocument.m
@@ -101,9 +101,6 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
} else {
[self setEncoding:[self mysqlEncodingFromDisplayEncoding:encodingName]];
}
- // get selected db
- if ( ![[databaseField stringValue] isEqualToString:@""] )
- selectedDatabase = [[databaseField stringValue] retain];
//get mysql version
// theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE \"version\""];
theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'version'"];
@@ -166,6 +163,9 @@ stops modal session with code:
[connectProgressStatusText setHidden:NO];
[connectProgressStatusText display];
+ [selectedDatabase autorelease];
+ selectedDatabase = nil;
+
code = 0;
if ( [[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""] ) {
code = 4;
@@ -185,14 +185,34 @@ stops modal session with code:
}
if ( ![mySQLConnection isConnected] )
code = 2;
- if ( !code && ![[databaseField stringValue] isEqualToString:@""] )
- if ( ![mySQLConnection selectDB:[databaseField stringValue]] )
+ if ( !code && ![[databaseField stringValue] isEqualToString:@""] ) {
+ if ([mySQLConnection selectDB:[databaseField stringValue]]) {
+ selectedDatabase = [[databaseField stringValue] retain];
+ } else {
code = 3;
+ }
+ }
if ( !code )
code = 1;
}
- [NSApp stopModalWithCode:code];
+ // save to favorites?
+ if ([connectAddToFavoritesCheckbox state] == NSOnState) {
+ [self addToFavoritesHost:[hostField stringValue]
+ socket:[socketField stringValue]
+ user:[userField stringValue]
+ password:[passwordField stringValue]
+ port:[portField stringValue]
+ database:[databaseField stringValue]
+ useSSH:NO
+ sshHost:nil
+ sshUser:nil
+ sshPassword:nil
+ sshPort:nil];
+ }
+
+ // close sheet
+ [NSApp stopModalWithCode:code];
[connectProgressBar stopAnimation:self];
[connectProgressStatusText setHidden:YES];
}