From e0e594cf921768218f19d9596f3214419482ff09 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 19 Feb 2010 10:50:26 +0000 Subject: =?UTF-8?q?=E2=80=A2=20CSV=20Import=20Field=20Mapper=20-=20added?= =?UTF-8?q?=20to=20csv=20field=20popup=20menu:=20"Ignore=20all=20fields",?= =?UTF-8?q?=20"Import=20all=20fields"=20-=20if=20user=20changed=20a=20matc?= =?UTF-8?q?hing=20pair=20field=20change=20the=20"Align=20fields=20by:"=20t?= =?UTF-8?q?o=20"custom=20order"=20to=20make=20it=20more=20transparent=20-?= =?UTF-8?q?=20if=20user=20inserts=20a=20just=20added=20global=20var=20to?= =?UTF-8?q?=20a=20field=20which=20was=20set=20to=20"Ignore=20field"=20set?= =?UTF-8?q?=20it=20to=20"Import=20field"=20-=20unified=20some=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/DataMigrationDialog.xib | 38 +++++++++++++---- Source/SPFieldMapperController.m | 52 ++++++++++++++++++++---- 2 files changed, 74 insertions(+), 16 deletions(-) diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib index 6c5b787a..96e2d8da 100644 --- a/Interfaces/English.lproj/DataMigrationDialog.xib +++ b/Interfaces/English.lproj/DataMigrationDialog.xib @@ -12,8 +12,8 @@ YES - + YES @@ -805,9 +805,9 @@ - CeKAlQlEbyBpbXBvcnQgZmllbGQKCQlEbyBub3QgaW1wb3J0IGZpZWxkCglJTlNFUlQJQWRkIGFzIG5l -dyByb3dzIElOU0VSVCBJTlRPIOKApglSRVBMQUNFCVVwZGF0ZSBleGlzdGluZyByb3dzIG9yIGFkZCBh -cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA + CeKAlQlJbXBvcnQgZmllbGQKCQlJZ25vcmUgZmllbGQKCUlOU0VSVAlBZGQgYXMgbmV3IHJvd3MgSU5T +RVJUIElOVE8g4oCmCVJFUExBQ0UJVXBkYXRlIGV4aXN0aW5nIHJvd3Mgb3IgYWRkIGFzIAoJCW5ldyBy +b3dzIFJFUExBQ0UgSU5UTyDigKY YES @@ -907,7 +907,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA - AQABAQEADwIDABMCAgAGAwEAGwIDAAcDAQA3AgIAA + AQABAQEADAIDAAwCAgAGAwEAGwIDAAcDAQA3AgIAA @@ -1086,6 +1086,18 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA + + + YES + custom order + + 2147483647 + + + _popUpItemAction: + 3 + + YES @@ -2270,6 +2282,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA + @@ -2517,6 +2530,11 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA + + 224 + + + @@ -2607,6 +2625,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 221.IBAttributePlaceholdersKey 221.IBPluginDependency 222.IBPluginDependency + 224.IBPluginDependency 24.IBPluginDependency 25.IBAttributePlaceholdersKey 25.IBPluginDependency @@ -2656,9 +2675,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA YES com.apple.InterfaceBuilder.CocoaPlugin - {{284, 107}, {465, 405}} + {{231, 344}, {465, 405}} com.apple.InterfaceBuilder.CocoaPlugin - {{284, 107}, {465, 405}} + {{231, 344}, {465, 405}} {{387, 725}, {432, 282}} @@ -2677,7 +2696,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{126, 403}, {161, 54}} + {{237, 379}, {161, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2803,6 +2822,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -2872,7 +2892,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA - 223 + 224 diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 3c365dcf..a44f5ca2 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -108,6 +108,7 @@ [insertNULLValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] == 1)]; [self updateFieldNameAlignment]; + } - (void)dealloc @@ -311,8 +312,9 @@ } [fieldMapperTableView reloadData]; - // Remember last field alignment - [prefs setInteger:[[alignByPopup selectedItem] tag] forKey:SPCSVFieldImportMappingAlignment]; + // Remember last field alignment if not "custom order" + if([[alignByPopup selectedItem] tag] != 3) + [prefs setInteger:[[alignByPopup selectedItem] tag] forKey:SPCSVFieldImportMappingAlignment]; } /* @@ -411,8 +413,17 @@ // Replace the current map pair with the last selected global value if([replaceAfterSavingCheckBox state] == NSOnState && [globalValuesTableView numberOfSelectedRows] == 1) { + [fieldMappingArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:[NSNumber numberWithInteger:[globalValuesTableView selectedRow]+numberOfImportColumns]]; + + // Set corresponding operator to doImport + [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport]; + [fieldMapperTableView reloadData]; + + // Set alignment popup to "custom order" + [alignByPopup selectItemWithTag:3]; + } [NSApp endSheet:[globalValuesSheet window] returnCode:[sender tag]]; @@ -539,7 +550,7 @@ if([prefs integerForKey:SPCSVFieldImportMappingAlignment] && [prefs integerForKey:SPCSVFieldImportMappingAlignment] >= 0 - && [prefs integerForKey:SPCSVFieldImportMappingAlignment] < 3) { + && [prefs integerForKey:SPCSVFieldImportMappingAlignment] < 4) { alignment = [prefs integerForKey:SPCSVFieldImportMappingAlignment]; } @@ -618,11 +629,11 @@ else if([[aTableColumn identifier] isEqualToString:@"operator"]) { if([aCell objectValue] == doImport) - return NSLocalizedString(@"Do import", @"import operator"); + return NSLocalizedString(@"Import field", @"import field operator tooltip"); else if([aCell objectValue] == doNotImport) - return NSLocalizedString(@"Do not import", @"do not import operator"); + return NSLocalizedString(@"Ignore field", @"ignore field operator tooltip"); else if([aCell objectValue] == isEqual) - return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator"); + return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator tooltip"); else return @""; } @@ -666,6 +677,9 @@ [c addItemsWithTitles:fieldMappingButtonOptions]; [m addItem:[NSMenuItem separatorItem]]; [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field menu item")]; + [c addItemWithTitle:NSLocalizedString(@"Ignore all fields", @"ignore all fields menu item")]; + [c addItemWithTitle:NSLocalizedString(@"Import all fields", @"import all fields menu item")]; + [m addItem:[NSMenuItem separatorItem]]; [c addItemWithTitle:NSLocalizedString(@"Add global value…", @"add global value menu item")]; // Hide csv file column value if user doesn't want to import it @@ -710,14 +724,38 @@ [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport]; [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; } - // Add global value + // Ignore all field - set all operator to doNotImport else if([anObject integerValue] == [fieldMappingButtonOptions count]+2) { + NSInteger i; + NSNumber *globalValue = doNotImport; + [fieldMappingOperatorArray removeAllObjects]; + for(i=0; i < [fieldMappingTableColumnNames count]; i++) + [fieldMappingOperatorArray addObject:globalValue]; + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + } + // Import all field - set all operator to doImport + else if([anObject integerValue] == [fieldMappingButtonOptions count]+3) { + NSInteger i; + NSNumber *globalValue = doImport; + [fieldMappingOperatorArray removeAllObjects]; + for(i=0; i < [fieldMappingTableColumnNames count]; i++) + [fieldMappingOperatorArray addObject:globalValue]; + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + } + // Add global value + else if([anObject integerValue] == [fieldMappingButtonOptions count]+5) { [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; [self addGlobalSourceVariable:nil]; } return; } + + // If user changed the order set alignment popup to "custom order" + if([fieldMappingArray objectAtIndex:rowIndex] != anObject) + [alignByPopup selectItemWithTag:3]; + [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject]; + // If user _changed_ the csv file column set the operator to doImport if([(NSNumber*)anObject integerValue] > -1) [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doImport]; -- cgit v1.2.3