diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPExportController.m | 9 | ||||
-rw-r--r-- | Source/SPExportFilenameUtilities.m | 28 |
2 files changed, 26 insertions, 11 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m index df95d204..f9d5628e 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -650,12 +650,17 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; // token - this suggests it's not a one-off filename if ([[exportCustomFilenameTokenField stringValue] length] < 1) { [prefs removeObjectForKey:SPExportFilenameFormat]; - } else { + } + else { BOOL saveFilename = NO; + NSArray *representedObjects = [exportCustomFilenameTokenField objectValue]; - for (id aToken in representedObjects) { + + for (id aToken in representedObjects) + { if ([aToken isKindOfClass:[SPExportFileNameTokenObject class]]) saveFilename = YES; } + if (saveFilename) [prefs setObject:[NSKeyedArchiver archivedDataWithRootObject:representedObjects] forKey:SPExportFilenameFormat]; } diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m index a4330e36..31625a4c 100644 --- a/Source/SPExportFilenameUtilities.m +++ b/Source/SPExportFilenameUtilities.m @@ -219,40 +219,50 @@ // Walk through the token field, appending token replacements or strings NSArray *representedFilenameParts = [exportCustomFilenameTokenField objectValue]; - for (id filenamePart in representedFilenameParts) { + + for (id filenamePart in representedFilenameParts) + { if ([filenamePart isKindOfClass:[SPExportFileNameTokenObject class]]) { NSString *tokenContent = [filenamePart tokenContent]; if ([tokenContent isEqualToString:NSLocalizedString(@"host", @"export filename host token")]) { [string appendString:[tableDocumentInstance host]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"database", @"export filename database token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"database", @"export filename database token")]) { [string appendString:[tableDocumentInstance database]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"table", @"table")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"table", @"table")]) { [string appendString:(table) ? table : @""]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"date", @"export filename date token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"date", @"export filename date token")]) { [dateFormatter setDateStyle:NSDateFormatterShortStyle]; [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [string appendString:[dateFormatter stringFromDate:[NSDate date]]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"year", @"export filename date token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"year", @"export filename date token")]) { [string appendString:[[NSDate date] descriptionWithCalendarFormat:@"%Y" timeZone:nil locale:nil]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"month", @"export filename date token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"month", @"export filename date token")]) { [string appendString:[[NSDate date] descriptionWithCalendarFormat:@"%m" timeZone:nil locale:nil]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"day", @"export filename date token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"day", @"export filename date token")]) { [string appendString:[[NSDate date] descriptionWithCalendarFormat:@"%d" timeZone:nil locale:nil]]; - } else if ([tokenContent isEqualToString:NSLocalizedString(@"time", @"export filename time token")]) { + } + else if ([tokenContent isEqualToString:NSLocalizedString(@"time", @"export filename time token")]) { [dateFormatter setDateStyle:NSDateFormatterNoStyle]; [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; [string appendString:[dateFormatter stringFromDate:[NSDate date]]]; } - } else { + } + else { [string appendString:filenamePart]; } } |