aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/TableDocument.h8
-rw-r--r--Source/TableDocument.m37
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
{