aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2018-02-23 00:52:44 +0100
committerMax <post@wickenrode.com>2018-02-23 00:52:44 +0100
commitfcb696ae383149f0abfb88a9d4b2ae21d91f3c3b (patch)
tree51bcefdf3fe216baf603749587e3df3f78ac2b1e /Source
parent3a944d7867c750c29e02e2619d72694bdbfb0b2a (diff)
downloadsequelpro-fcb696ae383149f0abfb88a9d4b2ae21d91f3c3b.tar.gz
sequelpro-fcb696ae383149f0abfb88a9d4b2ae21d91f3c3b.tar.bz2
sequelpro-fcb696ae383149f0abfb88a9d4b2ae21d91f3c3b.zip
Replace getter/setter glue with property
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.h5
-rw-r--r--Source/SPDatabaseDocument.m26
2 files changed, 8 insertions, 23 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index de7dd55e..36269e73 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -262,7 +262,7 @@
NSMutableArray *runningActivitiesArray;
#endif
- NSString *keyChainID;
+ NSString *keychainID;
#ifndef SP_CODA /* ivars */
NSThread *printThread;
@@ -342,7 +342,7 @@
#endif
- (void)setConnection:(SPMySQLConnection *)theConnection;
- (SPMySQLConnection *)getConnection;
-- (void)setKeychainID:(NSString *)theID;
+@property(readwrite, copy, nonatomic) NSString *keychainID;
// Database methods
- (IBAction)setDatabases:(id)sender;
@@ -451,7 +451,6 @@
- (NSString *)port;
- (NSString *)mySQLVersion;
- (NSString *)user;
-- (NSString *)keyChainID;
- (NSString *)connectionID;
#ifndef SP_CODA /* method decls */
- (NSString *)tabTitleForTooltip;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 7b1d51de..ccf1cb34 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -136,6 +136,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
@synthesize processID;
@synthesize instanceId;
@synthesize dbTablesTableView = dbTablesTableView;
+@synthesize keychainID = keychainID;
#pragma mark -
@@ -218,8 +219,6 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
alterDatabaseCharsetHelper = nil; //init in awakeFromNib
addDatabaseCharsetHelper = nil;
- keyChainID = nil;
-
#ifndef SP_CODA /* init ivars */
statusValues = nil;
printThread = nil;
@@ -613,14 +612,6 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
return mySQLConnection;
}
-/**
- * Sets this connection's Keychain ID.
- */
-- (void)setKeychainID:(NSString *)theId
-{
- keyChainID = [[NSString stringWithString:theId] retain];
-}
-
#pragma mark -
#pragma mark Database methods
@@ -2863,11 +2854,6 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
return thePort;
}
-- (NSString *)keyChainID
-{
- return keyChainID;
-}
-
- (BOOL)isSaveInBundle
{
return _isSavedInBundle;
@@ -4674,7 +4660,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
}
[connection setObject:connectionType forKey:@"type"];
- if ([[self keyChainID] length]) [connection setObject:[self keyChainID] forKey:@"kcid"];
+ if ([[self keychainID] length]) [connection setObject:[self keychainID] forKey:@"kcid"];
[connection setObject:[self name] forKey:@"name"];
[connection setObject:[self host] forKey:@"host"];
[connection setObject:[self user] forKey:@"user"];
@@ -4877,7 +4863,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
// Set the keychain details if available
if ([connection objectForKey:@"kcid"] && [(NSString *)[connection objectForKey:@"kcid"] length]) {
[self setKeychainID:[connection objectForKey:@"kcid"]];
- [connectionController setConnectionKeychainItemName:[keychain nameForFavoriteName:[connectionController name] id:[self keyChainID]]];
+ [connectionController setConnectionKeychainItemName:[keychain nameForFavoriteName:[connectionController name] id:[self keychainID]]];
[connectionController setConnectionKeychainItemAccount:[keychain accountForUser:[connectionController user] host:[connectionController host] database:[connection objectForKey:@"database"]]];
}
@@ -4910,7 +4896,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
[connectionController setSshPassword:[connection objectForKey:@"ssh_password"]];
else {
if ([connection objectForKey:@"kcid"] && [(NSString *)[connection objectForKey:@"kcid"] length]) {
- [connectionController setConnectionSSHKeychainItemName:[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keyChainID]]];
+ [connectionController setConnectionSSHKeychainItemName:[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keychainID]]];
[connectionController setConnectionSSHKeychainItemAccount:[keychain accountForSSHUser:[connectionController sshUser] sshHost:[connectionController sshHost]]];
}
NSString *sshpw = [self keychainPasswordForSSHConnection:nil];
@@ -7184,7 +7170,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
// Otherwise, pull the password from the keychain using the details from this connection
SPKeychain *keychain = [[SPKeychain alloc] init];
- NSString *connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keyChainID]] retain];
+ NSString *connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keychainID]] retain];
NSString *connectionSSHKeychainItemAccount = [[keychain accountForSSHUser:[connectionController sshUser] sshHost:[connectionController sshHost]] retain];
NSString *sshPassword = [keychain getPasswordForName:connectionSSHKeychainItemName account:connectionSSHKeychainItemAccount];
@@ -7760,7 +7746,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
if (spfPreferences) SPClear(spfPreferences);
if (spfSession) SPClear(spfSession);
if (spfDocData) SPClear(spfDocData);
- if (keyChainID) SPClear(keyChainID);
+ [self setKeychainID:nil];
if (mainToolbar) SPClear(mainToolbar);
if (titleAccessoryView) SPClear(titleAccessoryView);
if (taskProgressWindow) SPClear(taskProgressWindow);