diff options
author | rowanbeentje <rowan@beent.je> | 2011-09-10 16:55:17 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-09-10 16:55:17 +0000 |
commit | a0743aaf9e8e3d9151fb7acf4b1c6da06338be88 (patch) | |
tree | 92919e09c12b4b78c494c7e7c6137209e03c1e88 /Source/SPConnectionController.m | |
parent | 752b2b576a307130d5f698beed67ccae5c96b166 (diff) | |
download | sequelpro-a0743aaf9e8e3d9151fb7acf4b1c6da06338be88.tar.gz sequelpro-a0743aaf9e8e3d9151fb7acf4b1c6da06338be88.tar.bz2 sequelpro-a0743aaf9e8e3d9151fb7acf4b1c6da06338be88.zip |
- Add the ability to view hidden files in SSH/SSL key selection dialogs; this addresses Issue #1176
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r-- | Source/SPConnectionController.m | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index e7a70caf..61c6281c 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -45,6 +45,10 @@ #import "SPDatabaseViewController.h" #endif +@interface NSSavePanel (NSSavePanel_unpublishedUntilSnowLeopardAPI) +- (void)setShowsHiddenFiles:(BOOL)flag; +@end + @interface SPConnectionController (PrivateAPI) #ifndef SP_REFACTOR /* @interface */ @@ -604,7 +608,8 @@ NSString *directoryPath = nil; NSString *filePath = nil; NSArray *permittedFileTypes = nil; - NSOpenPanel *openPanel = [NSOpenPanel openPanel]; + keySelectionPanel = [NSOpenPanel openPanel]; + [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; #ifndef SP_REFACTOR /* !!! ssh keys */ // Switch details by sender. @@ -624,7 +629,7 @@ } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"", nil]; - [openPanel setAccessoryView:sshKeyLocationHelp]; + [keySelectionPanel setAccessoryView:sshKeyLocationHelp]; // SSL key file location: } else if (sender == standardSSLKeyFileButton || sender == socketSSLKeyFileButton) { @@ -633,7 +638,7 @@ return; } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"key", @"", nil]; - [openPanel setAccessoryView:sslKeyFileLocationHelp]; + [keySelectionPanel setAccessoryView:sslKeyFileLocationHelp]; // SSL certificate file location: } else if (sender == standardSSLCertificateButton || sender == socketSSLCertificateButton) { @@ -642,7 +647,7 @@ return; } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; - [openPanel setAccessoryView:sslCertificateLocationHelp]; + [keySelectionPanel setAccessoryView:sslCertificateLocationHelp]; // SSL CA certificate file location: } else if (sender == standardSSLCACertButton || sender == socketSSLCACertButton) { @@ -651,17 +656,17 @@ return; } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; - [openPanel setAccessoryView:sslCACertLocationHelp]; + [keySelectionPanel setAccessoryView:sslCACertLocationHelp]; } #endif - [openPanel beginSheetForDirectory:directoryPath - file:filePath - types:permittedFileTypes - modalForWindow:[tableDocument parentWindow] - modalDelegate:self - didEndSelector:@selector(chooseKeyLocationSheetDidEnd:returnCode:contextInfo:) - contextInfo:sender]; + [keySelectionPanel beginSheetForDirectory:directoryPath + file:filePath + types:permittedFileTypes + modalForWindow:[tableDocument parentWindow] + modalDelegate:self + didEndSelector:@selector(chooseKeyLocationSheetDidEnd:returnCode:contextInfo:) + contextInfo:sender]; } /** @@ -742,6 +747,14 @@ [self resizeTabViewToConnectionType:[self type] animating:YES]; } +/** + * Toggle hidden file visiblity in response to accessory view changes + */ +- (IBAction)updateKeyLocationFileVisibility:(id)sender +{ + [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; +} + #pragma mark - #pragma mark Connection details interaction and display |