aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldMapperController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-25 08:46:09 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-25 08:46:09 +0000
commitbfa9ccbbe27a8ee93dd89033591c3653e6738dfd (patch)
treeef9a574d85b8c98a0687d7608f47d4d7b1bd43ed /Source/SPFieldMapperController.m
parentd8692ec22b231091c9c73eaf68ec81b834a4cdc0 (diff)
downloadsequelpro-bfa9ccbbe27a8ee93dd89033591c3653e6738dfd.tar.gz
sequelpro-bfa9ccbbe27a8ee93dd89033591c3653e6738dfd.tar.bz2
sequelpro-bfa9ccbbe27a8ee93dd89033591c3653e6738dfd.zip
• CSV Import Field mapper
- fixed issues for tooltips of user-defined values - avoid double-calling the 'add value' sheet since it can be called via popupmenu and keyboard short-cut
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r--Source/SPFieldMapperController.m20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index df944117..c8d865c8 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -1058,12 +1058,16 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
- (IBAction)addGlobalSourceVariable:(id)sender
{
+
+ // Since it can be called via keyboard short-cut as well bail the call if sheet is already open
+ if(addGlobalSheetIsOpen) return;
+
addGlobalSheetIsOpen = YES;
// Init insert pulldown menu
// Remove all dynamic menu items
- while([insertPullDownButton numberOfItems] > 5)
+ while([insertPullDownButton numberOfItems] > (([[self selectedImportMethod] isEqualToString:@"UPDATE"]) ? 6 : 5))
[insertPullDownButton removeItemAtIndex:[insertPullDownButton numberOfItems]-1];
// Add recent global value menu
@@ -1601,7 +1605,7 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOnState) {
if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
- return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Global value", @"global value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];
+ return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"User-defined value", @"user-defined value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];
if(fieldMappingCurrentRow)
return [NSString stringWithFormat:@"%@: %@",
@@ -1613,11 +1617,10 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
}
else if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOffState) {
- id value = NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
- if(value)
- return [value description];
+ if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
+ return NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
else
- return @"";
+ return NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
}
else if([[aTableColumn identifier] isEqualToString:SPTableViewOperatorColumnID]) {
@@ -1645,6 +1648,7 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
{
if(aTableView == fieldMapperTableView) {
+
if ([[aTableColumn identifier] isEqualToString:SPTableViewTargetFieldColumnID]) {
if([toBeEditedRowIndexes containsIndex:rowIndex]) {
NSTextFieldCell *b = [[[NSTextFieldCell alloc] initTextCell:[fieldMappingTableColumnNames objectAtIndex:rowIndex]] autorelease];
@@ -1689,9 +1693,11 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
}
else if ([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID]) {
+
// Check if all global value was deleted, if so set assigned field as doNotImport
- if([[fieldMappingArray objectAtIndex:rowIndex] intValue] >= [fieldMappingButtonOptions count])
+ if([[fieldMappingArray objectAtIndex:rowIndex] intValue] >= [fieldMappingButtonOptions count]) {
[fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport];
+ }
if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {