diff options
author | abhibeckert <abhi@abhibeckert.com> | 2008-04-22 03:51:20 +0000 |
---|---|---|
committer | abhibeckert <abhi@abhibeckert.com> | 2008-04-22 03:51:20 +0000 |
commit | 6e35faaaa9d7c9059c1a104e0c4362decc1b23f9 (patch) | |
tree | 140da723d79a9b8c8e24c86036e2b0f424b2b990 | |
parent | b290f9366a9d85b00c56501c67dacfbf5726303f (diff) | |
download | sequelpro-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
-rw-r--r-- | English.lproj/DBView.nib/classes.nib | 2 | ||||
-rw-r--r-- | English.lproj/DBView.nib/info.nib | 1 | ||||
-rw-r--r-- | English.lproj/DBView.nib/keyedobjects.nib | bin | 154190 -> 153799 bytes | |||
-rw-r--r-- | TableDocument.h | 1 | ||||
-rw-r--r-- | TableDocument.m | 32 |
5 files changed, 29 insertions, 7 deletions
diff --git a/English.lproj/DBView.nib/classes.nib b/English.lproj/DBView.nib/classes.nib index bfc58dc7..cff2692b 100644 --- a/English.lproj/DBView.nib/classes.nib +++ b/English.lproj/DBView.nib/classes.nib @@ -511,6 +511,8 @@ <string>id</string> <key>chooseTableOperationButton</key> <string>id</string> + <key>connectAddToFavoritesCheckbox</key> + <string>NSButton</string> <key>connectProgressBar</key> <string>id</string> <key>connectProgressStatusText</key> diff --git a/English.lproj/DBView.nib/info.nib b/English.lproj/DBView.nib/info.nib index e7b8303d..b1d2945b 100644 --- a/English.lproj/DBView.nib/info.nib +++ b/English.lproj/DBView.nib/info.nib @@ -11,7 +11,6 @@ <key>IBOpenObjects</key> <array> <integer>2268</integer> - <integer>675</integer> </array> <key>IBSystem Version</key> <string>9C7010</string> diff --git a/English.lproj/DBView.nib/keyedobjects.nib b/English.lproj/DBView.nib/keyedobjects.nib Binary files differindex 71093888..c4877c4a 100644 --- a/English.lproj/DBView.nib/keyedobjects.nib +++ b/English.lproj/DBView.nib/keyedobjects.nib diff --git a/TableDocument.h b/TableDocument.h index 95eda92c..ee7aab67 100644 --- a/TableDocument.h +++ b/TableDocument.h @@ -56,6 +56,7 @@ IBOutlet id portField; IBOutlet id databaseField; + IBOutlet NSButton *connectAddToFavoritesCheckbox; IBOutlet id connectProgressBar; IBOutlet id connectProgressStatusText; IBOutlet id databaseNameField; 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]; } |