diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-05 21:16:27 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-05 21:16:27 +0000 |
commit | 208110e9cdaeb83737b3ba6badc6b3a8975647c9 (patch) | |
tree | eb546b2b2a327e9591ff0c53d04e4912e54e5e93 /Source | |
parent | 666b48284293e8555b4604745a7abdcf5e01b22a (diff) | |
download | sequelpro-208110e9cdaeb83737b3ba6badc6b3a8975647c9.tar.gz sequelpro-208110e9cdaeb83737b3ba6badc6b3a8975647c9.tar.bz2 sequelpro-208110e9cdaeb83737b3ba6badc6b3a8975647c9.zip |
• CSV Import Field Mapper
- improved some validation logic
- added "Match Field" to source file field popup to be consistent if UPDATE is chosen
- the label "Advanced" is now clickable as well
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPFieldMapperController.m | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 1760d239..5e43398c 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -350,8 +350,10 @@ [[importMethodPopup itemWithTitle:@"UPDATE"] setEnabled:YES]; } else { [[importMethodPopup itemWithTitle:@"UPDATE"] setEnabled:NO]; - if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"UPDATE"]) + if([[importMethodPopup titleOfSelectedItem] isEqualToString:@"UPDATE"]) { [importMethodPopup selectItemWithTitle:@"INSERT"]; + [self changeImportMethod:nil]; + } } [self updateFieldNameAlignment]; @@ -407,7 +409,6 @@ // If operator is set to = for UPDATE method replace it by doNotImport if(![[importMethodPopup titleOfSelectedItem] isEqualToString:@"UPDATE"]) { [advancedButton setEnabled:YES]; - [addRemainingDataSwitch setHidden:YES]; for(i=0; i<[fieldMappingTableColumnNames count]; i++) { if([fieldMappingOperatorArray objectAtIndex:i] == isEqual) { [fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doNotImport]; @@ -553,8 +554,9 @@ [fieldMappingArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:[NSNumber numberWithInteger:[globalValuesTableView selectedRow]+numberOfImportColumns]]; - // Set corresponding operator to doImport - [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport]; + // Set corresponding operator to doImport if not set to isEqual + if([fieldMappingOperatorArray objectAtIndex:[fieldMapperTableView selectedRow]] != isEqual) + [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport]; [fieldMapperTableView reloadData]; @@ -573,8 +575,10 @@ { showAdvancedView = !showAdvancedView; if(showAdvancedView) { + [advancedButton setState:NSOnState]; [self changeImportMethod:nil]; } else { + [advancedButton setState:NSOffState]; [advancedBox setHidden:YES]; [advancedReplaceView setHidden:YES]; [advancedUpdateView setHidden:YES]; @@ -952,6 +956,8 @@ [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field label")]; [c addItemWithTitle:NSLocalizedString(@"Ignore all fields", @"ignore all fields menu item")]; [c addItemWithTitle:NSLocalizedString(@"Import all fields", @"import all fields menu item")]; + if([[self selectedImportMethod] isEqualToString:@"UPDATE"]) + [c addItemWithTitle:NSLocalizedString(@"Match field", @"match field menu item")]; [m addItem:[NSMenuItem separatorItem]]; [c addItemWithTitle:NSLocalizedString(@"Add global value…", @"add global value menu item")]; [c addItemWithTitle:[NSString stringWithFormat:@"DEFAULT: %@", [fieldMappingTableDefaultValues objectAtIndex:rowIndex]]]; @@ -1021,12 +1027,15 @@ [fieldMappingOperatorArray addObject:globalValue]; [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; } + else if([[self selectedImportMethod] isEqualToString:@"UPDATE"] && [anObject integerValue] == [fieldMappingButtonOptions count]+4) { + [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:isEqual]; + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + } // Add global value - else if([anObject integerValue] == [fieldMappingButtonOptions count]+5) { + else if([anObject integerValue] == ([[self selectedImportMethod] isEqualToString:@"UPDATE"]) ? [fieldMappingButtonOptions count]+6 : [fieldMappingButtonOptions count]+5) { [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; [self addGlobalSourceVariable:nil]; } - [self validateImportButton]; return; |