aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2014-12-26 22:54:24 +0100
committerMax <post@wickenrode.com>2014-12-26 22:54:24 +0100
commit19226617658f7452d8f02a68c52556aca6810c36 (patch)
tree31a7e992c6ad1e9ea4c50c8fff8b8d090a1838ce
parentc7362cc8c6d3c02d8e9b5f5a31735bb3fbbf0b02 (diff)
downloadsequelpro-19226617658f7452d8f02a68c52556aca6810c36.tar.gz
sequelpro-19226617658f7452d8f02a68c52556aca6810c36.tar.bz2
sequelpro-19226617658f7452d8f02a68c52556aca6810c36.zip
Fix two minor CSV import dialog issues
* Tooltips were somewhat broken for non-imported fields (issue exists in 1.0.2) * Newly added expressions would cause the field to switch to "do not import" instead of the added expression
-rw-r--r--Source/SPFieldMapperController.m46
1 files changed, 24 insertions, 22 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 2fcf4c9e..418a255f 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -1189,13 +1189,15 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
if(![isEqualKey isEqualToNumber:[fieldMappingOperatorArray objectAtIndex:[fieldMapperTableView selectedRow]]])
[fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImportKey];
- [fieldMapperTableView reloadData];
-
// Set alignment popup to "custom order"
[alignByPopup selectItemWithTag:3];
}
+ // This must happen before orderOut:nil as that might cause the tableview to redraw which would in turn invalidate
+ // a newly added globalValue when updateFieldMappingButtonCell has not been run before.
+ [self updateFieldMappingButtonCell];
+
[NSApp endSheet:globalValuesSheet returnCode:[sender tag]];
}
@@ -1378,7 +1380,6 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
if (sheet == globalValuesSheet) {
addGlobalSheetIsOpen = NO;
- [self updateFieldMappingButtonCell];
}
}
@@ -1682,27 +1683,29 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
if(aTableView == fieldMapperTableView) {
- if ([doNotImportKey isEqual:[fieldMappingOperatorArray objectAtIndex:rowIndex]]) return [NSString stringWithFormat:@"DEFAULT: %@", [fieldMappingTableDefaultValues objectAtIndex:rowIndex]];
+ if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID]) {
- if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOnState) {
+ if ([doNotImportKey isEqual:[fieldMappingOperatorArray objectAtIndex:rowIndex]]) return [NSString stringWithFormat:@"DEFAULT: %@", [fieldMappingTableDefaultValues objectAtIndex:rowIndex]];
- if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
- return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"User-defined value", @"user-defined value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];
+ if([importFieldNamesHeaderSwitch state] == NSOnState) {
+ if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
+ return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"User-defined value", @"user-defined value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];
- 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];
+ 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([importFieldNamesHeaderSwitch state] == NSOffState) {
+ if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
+ return NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
+ else
+ return NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
- else if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOffState) {
- if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
- return NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
- else
- return NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
+ }
}
else if([[aTableColumn identifier] isEqualToString:SPTableViewOperatorColumnID]) {
@@ -1712,12 +1715,11 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
return NSLocalizedString(@"Ignore field", @"ignore field label");
else if([isEqualKey isEqual:[aCell objectValue]])
return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator tooltip");
- else
- return @"";
}
- else if([[aTableColumn identifier] isEqualToString:SPTableViewTargetFieldColumnID])
+ else if([[aTableColumn identifier] isEqualToString:SPTableViewTargetFieldColumnID]) {
return [fieldMappingTableColumnNames objectAtIndex:rowIndex];
+ }
}
else if(aTableView == globalValuesTableView) {
if ([[aTableColumn identifier] isEqualToString:SPTableViewGlobalValueColumnID])