diff options
author | stuconnolly <stuart02@gmail.com> | 2009-10-17 00:35:09 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-10-17 00:35:09 +0000 |
commit | 6a4e2994d17220eb43015162522deec1efdd429b (patch) | |
tree | f1d2abc0691948bcbd901929c82347137ee0de85 /Source/TableDump.m | |
parent | c3eb7de88f2baf7774749f4311a84b75ef833eb7 (diff) | |
download | sequelpro-6a4e2994d17220eb43015162522deec1efdd429b.tar.gz sequelpro-6a4e2994d17220eb43015162522deec1efdd429b.tar.bz2 sequelpro-6a4e2994d17220eb43015162522deec1efdd429b.zip |
Replace the use of hard coded preference keys with constants to prevent issues such as the one fixed in revision 1419. All future preference usage should be done so using these constants.
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r-- | Source/TableDump.m | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m index d5e6d563..abb2e258 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -36,6 +36,7 @@ #import "SPStringAdditions.h" #import "SPArrayAdditions.h" #import "RegexKitLite.h" +#import "SPConstants.h" @implementation TableDump @@ -426,11 +427,11 @@ } // Preset the accessory view with prefs defaults - [importFieldsTerminatedField setStringValue:[prefs objectForKey:@"CSVImportFieldTerminator"]]; - [importLinesTerminatedField setStringValue:[prefs objectForKey:@"CSVImportLineTerminator"]]; - [importFieldsEscapedField setStringValue:[prefs objectForKey:@"CSVImportFieldEscapeCharacter"]]; - [importFieldsEnclosedField setStringValue:[prefs objectForKey:@"CSVImportFieldEnclosedBy"]]; - [importFieldNamesSwitch setState:[[prefs objectForKey:@"CSVImportFirstLineIsHeader"] boolValue]]; + [importFieldsTerminatedField setStringValue:[prefs objectForKey:SPCSVImportFieldTerminator]]; + [importLinesTerminatedField setStringValue:[prefs objectForKey:SPCSVImportLineTerminator]]; + [importFieldsEscapedField setStringValue:[prefs objectForKey:SPCSVImportFieldEscapeCharacter]]; + [importFieldsEnclosedField setStringValue:[prefs objectForKey:SPCSVImportFieldEnclosedBy]]; + [importFieldNamesSwitch setState:[[prefs objectForKey:SPCSVImportFirstLineIsHeader] boolValue]]; [openPanel setAccessoryView:importCSVView]; [openPanel setDelegate:self]; @@ -780,18 +781,18 @@ csvParser = [[SPCSVParser alloc] init]; // Store settings in prefs - [prefs setObject:[importFieldsEnclosedField stringValue] forKey:@"CSVImportFieldEnclosedBy"]; - [prefs setObject:[importFieldsEscapedField stringValue] forKey:@"CSVImportFieldEscapeCharacter"]; - [prefs setObject:[importLinesTerminatedField stringValue] forKey:@"CSVImportLineTerminator"]; - [prefs setObject:[importFieldsTerminatedField stringValue] forKey:@"CSVImportFieldTerminator"]; - [prefs setBool:[importFieldNamesSwitch state] forKey:@"CSVImportFirstLineIsHeader"]; + [prefs setObject:[importFieldsEnclosedField stringValue] forKey:SPCSVImportFieldEnclosedBy]; + [prefs setObject:[importFieldsEscapedField stringValue] forKey:SPCSVImportFieldEscapeCharacter]; + [prefs setObject:[importLinesTerminatedField stringValue] forKey:SPCSVImportLineTerminator]; + [prefs setObject:[importFieldsTerminatedField stringValue] forKey:SPCSVImportFieldTerminator]; + [prefs setBool:[importFieldNamesSwitch state] forKey:SPCSVImportFirstLineIsHeader]; // Take CSV import setting from accessory view [csvParser setFieldTerminatorString:[importFieldsTerminatedField stringValue] convertDisplayStrings:YES]; [csvParser setLineTerminatorString:[importLinesTerminatedField stringValue] convertDisplayStrings:YES]; [csvParser setFieldQuoteString:[importFieldsEnclosedField stringValue] convertDisplayStrings:YES]; [csvParser setEscapeString:[importFieldsEscapedField stringValue] convertDisplayStrings:YES]; - [csvParser setNullReplacementString:[prefs objectForKey:@"NullValue"]]; + [csvParser setNullReplacementString:[prefs objectForKey:SPNullValue]]; csvDataBuffer = [[NSMutableData alloc] init]; importPool = [[NSAutoreleasePool alloc] init]; @@ -1178,7 +1179,7 @@ [fieldMappingButtonOptions setArray:[fieldMappingImportArray objectAtIndex:fieldMappingCurrentRow]]; for (i = 0; i < [fieldMappingButtonOptions count]; i++) { if ([[fieldMappingButtonOptions objectAtIndex:i] isNSNull]) { - [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [prefs objectForKey:@"NullValue"]]]; + [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [prefs objectForKey:SPNullValue]]]; } else { [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, NSArrayObjectAtIndex(fieldMappingButtonOptions, i)]]; } @@ -1762,7 +1763,7 @@ NSArray *csvRow; id csvCell; NSMutableString *csvString = [NSMutableString string]; - NSString *nullString = [NSString stringWithString:[prefs objectForKey:@"NullValue"]]; + NSString *nullString = [NSString stringWithString:[prefs objectForKey:SPNullValue]]; NSString *escapedEscapeString, *escapedFieldSeparatorString, *escapedEnclosingString, *escapedLineEndString; NSString *dataConversionString; NSInteger currentRowIndex; @@ -2496,7 +2497,7 @@ [[exportMultipleCSVTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton]; [[exportMultipleXMLTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton]; [switchButton release]; - if ( [prefs boolForKey:@"UseMonospacedFonts"] ) { + if ( [prefs boolForKey:SPUseMonospacedFonts] ) { [[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; [[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell] @@ -2537,7 +2538,7 @@ forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { - if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"UseMonospacedFonts"] ) { + if ( [[NSUserDefaults standardUserDefaults] boolForKey:SPUseMonospacedFonts] ) { [aCell setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; } else |