From 27156550b646a74d2345b4ff9650b7a3b4ba052e Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 16 Feb 2013 22:03:09 +0000 Subject: Fix more wanrings by creating a protocol that delegates of the copy table should conform to. --- Source/SPCopyTable.m | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'Source/SPCopyTable.m') diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index c5d3f62d..807a204d 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -51,6 +51,7 @@ #endif #import "SPTablesList.h" #import "SPBundleCommandRunner.h" +#import "SPDatabaseContentViewDelegate.h" #import @@ -1185,19 +1186,8 @@ static const NSInteger kBlobAsImageFile = 4; */ - (BOOL)shouldUseFieldEditorForRow:(NSUInteger)rowIndex column:(NSUInteger)colIndex { - // Retrieve the column definition -#ifdef SP_CODA - NSDictionary *columnDefinition = nil; - - if ( [[self delegate] isKindOfClass:[SPTableContent class]] ) - columnDefinition = [[(SPTableContent*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; - - else if ( [[self delegate] isKindOfClass:[SPCustomQuery class]] ) - columnDefinition = [[(SPCustomQuery*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; -#else - NSDictionary *columnDefinition = [[[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; -#endif + NSDictionary *columnDefinition = [[(id )[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; NSString *columnType = [columnDefinition objectForKey:@"typegrouping"]; @@ -1368,7 +1358,9 @@ static const NSInteger kBlobAsImageFile = 4; NSMutableString *tableMetaData = [NSMutableString string]; if([[self delegate] isKindOfClass:[SPCustomQuery class]]) { [env setObject:@"query" forKey:SPBundleShellVariableDataTableSource]; - NSArray *defs = [[self delegate] dataColumnDefinitions]; + + NSArray *defs = [(id )[self delegate] dataColumnDefinitions]; + if(defs && [defs count] == numColumns) for( c = 0; c < numColumns; c++ ) { NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]); @@ -1383,7 +1375,9 @@ static const NSInteger kBlobAsImageFile = 4; } else if([[self delegate] isKindOfClass:[SPTableContent class]]) { [env setObject:@"content" forKey:SPBundleShellVariableDataTableSource]; - NSArray *defs = [[self delegate] dataColumnDefinitions]; + + NSArray *defs = [(id )[self delegate] dataColumnDefinitions]; + if(defs && [defs count] == numColumns) for( c = 0; c < numColumns; c++ ) { NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]); -- cgit v1.2.3