aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-01-10 00:51:27 +0000
committerrowanbeentje <rowan@beent.je>2011-01-10 00:51:27 +0000
commit870da55b26764076d657ef9625e8798f538304cd (patch)
tree0dca1ba7605618d9fcacc3bf58fefcf60513b522 /Source/SPConnectionController.m
parenta445243c4c9140556b66c8d529c1531011774911 (diff)
downloadsequelpro-870da55b26764076d657ef9625e8798f538304cd.tar.gz
sequelpro-870da55b26764076d657ef9625e8798f538304cd.tar.bz2
sequelpro-870da55b26764076d657ef9625e8798f538304cd.zip
- Track the keychain ID of the favourite in the connection controller, fixing errors when amending favourites in the connection view and thereafter saving as .spf or duplicating connections
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r--Source/SPConnectionController.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 3558d484..c521213c 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -89,6 +89,7 @@
tableDocument = theTableDocument;
databaseConnectionSuperview = [tableDocument databaseView];
databaseConnectionView = [tableDocument valueForKey:@"contentViewSplitter"];
+ connectionKeychainID = nil;
connectionKeychainItemName = nil;
connectionKeychainItemAccount = nil;
connectionSSHKeychainItemName = nil;
@@ -173,6 +174,7 @@
if (favorites) [favorites release];
if (mySQLConnection) [mySQLConnection release];
if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], [sshTunnel disconnect], [sshTunnel release];
+ if (connectionKeychainID) [connectionKeychainID release];
if (connectionKeychainItemName) [connectionKeychainItemName release];
if (connectionKeychainItemAccount) [connectionKeychainItemAccount release];
if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release];
@@ -512,9 +514,7 @@
for (NSInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES];
// Set keychain id for saving SPF files
- if ([self valueForKeyPath:@"selectedFavorite.id"]) {
- [tableDocument setKeychainID:[[self valueForKeyPath:@"selectedFavorite.id"] stringValue]];
- }
+ if (connectionKeychainID) [tableDocument setKeychainID:connectionKeychainID];
// Pass the connection to the table document, allowing it to set
// up the other classes and the rest of the interface.
@@ -884,6 +884,7 @@
automaticFavoriteSelection = YES;
// Clear the keychain referral items as appropriate
+ if (connectionKeychainID) [connectionKeychainID release], connectionKeychainID = nil;
if (connectionKeychainItemName) [connectionKeychainItemName release], connectionKeychainItemName = nil;
if (connectionKeychainItemAccount) [connectionKeychainItemAccount release], connectionKeychainItemAccount = nil;
if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release], connectionSSHKeychainItemName = nil;
@@ -933,6 +934,8 @@
[connectionKeychainItemAccount release], connectionKeychainItemAccount = nil;
}
+ if ([self valueForKeyPath:@"selectedFavorite.id"]) connectionKeychainID = [[[self valueForKeyPath:@"selectedFavorite.id"] stringValue] retain];
+
// And the same for the SSH password
connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[self valueForKeyPath:@"selectedFavorite.name"] id:[self valueForKeyPath:@"selectedFavorite.id"]] retain];
connectionSSHKeychainItemAccount = [[keychain accountForSSHUser:[self valueForKeyPath:@"selectedFavorite.sshUser"] sshHost:[self valueForKeyPath:@"selectedFavorite.sshHost"]] retain];