diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-02-18 17:06:16 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-02-18 17:06:16 +0000 |
commit | 51459eb4c978739e952fd4e576b275ff156aab0b (patch) | |
tree | 4f901e0b25867610220eb55e7d48935077fdc124 /Source/SPFieldMapperController.m | |
parent | 4a774189098f89e4f24a4ff11f6f95d1f049b6a5 (diff) | |
download | sequelpro-51459eb4c978739e952fd4e576b275ff156aab0b.tar.gz sequelpro-51459eb4c978739e952fd4e576b275ff156aab0b.tar.bz2 sequelpro-51459eb4c978739e952fd4e576b275ff156aab0b.zip |
• CSV Import Field Mapper
- added the csv source field popu:
"Ignore field" to set the current field to doNotImport
"Add global value…" which opens the global value sheet
- removed "Add global value" button
Note: still not the optimal solution - further work is needed. esp. avoid jittering if user selects "Ignore field" or "Add value…"
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r-- | Source/SPFieldMapperController.m | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 7ecdb8f0..61a00edc 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -356,6 +356,11 @@ } +// TDOD this won't be called - WHY? ask HansJB +// - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect { +// return NSMakeRect(300,300,50,10); +// } + - (IBAction)addGlobalValue:(id)sender { [fieldMappingGlobalValues addObject:@"<value>"]; @@ -654,8 +659,14 @@ } else if ([[aTableColumn identifier] isEqualToString:@"import_value"]) { if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) { - [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems]; - [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions]; + NSPopUpButtonCell *c = [aTableColumn dataCell]; + NSMenu *m = [c menu]; + [c removeAllItems]; + [c addItemsWithTitles:fieldMappingButtonOptions]; + [m addItem:[NSMenuItem separatorItem]]; + [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field menu item")]; + [c addItemWithTitle:NSLocalizedString(@"Add global value…", @"add global value menu item")]; + // Hide csv file column value if user doesn't want to import it if([fieldMappingOperatorArray objectAtIndex:rowIndex] != doNotImport) return [fieldMappingArray objectAtIndex:rowIndex]; @@ -689,6 +700,20 @@ if(aTableView == fieldMapperTableView) { if ([[aTableColumn identifier] isEqualToString:@"import_value"]) { + if([anObject integerValue] > [fieldMappingButtonOptions count]) { + // Ignore field - set operator to doNotImport + if([anObject integerValue] == [fieldMappingButtonOptions count]+1) { + lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex]; + [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport]; + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + } + // Add global value + else if([anObject integerValue] == [fieldMappingButtonOptions count]+2) { + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + [self addGlobalSourceVariable:nil]; + } + return; + } [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject]; // If user _changed_ the csv file column set the operator to doImport if([(NSNumber*)anObject integerValue] > -1) |