aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldMapperController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-22 23:19:21 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-22 23:19:21 +0000
commita24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d (patch)
tree574fb0ac9cb5653b8c27b510ba9caba8dd1172b0 /Source/SPFieldMapperController.m
parente4db241d2ddf8f4548355addb207ab6c77967e70 (diff)
downloadsequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.tar.gz
sequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.tar.bz2
sequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.zip
• re-enabled three finger trackpad wiping gesture for controlling the table history
• CSV Import Field Mapper Sheet - fixed issue for inserting a global value containing a ' - started preparations of the "Add value or expression" sheet for future enhancements
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r--Source/SPFieldMapperController.m38
1 files changed, 23 insertions, 15 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 6d3db4f1..1787c6f2 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -282,8 +282,10 @@
for(NSInteger i=0; i < [fieldMappingGlobalValues count]; i++)
if([[fieldMappingGlobalValuesSQLMarked objectAtIndex:i] boolValue])
[globals addObject:[fieldMappingGlobalValues objectAtIndex:i]];
- else
+ else if([[fieldMappingGlobalValues objectAtIndex:i] isKindOfClass:[NSNull class]])
[globals addObject:[NSString stringWithFormat:@"'%@'", [fieldMappingGlobalValues objectAtIndex:i]]];
+ else
+ [globals addObject:[NSString stringWithFormat:@"'%@'", [[fieldMappingGlobalValues objectAtIndex:i] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]]];
return globals;
}
@@ -1070,6 +1072,9 @@
- (IBAction)removeGlobalValue:(id)sender
{
+
+ [globalValuesTableView abortEditing];
+
NSIndexSet *indexes = [globalValuesTableView selectedRowIndexes];
// get last index
@@ -1105,26 +1110,26 @@
- (IBAction)closeGlobalValuesSheet:(id)sender
{
- // Ensure all changes are stored before ordering out
- [globalValuesTableView validateEditing];
- if ([globalValuesTableView numberOfSelectedRows] == 1)
- [globalValuesSheet makeFirstResponder:globalValuesTableView];
+ // Ensure all changes are stored before ordering out
+ [globalValuesTableView validateEditing];
+ if ([globalValuesTableView numberOfSelectedRows] == 1)
+ [globalValuesSheet makeFirstResponder:globalValuesTableView];
- // Replace the current map pair with the last selected global value
- if([replaceAfterSavingCheckBox state] == NSOnState && [globalValuesTableView numberOfSelectedRows] == 1) {
+ // 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]];
+ [fieldMappingArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:[NSNumber numberWithInteger:[globalValuesTableView selectedRow]+numberOfImportColumns]];
- // Set corresponding operator to doImport if not set to isEqual
- if([fieldMappingOperatorArray objectAtIndex:[fieldMapperTableView selectedRow]] != isEqual)
- [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];
+ [fieldMapperTableView reloadData];
- // Set alignment popup to "custom order"
- [alignByPopup selectItemWithTag:3];
+ // Set alignment popup to "custom order"
+ [alignByPopup selectItemWithTag:3];
- }
+ }
[NSApp endSheet:globalValuesSheet returnCode:[sender tag]];
}
@@ -1468,6 +1473,9 @@
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]];
}
+ else if (!newTableMode && [menuItem action] == @selector(insertNULLValue:)) {
+ return ([[globalValuesTableView selectedRowIndexes] count] == 1) ? YES : NO;
+ }
else if (!newTableMode && [menuItem action] == @selector(editColumn:)) {
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableColumnNames objectAtIndex:row]]];