From 2eb73a5630448763688a7835e9073eff90ad4f5b Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 5 Jul 2010 17:44:01 +0000 Subject: Simplify the ease at which export filename tokens can be localised as well as how they are updated with respect to the selected export type. --- Source/SPExportController.m | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'Source/SPExportController.m') diff --git a/Source/SPExportController.m b/Source/SPExportController.m index a4851f53..6cee32b7 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -38,6 +38,7 @@ @interface SPExportController (PrivateAPI) - (void)_updateDisplayedExportFilename; +- (void)_updateAvailableExportFilenameTokens; - (NSString *)_generateDefaultExportFilename; - (NSString *)_currentDefaultExportFileExtension; @@ -94,9 +95,6 @@ windowMinHeigth = [[self window] minSize].height; prefs = [NSUserDefaults standardUserDefaults]; - - // Default filename tokens - availableFilenameTokens = NSLocalizedString(@"host,database,table,date,time", @"default custom export filename tokens"); } return self; @@ -358,6 +356,8 @@ [exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; [exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; + [self _updateAvailableExportFilenameTokens]; + if (!showCustomFilenameView) [self _updateDisplayedExportFilename]; } @@ -379,8 +379,7 @@ [exportDeselectAllTablesButton setEnabled:isSelectedTables]; [exportRefreshTablesButton setEnabled:isSelectedTables]; - availableFilenameTokens = ([sender indexOfSelectedItem] == SPQueryExport) ? @"host,database,date,time" : @"host,database,table,date,time"; - + [self _updateAvailableExportFilenameTokens]; [self _updateDisplayedExportFilename]; } } @@ -432,10 +431,7 @@ * Opens the open panel when user selects to change the output path. */ - (IBAction)changeExportOutputPath:(id)sender -{ - [exportCustomFilenameTokenField setStringValue:@""]; - [exportCustomFilenameTokensField setStringValue:availableFilenameTokens]; - +{ NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setCanChooseFiles:NO]; @@ -715,6 +711,14 @@ [exportCustomFilenameViewLabelButton setTitle:[NSString stringWithFormat:NSLocalizedString(@"Customize Filename (%@)", @"customize file name label"), filename]]; } +/** + * Updates the available export filename tokens. + */ +- (void)_updateAvailableExportFilenameTokens +{ + [exportCustomFilenameTokensField setStringValue:((exportSource == SPQueryExport) || (exportType == SPDotExport)) ? NSLocalizedString(@"host,database,date,time", @"custom export filename tokens without table") : NSLocalizedString(@"host,database,table,date,time", @"default custom export filename tokens")]; +} + /** * Generates the default export filename based on the selected export options. */ -- cgit v1.2.3