aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DataMigrationDialog.xib54
-rw-r--r--Source/SPFieldMapperController.h6
-rw-r--r--Source/SPFieldMapperController.m31
3 files changed, 73 insertions, 18 deletions
diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib
index 560eb5fb..f908ed52 100644
--- a/Interfaces/English.lproj/DataMigrationDialog.xib
+++ b/Interfaces/English.lproj/DataMigrationDialog.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="13"/>
+ <integer value="133"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -991,7 +991,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<bytes key="NSRGB">MC45Mjk0MTE4Mjg1IDAuOTI5NDExODI4NSAwLjkyOTQxMTgyODUAA</bytes>
</object>
<object class="NSCursor" key="NSCursor">
- <string key="NSHotSpot">{1, -1}</string>
+ <string key="NSHotSpot">{4, 4}</string>
<int key="NSCursorType">0</int>
</object>
<int key="NScvFlags">6</int>
@@ -1033,7 +1033,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="940205369">
- <int key="NSCellFlags">-1539178944</int>
+ <int key="NSCellFlags">-2076049856</int>
<int key="NSCellFlags2">133120</int>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="573115956"/>
@@ -1043,9 +1043,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
- <object class="NSMenuItem" key="NSMenuItem" id="863046035">
+ <object class="NSMenuItem" key="NSMenuItem" id="288483296">
<reference key="NSMenu" ref="877368345"/>
- <string key="NSTitle">matching names</string>
+ <string key="NSTitle">file order</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -1060,29 +1060,33 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string key="NSTitle">OtherViews</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="863046035"/>
- <object class="NSMenuItem" id="288483296">
+ <reference ref="288483296"/>
+ <object class="NSMenuItem" id="771511410">
<reference key="NSMenu" ref="877368345"/>
- <string key="NSTitle">file order</string>
+ <string key="NSTitle">reversed file order</string>
<string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="884724275"/>
<reference key="NSMixedImage" ref="1071040955"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">1</int>
<reference key="NSTarget" ref="940205369"/>
</object>
- <object class="NSMenuItem" id="771511410">
+ <object class="NSMenuItem" id="863046035">
<reference key="NSMenu" ref="877368345"/>
- <string key="NSTitle">reversed file order</string>
+ <bool key="NSIsDisabled">YES</bool>
+ <string key="NSTitle">matching names</string>
<string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="884724275"/>
<reference key="NSMixedImage" ref="1071040955"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">2</int>
<reference key="NSTarget" ref="940205369"/>
</object>
</object>
+ <bool key="NSNoAutoenable">YES</bool>
<reference key="NSMenuFont" ref="388072550"/>
</object>
<int key="NSPreferredEdge">1</int>
@@ -1315,6 +1319,22 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<int key="connectionID">150</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">alignByPopup</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="573115956"/>
+ </object>
+ <int key="connectionID">151</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">changeFieldAlignment:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="573115956"/>
+ </object>
+ <int key="connectionID">152</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1954,9 +1974,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{180, 271}, {465, 405}}</string>
+ <string>{{164, 144}, {465, 405}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{180, 271}, {465, 405}}</string>
+ <string>{{164, 144}, {465, 405}}</string>
<integer value="1"/>
<string>{{387, 725}, {432, 282}}</string>
<integer value="0"/>
@@ -1975,7 +1995,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{186, 334}, {161, 54}}</string>
+ <string>{{170, 196}, {161, 54}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2118,7 +2138,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">150</int>
+ <int key="maxID">152</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2154,6 +2174,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>changeFieldAlignment:</string>
<string>changeImportMethod:</string>
<string>changeTableTarget:</string>
<string>closeSheet:</string>
@@ -2165,12 +2186,14 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>alignByPopup</string>
<string>fieldMapperTableView</string>
<string>fieldMappingImportArray</string>
<string>fileSourcePath</string>
@@ -2185,6 +2208,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
<string>NSTableView</string>
<string>id</string>
<string>NSPathControl</string>
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 623b052a..62139b7d 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -28,14 +28,15 @@
@interface SPFieldMapperController : NSWindowController {
IBOutlet NSTableView *fieldMapperTableView;
- IBOutlet id tableTargetPopup;
+ IBOutlet NSPopUpButton *tableTargetPopup;
IBOutlet NSPathControl *fileSourcePath;
- IBOutlet id importMethodPopup;
+ IBOutlet NSPopUpButton *importMethodPopup;
IBOutlet id rowUpButton;
IBOutlet id rowDownButton;
IBOutlet id recordCountLabel;
IBOutlet id importFieldNamesHeaderSwitch;
IBOutlet id importButton;
+ IBOutlet NSPopUpButton *alignByPopup;
id theDelegate;
id fieldMappingImportArray;
@@ -85,6 +86,7 @@
// IBAction methods
- (IBAction)changeTableTarget:(id)sender;
- (IBAction)changeImportMethod:(id)sender;
+- (IBAction)changeFieldAlignment:(id)sender;
- (IBAction)stepRow:(id)sender;
- (IBAction)closeSheet:(id)sender;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 916d8903..84dfc4c8 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -202,7 +202,9 @@
[type appendFormat:@"(%@)", [column objectForKey:@"length"]];
if([column objectForKey:@"values"])
[type appendFormat:@"(%@)", [[column objectForKey:@"values"] componentsJoinedByString:@"¦"]];
- if([column objectForKey:@"default"])
+ if([column objectForKey:@"autoincrement"] && [[column objectForKey:@"autoincrement"] integerValue] == 1)
+ [type appendFormat:@",%@",@"PRIMARY KEY"];
+ else if ([column objectForKey:@"default"])
[type appendFormat:@",%@",[column objectForKey:@"default"]];
[fieldMappingTableTypes addObject:[NSString stringWithString:type]];
}
@@ -235,6 +237,9 @@
// Disable Import button if no fields are available
[importButton setEnabled:([fieldMappingTableColumnNames count] > 0)];
+
+ [alignByPopup selectItemWithTag:0];
+
[fieldMapperTableView reloadData];
}
@@ -254,6 +259,30 @@
[fieldMapperTableView reloadData];
}
+- (IBAction)changeFieldAlignment:(id)sender
+{
+
+ if(![fieldMappingImportArray count]) return;
+
+ NSInteger i;
+ NSInteger possibleImports = ([NSArrayObjectAtIndex(fieldMappingImportArray, 0) count] > [fieldMappingTableColumnNames count]) ? [fieldMappingTableColumnNames count] : [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count];
+
+ if(possibleImports < 1) return;
+
+ switch([[alignByPopup selectedItem] tag]) {
+ case 0: // file order
+ for(i=0; i<possibleImports; i++)
+ [fieldMappingArray replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:i]];
+ break;
+ case 1: // reversed file order
+ possibleImports--;
+ for(i=possibleImports; i>=0; i--)
+ [fieldMappingArray replaceObjectAtIndex:possibleImports-i withObject:[NSNumber numberWithInteger:i]];
+ break;
+
+ }
+ [fieldMapperTableView reloadData];
+}
/*
* Displays next/previous row in fieldMapping tableView
*/