aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExportFileNameTokenObject.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-10-12 01:09:23 +0200
committerMax <post@wickenrode.com>2015-10-12 01:14:33 +0200
commit319eee397f894160aa5d6132d7d07881a75a762e (patch)
tree7839b94dcc1c873e8d1d27c8006d7871f13df305 /Source/SPExportFileNameTokenObject.m
parent44af78202545ec911de052c5eec361f2296afc28 (diff)
downloadsequelpro-319eee397f894160aa5d6132d7d07881a75a762e.tar.gz
sequelpro-319eee397f894160aa5d6132d7d07881a75a762e.tar.bz2
sequelpro-319eee397f894160aa5d6132d7d07881a75a762e.zip
Change how the custom filename pattern in export dialog is handled
Namely: * They were previously stored in the users locale. Now they are stored using a language independent id * Just typing a token in your language will no longer work. If you want to manually type a token use: {host}, {database}, and so on… (all in English) * Copy & Paste of tokens will use the new form, too (so a user running SP in English can simply share a custom pattern with a user running SP in German) * The localized token names can now contain spaces
Diffstat (limited to 'Source/SPExportFileNameTokenObject.m')
-rw-r--r--Source/SPExportFileNameTokenObject.m26
1 files changed, 23 insertions, 3 deletions
diff --git a/Source/SPExportFileNameTokenObject.m b/Source/SPExportFileNameTokenObject.m
index 5e91049b..9c6338f3 100644
--- a/Source/SPExportFileNameTokenObject.m
+++ b/Source/SPExportFileNameTokenObject.m
@@ -32,7 +32,27 @@
@implementation SPExportFileNameTokenObject
-@synthesize tokenContent;
+@synthesize tokenId;
+
++ (id)tokenWithId:(NSString *)token
+{
+ SPExportFileNameTokenObject *obj = [[SPExportFileNameTokenObject alloc] init];
+ [obj setTokenId:token];
+ return [obj autorelease];
+}
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%p {%@}>",self,[self tokenId]];
+}
+
+- (BOOL)isEqual:(id)object
+{
+ if([object isKindOfClass:[SPExportFileNameTokenObject class]]) {
+ return [[self tokenId] isEqualToString:[object tokenId]];
+ }
+ return [super isEqual:object];
+}
#pragma mark -
#pragma mark NSCoding compatibility
@@ -40,7 +60,7 @@
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super init])) {
- [self setTokenContent:[decoder decodeObjectForKey:@"TokenContent"]];
+ [self setTokenId:[decoder decodeObjectForKey:@"tokenId"]];
}
return self;
@@ -48,7 +68,7 @@
- (void)encodeWithCoder:(NSCoder *)encoder
{
- [encoder encodeObject:[self tokenContent] forKey:@"TokenContent"];
+ [encoder encodeObject:[self tokenId] forKey:@"tokenId"];
}
@end