From 507d0089c6bb73a01129f1e356d1e88ca53afb55 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 16 Oct 2009 12:30:38 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20three=20further=20typos=20for:=20?= =?UTF-8?q?=20=20=20objectForKey:@"NullValue"=20=E2=80=A2=20allow=20to=20e?= =?UTF-8?q?nter=20the=20NULL=20value=20string=20even=20if=20the=20cell/fie?= =?UTF-8?q?ld's=20maximal=20length=20is=20set=20to=20less=20then=20the=20a?= =?UTF-8?q?ctual=20NULL=20value=20string=20length=20(eg=20varchar(3)=20and?= =?UTF-8?q?=20NULL=20value=20string=20is=20@"NULL")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMCopyTable.m | 4 ++-- Source/CustomQuery.m | 2 +- Source/SPDataCellFormatter.m | 4 ++-- Source/SPFieldEditorController.m | 10 ++++++---- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'Source') diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m index 23bf7804..c0197c0e 100644 --- a/Source/CMCopyTable.m +++ b/Source/CMCopyTable.m @@ -133,7 +133,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002; if ( nil != rowData ) { if ([rowData isNSNull]) - [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"nullValue"]]]; + [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"NullValue"]]]; else if ([rowData isSPNotLoaded]) [result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]]; else @@ -371,7 +371,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002; if ( nil != rowData ) { if ([rowData isNSNull]) - [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"nullValue"]]]; + [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:@"NullValue"]]]; else if ([rowData isSPNotLoaded]) [result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]]; else diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 0589ab6f..323a9078 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -1643,7 +1643,7 @@ [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] intValue]]; id originalData = [[fullResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]]; - if ([originalData isNSNull]) originalData = [prefs objectForKey:@"nullValue"]; + if ([originalData isNSNull]) originalData = [prefs objectForKey:@"NullValue"]; id editData = [[fieldEditor editWithObject:originalData fieldName:[columnDefinition objectForKey:@"name"] diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m index 5a768686..916568ca 100644 --- a/Source/SPDataCellFormatter.m +++ b/Source/SPDataCellFormatter.m @@ -76,8 +76,8 @@ - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error { - // No limit set - if (textLimit == 0) + // No limit set or partialString is NULL value string allow editing + if (textLimit == 0 || [partialString isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"NullValue"]]) return YES; // A single character over the length of the string - likely typed. Prevent the change. diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index bdb78726..83a63d6b 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -346,10 +346,10 @@ editSheetReturnCode = 0; // Validate the sheet data before saving them. - // - for max text length select the part which won't be saved + // - 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) { + if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:@"NullValue"]]) { [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]]; @@ -833,11 +833,13 @@ #pragma mark Delegates /* - Validate editTextView for max text length + Validate editTextView for max text length except for NULL value string */ - (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)r replacementString:(NSString *)replacementString { - if(textView == editTextView && maxTextLength > 0) { + + if(textView == editTextView && maxTextLength > 0 + && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:@"NullValue"]]) { int newLength; -- cgit v1.2.3