From ba37b377d84cc24052538aad70257fc082c92dca Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 19 Feb 2010 19:16:59 +0000 Subject: =?UTF-8?q?=E2=80=A2=20removed=20initial=20transition=20of=20inser?= =?UTF-8?q?tion=20NSNull=20into=20table's=20dataSource=20from=20last=20com?= =?UTF-8?q?mit=20r1824=20since=20that=20part=20should=20be=20moved=20maybe?= =?UTF-8?q?=20into=20SPTableTextFieldCell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTextViewAdditions.m | 8 -------- Source/TableContent.m | 11 ++++++++--- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'Source') diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index ef0dff38..97c0e07c 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -391,14 +391,6 @@ - (IBAction)insertNULLvalue:(id)sender { - // If self is an edited table cell insert [NSNull null] directly in the table's data source - // TODO: up to now only for CMCopyTable - if([[[[self delegate] class] description] isEqualToString:@"CMCopyTable"]) { - id aTableView = [self delegate]; - NSUInteger currentEditedColumn = [aTableView editedColumn]; - NSUInteger currentEditedRow = [aTableView editedRow]; - [[aTableView delegate] tableView:aTableView setObjectValue:[NSNull null] forTableColumn:[[aTableView tableColumns] objectAtIndex:currentEditedColumn] row:currentEditedRow]; - } id prefs = [NSUserDefaults standardUserDefaults]; if([self respondsToSelector:@selector(insertText:)]) if([prefs objectForKey:SPNullValue] && [[prefs objectForKey:SPNullValue] length]) diff --git a/Source/TableContent.m b/Source/TableContent.m index 4d878527..a0e2d610 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -2746,12 +2746,17 @@ } NSDictionary *column = NSArrayObjectAtIndex(dataColumns, [[aTableColumn identifier] integerValue]); + + if (anObject) { + + // Restore NULLs if necessary + if ([anObject isEqualToString:[prefs objectForKey:SPNullValue]] && [[column objectForKey:@"null"] boolValue]) + anObject = [NSNull null]; - if (anObject) [tableValues replaceObjectInRow:rowIndex column:[[aTableColumn identifier] integerValue] withObject:anObject]; - else + } else { [tableValues replaceObjectInRow:rowIndex column:[[aTableColumn identifier] integerValue] withObject:@""]; - + } } #pragma mark - -- cgit v1.2.3