aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-08-24 19:54:29 +0000
committerstuconnolly <stuart02@gmail.com>2011-08-24 19:54:29 +0000
commit4f9debeff37605793552f7fe8c3d3f1e5b4c58e2 (patch)
tree71a38f1885e576e77a4b2e2ebd05ef7992cfc12f
parent44aecf82db1ae3fe76f16f3f92ae580130713e0e (diff)
downloadsequelpro-4f9debeff37605793552f7fe8c3d3f1e5b4c58e2.tar.gz
sequelpro-4f9debeff37605793552f7fe8c3d3f1e5b4c58e2.tar.bz2
sequelpro-4f9debeff37605793552f7fe8c3d3f1e5b4c58e2.zip
Tidy up.
-rw-r--r--Source/SPExportController.m9
-rw-r--r--Source/SPExportFilenameUtilities.m28
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];
}
}