aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@abhibeckert.com>2017-08-09 08:26:56 +1000
committerGitHub <noreply@github.com>2017-08-09 08:26:56 +1000
commit0625044f52367c2e5778c326f6ca3f4fe3bdcc78 (patch)
treecfd6e55b4954d2fb495133b5d3a745d9e63db211 /Source
parente3f897092127c9459c84a979455035c0e3840fec (diff)
parent0164dba459c2cceed12519a2ce96c7aaf2dac3b4 (diff)
downloadsequelpro-0625044f52367c2e5778c326f6ca3f4fe3bdcc78.tar.gz
sequelpro-0625044f52367c2e5778c326f6ca3f4fe3bdcc78.tar.bz2
sequelpro-0625044f52367c2e5778c326f6ca3f4fe3bdcc78.zip
Merge pull request #2852 from michaelrog/feature/24-hour-date-token
Add a 24-hour-format time token(s) for the custom export filename field
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m19
-rw-r--r--Source/SPExportController.m19
-rw-r--r--Source/SPExportFilenameUtilities.m4
4 files changed, 25 insertions, 18 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 1419ec9a..969d709f 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -414,6 +414,7 @@ extern NSString *SPFileNameYearTokenName;
extern NSString *SPFileNameMonthTokenName;
extern NSString *SPFileNameDayTokenName;
extern NSString *SPFileNameTimeTokenName;
+extern NSString *SPFileName24HourTimeTokenName;
extern NSString *SPFileNameFavoriteTokenName;
extern NSString *SPFileNameTableTokenName;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 7ae37df3..aba9b83e 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -206,15 +206,16 @@ NSString *SPImportClipboardTempFileNamePrefix = @"/tmp/_SP_ClipBoard_Import_F
NSString *SPLastExportSettings = @"LastExportSettings";
// Export filename tokens
-NSString *SPFileNameDatabaseTokenName = @"database";
-NSString *SPFileNameHostTokenName = @"host";
-NSString *SPFileNameDateTokenName = @"date";
-NSString *SPFileNameYearTokenName = @"year";
-NSString *SPFileNameMonthTokenName = @"month";
-NSString *SPFileNameDayTokenName = @"day";
-NSString *SPFileNameTimeTokenName = @"time";
-NSString *SPFileNameFavoriteTokenName = @"favorite";
-NSString *SPFileNameTableTokenName = @"table";
+NSString *SPFileNameDatabaseTokenName = @"database";
+NSString *SPFileNameHostTokenName = @"host";
+NSString *SPFileNameDateTokenName = @"date";
+NSString *SPFileNameYearTokenName = @"year";
+NSString *SPFileNameMonthTokenName = @"month";
+NSString *SPFileNameDayTokenName = @"day";
+NSString *SPFileNameTimeTokenName = @"time";
+NSString *SPFileName24HourTimeTokenName = @"time24";
+NSString *SPFileNameFavoriteTokenName = @"favorite";
+NSString *SPFileNameTableTokenName = @"table";
// Misc
NSString *SPContentFilters = @"ContentFilters";
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 0cccabb5..28e29dac 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -125,15 +125,16 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled";
prefs = [NSUserDefaults standardUserDefaults];
localizedTokenNames = [@{
- SPFileNameHostTokenName: NSLocalizedString(@"Host", @"export filename host token"),
- SPFileNameDatabaseTokenName: NSLocalizedString(@"Database", @"export filename database token"),
- SPFileNameTableTokenName: NSLocalizedString(@"Table", @"table"),
- SPFileNameDateTokenName: NSLocalizedString(@"Date", @"export filename date token"),
- SPFileNameYearTokenName: NSLocalizedString(@"Year", @"export filename date token"),
- SPFileNameMonthTokenName: NSLocalizedString(@"Month", @"export filename date token"),
- SPFileNameDayTokenName: NSLocalizedString(@"Day", @"export filename date token"),
- SPFileNameTimeTokenName: NSLocalizedString(@"Time", @"export filename time token"),
- SPFileNameFavoriteTokenName: NSLocalizedString(@"Favorite", @"export filename favorite name token")
+ SPFileNameHostTokenName: NSLocalizedString(@"Host", @"export filename host token"),
+ SPFileNameDatabaseTokenName: NSLocalizedString(@"Database", @"export filename database token"),
+ SPFileNameTableTokenName: NSLocalizedString(@"Table", @"table"),
+ SPFileNameDateTokenName: NSLocalizedString(@"Date", @"export filename date token"),
+ SPFileNameYearTokenName: NSLocalizedString(@"Year", @"export filename date token"),
+ SPFileNameMonthTokenName: NSLocalizedString(@"Month", @"export filename date token"),
+ SPFileNameDayTokenName: NSLocalizedString(@"Day", @"export filename date token"),
+ SPFileNameTimeTokenName: NSLocalizedString(@"Time", @"export filename time token"),
+ SPFileName24HourTimeTokenName: NSLocalizedString(@"24-Hour Time", @"export filename time token"),
+ SPFileNameFavoriteTokenName: NSLocalizedString(@"Favorite", @"export filename favorite name token")
} retain];
}
diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m
index 69b8f786..17e01e73 100644
--- a/Source/SPExportFilenameUtilities.m
+++ b/Source/SPExportFilenameUtilities.m
@@ -126,6 +126,7 @@
[SPExportFileNameTokenObject tokenWithId:SPFileNameMonthTokenName],
[SPExportFileNameTokenObject tokenWithId:SPFileNameDayTokenName],
[SPExportFileNameTokenObject tokenWithId:SPFileNameTimeTokenName],
+ [SPExportFileNameTokenObject tokenWithId:SPFileName24HourTimeTokenName],
[SPExportFileNameTokenObject tokenWithId:SPFileNameFavoriteTokenName],
(tableObject = [SPExportFileNameTokenObject tokenWithId:SPFileNameTableTokenName]),
nil
@@ -296,6 +297,9 @@
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
[string appendString:[dateFormatter stringFromDate:[NSDate date]]];
}
+ else if ([tokenContent isEqualToString:SPFileName24HourTimeTokenName]) {
+ [string appendString:[[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil]];
+ }
else if ([tokenContent isEqualToString:SPFileNameFavoriteTokenName]) {
[string appendStringOrNil:[tableDocumentInstance name]];
}