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/SPFavoritesPreferencePane.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/SPFavoritesPreferencePane.m')
-rw-r--r-- | Source/SPFavoritesPreferencePane.m | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/Source/SPFavoritesPreferencePane.m b/Source/SPFavoritesPreferencePane.m index 7641e5c8..6a5270c0 100644 --- a/Source/SPFavoritesPreferencePane.m +++ b/Source/SPFavoritesPreferencePane.m @@ -37,6 +37,10 @@ @end +@interface NSSavePanel (NSSavePanel_unpublishedUntilSnowLeopardAPI) +- (void)setShowsHiddenFiles:(BOOL)flag; +@end + @implementation SPFavoritesPreferencePane #pragma mark - @@ -274,7 +278,8 @@ NSString *directoryPath = nil; NSString *filePath = nil; NSArray *permittedFileTypes = nil; - NSOpenPanel *openPanel = [NSOpenPanel openPanel]; + keySelectionPanel = [NSOpenPanel openPanel]; + [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; // Switch details by sender. // First, SSH keys: @@ -295,7 +300,7 @@ permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"", nil]; - [openPanel setAccessoryView:sshKeyLocationHelp]; + [keySelectionPanel setAccessoryView:sshKeyLocationHelp]; // SSL key file location: } @@ -306,7 +311,7 @@ } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"key", @"", nil]; - [openPanel setAccessoryView:sslKeyFileLocationHelp]; + [keySelectionPanel setAccessoryView:sslKeyFileLocationHelp]; // SSL certificate file location: } @@ -317,7 +322,7 @@ } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; - [openPanel setAccessoryView:sslCertificateLocationHelp]; + [keySelectionPanel setAccessoryView:sslCertificateLocationHelp]; // SSL CA certificate file location: } @@ -328,16 +333,24 @@ } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; - [openPanel setAccessoryView:sslCACertLocationHelp]; + [keySelectionPanel setAccessoryView:sslCACertLocationHelp]; } - [openPanel beginSheetForDirectory:directoryPath - file:filePath - types:permittedFileTypes - modalForWindow:[[self view] window] - modalDelegate:self - didEndSelector:@selector(chooseKeyLocationSheetDidEnd:returnCode:contextInfo:) - contextInfo:sender]; + [keySelectionPanel beginSheetForDirectory:directoryPath + file:filePath + types:permittedFileTypes + modalForWindow:[[self view] window] + modalDelegate:self + didEndSelector:@selector(chooseKeyLocationSheetDidEnd:returnCode:contextInfo:) + contextInfo:sender]; +} + +/** + * Toggle hidden file visiblity in response to accessory view changes + */ +- (IBAction)updateKeyLocationFileVisibility:(id)sender +{ + [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; } #pragma mark - |