diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-08-23 23:14:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-08-23 23:14:00 +0000 |
commit | b02932c07c4fdbf5b8c051c5a7218c4c37cf4bf2 (patch) | |
tree | 0967f072a8d1a8c7c07874161c44183b50f5e2a7 /Source | |
parent | 528324fa17bb76bf590cfc17c9b436de660d5ed3 (diff) | |
download | sequelpro-b02932c07c4fdbf5b8c051c5a7218c4c37cf4bf2.tar.gz sequelpro-b02932c07c4fdbf5b8c051c5a7218c4c37cf4bf2.tar.bz2 sequelpro-b02932c07c4fdbf5b8c051c5a7218c4c37cf4bf2.zip |
• add accessory view for Save Connection
- options:
-- Include session data (selected table, queries, status, etc.)
-- Save passwords + Encrypt SPF file with password for safety reasons
Note: SP gives this warning in the Console:
NSSecureTextFieldCell detected a field editor (_NSSavePanelTextView) that is not a NSTextView subclass designed to work with the cell. Ignoring...
Why?
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableDocument.h | 8 | ||||
-rw-r--r-- | Source/TableDocument.m | 37 |
2 files changed, 44 insertions, 1 deletions
diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 130e061e..17de1f03 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -92,6 +92,12 @@ IBOutlet NSWindow *createTableSyntaxWindow; IBOutlet NSWindow *connectionErrorDialog; + IBOutlet id saveConnectionAccessory; + IBOutlet id saveConnectionIncludeData; + IBOutlet id saveConnectionSavePassword; + IBOutlet id saveConnectionEncrypt; + IBOutlet NSSecureTextField *saveConnectionEncryptString; + SPConnectionController *connectionController; SPUserManager *userManagerInstance; @@ -176,7 +182,7 @@ - (NSWindow *)getCreateTableSyntaxWindow; - (void) refreshCurrentDatabase; - (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo; - +- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender; // Getter methods - (NSString *)name; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 86e61f30..a6b4caae 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1746,6 +1746,13 @@ // Save current session (open connection windows as SPF file) // [panel setMessage:NSLocalizedString(@"Save Sequel Pro session", @"Save Sequel Pro session")]; [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]]; + [saveConnectionEncryptString setDelegate:self]; + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setEnabled:NO]; + [saveConnectionSavePassword setState:NSOffState]; + [self saveConnectionAccessoryPasswordButton:nil]; + [panel setAccessoryView:saveConnectionAccessory]; filename = [NSString stringWithFormat:@"%@", [self name]]; contextInfo = @"saveSPFfile"; @@ -1760,6 +1767,36 @@ didEndSelector:@selector(saveConnectionPanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo]; } +/** + * Control the save connection panel's encrypt checkbox and text field + • if user changed the status of "Save passwords" and "Encrypt" resp. + */ +- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender +{ + + if([saveConnectionSavePassword state] == NSOnState) { + [saveConnectionEncrypt setEnabled:YES]; + if([saveConnectionEncrypt state] == NSOnState) { + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString selectText:nil]; + } else { + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setHidden:YES]; + [saveConnectionEncryptString setHidden:NO]; + [saveConnectionEncryptString setEnabled:NO]; + } + } else { + [saveConnectionEncrypt setEnabled:NO]; + [saveConnectionEncryptString setEnabled:YES]; + [saveConnectionEncryptString setStringValue:@""]; + [saveConnectionEncryptString setHidden:YES]; + [saveConnectionEncryptString setHidden:NO]; + [saveConnectionEncryptString setEnabled:NO]; + } + +} + - (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo { |