From d400bb1391e366e123366668565080df350b18c5 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 16 Feb 2010 17:26:23 +0000 Subject: =?UTF-8?q?=E2=80=A2=20removed=20arrows=20=E2=80=A2=20fixed=20spel?= =?UTF-8?q?lings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPFieldMapperController.h | 1 + Source/SPFieldMapperController.m | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'Source') diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h index 6fc58c60..138c765a 100644 --- a/Source/SPFieldMapperController.h +++ b/Source/SPFieldMapperController.h @@ -55,6 +55,7 @@ BOOL fieldMappingImportArrayIsPreview; BOOL importFieldNamesHeader; + NSNumber *lastDisabledCSVFieldcolumn; MCPConnection *mySQLConnection; diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index f7a2e068..77c4c335 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -56,11 +56,13 @@ fieldMappingOperatorArray = [[NSMutableArray alloc] init]; fieldMappingArray = nil; + lastDisabledCSVFieldcolumn = [NSNumber numberWithInteger:0]; + doImport = [NSNumber numberWithInteger:0]; doNotImport = [NSNumber numberWithInteger:1]; isEqual = [NSNumber numberWithInteger:2]; - doImportString = @"→"; - doNotImportString = @"×"; + doImportString = @"─"; + doNotImportString = @" "; isEqualString = @"="; prefs = [NSUserDefaults standardUserDefaults]; @@ -348,13 +350,15 @@ - (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex mouseLocation:(NSPoint)mouseLocation { - if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) + if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) { + if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return @""; if(fieldMappingCurrentRow) return [NSString stringWithFormat:@"%@: %@", [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, 0), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description], [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description]]; else return [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, 0), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description]; + } else if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOffState) return [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description]; else if([[aTableColumn identifier] isEqualToString:@"operator"]) { @@ -386,9 +390,9 @@ else if ([[aTableColumn identifier] isEqualToString:@"import_value"]) { if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) { [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems]; - [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions]; + if([fieldMappingOperatorArray objectAtIndex:rowIndex] != doNotImport) + [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions]; } - return [fieldMappingArray objectAtIndex:rowIndex]; } else if ([[aTableColumn identifier] isEqualToString:@"operator"]) { @@ -396,7 +400,6 @@ [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems]; [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingOperatorOptions]; } - return [fieldMappingOperatorArray objectAtIndex:rowIndex]; } return nil; @@ -408,7 +411,15 @@ [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject]; } else if ([[aTableColumn identifier] isEqualToString:@"operator"]) { - [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject]; + if([fieldMappingOperatorArray objectAtIndex:rowIndex] == anObject) return; + if([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) { + [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject]; + [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:lastDisabledCSVFieldcolumn]; + } else { + if(anObject == doNotImport) lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex]; + [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject]; + } + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.01]; } } -- cgit v1.2.3