aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFieldMapperController.h2
-rw-r--r--Source/SPFieldMapperController.m33
2 files changed, 24 insertions, 11 deletions
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 8a70df90..813a3b3e 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -76,6 +76,7 @@
IBOutlet id highPriorityCheckBox;
IBOutlet id skipexistingRowsCheckBox;
IBOutlet SPTextView *onupdateTextView;
+ IBOutlet id gobackButton;
IBOutlet id advancedButton;
@@ -171,6 +172,7 @@
- (IBAction)openAdvancedSheet:(id)sender;
- (IBAction)closeSheet:(id)sender;
- (IBAction)goBackToFileChooser:(id)sender;
+- (IBAction)goBackToFileChooserFromPathControl:(id)sender;
- (IBAction)addGlobalValue:(id)sender;
- (IBAction)removeGlobalValue:(id)sender;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 221a8e75..b77ca98e 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -121,7 +121,7 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
[pc setURL:[NSURL fileURLWithPath:sourcePath]];
if([pc pathComponentCells])
[fileSourcePath setPathComponentCells:[pc pathComponentCells]];
- [fileSourcePath setDoubleAction:@selector(goBackToFileChooser:)];
+ [fileSourcePath setDoubleAction:@selector(goBackToFileChooserFromPathControl:)];
[onupdateTextView setDelegate:theDelegate];
windowMinWidth = [[self window] minSize].width;
@@ -701,15 +701,24 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
if(possibleImports < 1) return;
+ // Set all operators to doNotImport
+ [fieldMappingOperatorArray removeAllObjects];
+ for(i=0; i < [fieldMappingTableColumnNames count]; i++)
+ [fieldMappingOperatorArray addObject:doNotImport];
+
switch([[alignByPopup selectedItem] tag]) {
case 0: // file order
- for(i=0; i<possibleImports; i++)
+ for(i=0; i<possibleImports; i++) {
[fieldMappingArray replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:i]];
+ [fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doImport];
+ }
break;
case 1: // reversed file order
possibleImports--;
- for(i=possibleImports; i>=0; i--)
+ for(i=possibleImports; i>=0; i--) {
[fieldMappingArray replaceObjectAtIndex:possibleImports-i withObject:[NSNumber numberWithInteger:i]];
+ [fieldMappingOperatorArray replaceObjectAtIndex:possibleImports-i withObject:doImport];
+ }
break;
case 2: // try to align header and table target field names via Levenshtein distance
[self matchHeaderNames];
@@ -764,14 +773,21 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
}
}
+- (IBAction)goBackToFileChooserFromPathControl:(id)sender
+{
+ [gobackButton performSelector:@selector(performClick:) withObject:nil afterDelay:0.0f];
+}
+
- (IBAction)goBackToFileChooser:(id)sender
{
+
[NSApp endSheet:[self window] returnCode:[sender tag]];
- if([sourcePath hasPrefix:SPImportClipboardTempFileNamePrefix]) {
+
+ if([sourcePath hasPrefix:SPImportClipboardTempFileNamePrefix])
[theDelegate importFromClipboard];
- } else {
+ else
[theDelegate importFile];
- }
+
}
- (IBAction)newTable:(id)sender
@@ -1361,11 +1377,6 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
{
if(![fieldMappingImportArray count]) return;
- // Set all operators to doNotImport
- [fieldMappingOperatorArray removeAllObjects];
- for(NSInteger i=0; i < [fieldMappingTableColumnNames count]; i++)
- [fieldMappingOperatorArray addObject:doNotImport];
-
NSMutableArray *fileHeaderNames = [NSMutableArray array];
[fileHeaderNames setArray:NSArrayObjectAtIndex(fieldMappingImportArray, 0)];
NSMutableArray *tableHeaderNames = [NSMutableArray array];