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/SPFieldEditorController.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/SPFieldEditorController.m')
-rw-r--r-- | Source/SPFieldEditorController.m | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 83a63d6b..9ecf4815 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -32,6 +32,7 @@ #import "RegexKitLite.h" #import "SPDataCellFormatter.h" #import "SPTooltip.h" +#import "SPConstants.h" @implementation SPFieldEditorController @@ -91,8 +92,8 @@ } } // Load user-defined QL types - if([prefs objectForKey:@"QuickLookTypes"]) { - for(id type in [prefs objectForKey:@"QuickLookTypes"]) { + if([prefs objectForKey:SPQuickLookTypes]) { + for(id type in [prefs objectForKey:SPQuickLookTypes]) { NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""]; [item setTag:tag]; [item setAction:@selector(quickLookFormatButton:)]; @@ -102,7 +103,7 @@ [qlTypesItems addObject:type]; } } - qlTypes = [NSDictionary dictionaryWithObject:[qlTypesItems retain] forKey:@"QuickLookTypes"]; + qlTypes = [NSDictionary dictionaryWithObject:[qlTypesItems retain] forKey:SPQuickLookTypes]; [qlTypesItems release]; } return self; @@ -131,8 +132,8 @@ isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow { - if ( ![prefs objectForKey:@"FieldEditorSheetFont"] ) - if ( [prefs boolForKey:@"UseMonospacedFonts"] ) { + if ( ![prefs objectForKey:SPFieldEditorSheetFont] ) + if ( [prefs boolForKey:SPUseMonospacedFonts] ) { [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; } else { [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; @@ -253,7 +254,7 @@ [editTextView setSelectedRange:NSMakeRange(0,0)]; // If the string content is NULL select NULL for convenience - if([stringValue isEqualToString:[prefs objectForKey:@"NullValue"]]) + if([stringValue isEqualToString:[prefs objectForKey:SPNullValue]]) [editTextView setSelectedRange:NSMakeRange(0,[[editTextView string] length])]; // Set focus @@ -349,7 +350,7 @@ // - for max text length (except for NULL value string) select the part which won't be saved // and suppress closing the sheet if(sender == editSheetOkButton) { - if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:@"NullValue"]]) { + if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:SPNullValue]]) { [editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)]; [editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)]; [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %d.", @"Text is too long. Maximum text length is set to %d."), maxTextLength]]; @@ -839,7 +840,7 @@ { if(textView == editTextView && maxTextLength > 0 - && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:@"NullValue"]]) { + && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:SPNullValue]]) { int newLength; |