diff options
author | Max <post@wickenrode.com> | 2015-10-10 03:49:58 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-10 03:49:58 +0200 |
commit | 01ef3ad33d260119ee61b949414f038be2c8d00e (patch) | |
tree | d4ea4eff90c6ae334adb17ba5573213f029f86d1 /Source | |
parent | 2cb875fb99e0c017b545b8e8427eb565e15cca1e (diff) | |
download | sequelpro-01ef3ad33d260119ee61b949414f038be2c8d00e.tar.gz sequelpro-01ef3ad33d260119ee61b949414f038be2c8d00e.tar.bz2 sequelpro-01ef3ad33d260119ee61b949414f038be2c8d00e.zip |
Change two magic strings into constants
Diffstat (limited to 'Source')
-rw-r--r-- | Source/GeneratePreviewForURL.m | 6 | ||||
-rw-r--r-- | Source/SPConstants.h | 3 | ||||
-rw-r--r-- | Source/SPConstants.m | 3 | ||||
-rw-r--r-- | Source/SPContentFilterManager.m | 4 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 14 | ||||
-rw-r--r-- | Source/SPQueryFavoriteManager.m | 4 |
6 files changed, 20 insertions, 14 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index ef20b852..2209f746 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -84,7 +84,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, } // Dispatch different spf formats - if([[spf objectForKey:@"format"] isEqualToString:@"connection"]) { + if([[spf objectForKey:SPFFormatKey] isEqualToString:@"connection"]) { template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.sequelpro.SequelPro.qlgenerator"] pathForResource:@"SPQLPluginConnectionTemplate" ofType:@"html"] encoding:NSUTF8StringEncoding error:&templateReadError]; @@ -140,7 +140,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, [dateFormatter release]; } - else if([[spf objectForKey:@"format"] isEqualToString:@"content filters"]) { + else if([[spf objectForKey:SPFFormatKey] isEqualToString:@"content filters"]) { template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.sequelpro.SequelPro.qlgenerator"] pathForResource:@"SPQLPluginContentFiltersTemplate" ofType:@"html"] encoding:NSUTF8StringEncoding error:&templateReadError]; @@ -156,7 +156,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, ]; } - else if([[spf objectForKey:@"format"] isEqualToString:@"query favorites"]) { + else if([[spf objectForKey:SPFFormatKey] isEqualToString:@"query favorites"]) { template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.sequelpro.SequelPro.qlgenerator"] pathForResource:@"SPQLPluginQueryFavoritesTemplate" ofType:@"html"] encoding:NSUTF8StringEncoding error:&templateReadError]; diff --git a/Source/SPConstants.h b/Source/SPConstants.h index f2816745..80df6ba4 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -492,6 +492,9 @@ extern NSString *SPFavoriteSSLCACertFileLocationKey; extern NSString *SPFavoriteUseCompressionKey; extern NSString *SPConnectionFavoritesChangedNotification; +extern NSString *SPFFormatKey; +extern NSString *SPFVersionKey; + // Favorites import/export extern NSString *SPFavoritesDataRootKey; diff --git a/Source/SPConstants.m b/Source/SPConstants.m index 42631dab..ca8164e3 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -302,6 +302,9 @@ NSString *SPFavoriteSSLCACertFileLocationKey = @"sslCACertFileLocati NSString *SPFavoriteUseCompressionKey = @"useCompression"; NSString *SPConnectionFavoritesChangedNotification = @"SPConnectionFavoritesChanged"; +NSString *SPFFormatKey = @"format"; +NSString *SPFVersionKey = @"version"; + // Favorites import/export NSString *SPFavoritesDataRootKey = @"SPConnectionFavorites"; diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index a8e747e2..dca1fda8 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -930,8 +930,8 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; NSMutableArray *filterData = [NSMutableArray array]; - [spfdata setObject:@1 forKey:@"version"]; - [spfdata setObject:@"content filters" forKey:@"format"]; + [spfdata setObject:@1 forKey:SPFVersionKey]; + [spfdata setObject:@"content filters" forKey:SPFFormatKey]; [spfdata setObject:@NO forKey:@"encrypted"]; NSIndexSet *indexes = [contentFilterTableView selectedRowIndexes]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index dd3baae3..57ecdd97 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3143,8 +3143,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"save_password"] boolValue]] forKey:@"save_password"]; [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"include_session"] boolValue]] forKey:@"include_session"]; [info setObject:[NSNumber numberWithBool:[[spfDocData_temp objectForKey:@"save_editor_content"] boolValue]] forKey:@"save_editor_content"]; - [info setObject:@1 forKey:@"version"]; - [info setObject:@"connection bundle" forKey:@"format"]; + [info setObject:@1 forKey:SPFVersionKey]; + [info setObject:@"connection bundle" forKey:SPFFormatKey]; // Loop through all windows for(NSWindow *window in [SPAppDelegate orderedDatabaseConnectionWindows]) { @@ -3303,7 +3303,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; } // For dispatching later - if(![[spf objectForKey:@"format"] isEqualToString:@"connection"]) { + if(![[spf objectForKey:SPFFormatKey] isEqualToString:@"connection"]) { NSLog(@"SPF file format is not 'connection'."); [spf release]; return NO; @@ -3352,8 +3352,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; NSMutableDictionary *spfData = [NSMutableDictionary dictionary]; // Add basic details - [spfStructure setObject:@1 forKey:@"version"]; - [spfStructure setObject:@"connection" forKey:@"format"]; + [spfStructure setObject:@1 forKey:SPFVersionKey]; + [spfStructure setObject:@"connection" forKey:SPFFormatKey]; [spfStructure setObject:@"mysql" forKey:@"rdbms_type"]; if([self mySQLVersion]) [spfStructure setObject:[self mySQLVersion] forKey:@"rdbms_version"]; @@ -4817,12 +4817,12 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; } // If the .spf format is unhandled, error. - if (![[spf objectForKey:@"format"] isEqualToString:@"connection"]) { + if (![[spf objectForKey:SPFFormatKey] isEqualToString:@"connection"]) { NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Warning", @"warning")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil - informativeTextWithFormat:NSLocalizedString(@"The chosen file “%@” contains ‘%@’ data.", @"message while reading a spf file which matches non-supported formats."), path, [spf objectForKey:@"format"]]; + informativeTextWithFormat:NSLocalizedString(@"The chosen file “%@” contains ‘%@’ data.", @"message while reading a spf file which matches non-supported formats."), path, [spf objectForKey:SPFFormatKey]]; [alert setAlertStyle:NSWarningAlertStyle]; [spf release]; diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 3738fe0d..b1ea9a49 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -917,8 +917,8 @@ NSMutableArray *favoriteData = [NSMutableArray array]; - [spfdata setObject:@1 forKey:@"version"]; - [spfdata setObject:@"query favorites" forKey:@"format"]; + [spfdata setObject:@1 forKey:SPFVersionKey]; + [spfdata setObject:@"query favorites" forKey:SPFFormatKey]; [spfdata setObject:@NO forKey:@"encrypted"]; NSIndexSet *indexes = [favoritesTableView selectedRowIndexes]; |