aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DataMigrationDialog.xib602
-rw-r--r--Resources/PreferenceDefaults.plist2
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPFieldMapperController.h14
-rw-r--r--Source/SPFieldMapperController.m334
6 files changed, 841 insertions, 113 deletions
diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib
index 195ff58d..1e4332df 100644
--- a/Interfaces/English.lproj/DataMigrationDialog.xib
+++ b/Interfaces/English.lproj/DataMigrationDialog.xib
@@ -12,6 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="162"/>
<integer value="12"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
@@ -393,7 +394,7 @@
<bytes key="NSRGB">MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA</bytes>
</object>
</object>
- <object class="NSColor" key="NSGridColor">
+ <object class="NSColor" key="NSGridColor" id="406268685">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">gridColor</string>
@@ -991,7 +992,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<bytes key="NSRGB">MC45Mjk0MTE4Mjg1IDAuOTI5NDExODI4NSAwLjkyOTQxMTgyODUAA</bytes>
</object>
<object class="NSCursor" key="NSCursor">
- <string key="NSHotSpot">{4, 4}</string>
+ <string key="NSHotSpot">{1, -1}</string>
<int key="NSCursorType">0</int>
</object>
<int key="NScvFlags">6</int>
@@ -1125,9 +1126,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="42651750"/>
<int key="NSButtonFlags">-2038152961</int>
- <int key="NSButtonFlags2">164</int>
+ <int key="NSButtonFlags2">402653348</int>
<string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
+ <string key="NSKeyEquivalent">a</string>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
@@ -1152,18 +1153,18 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference key="NSTextColor" ref="263116164"/>
</object>
</object>
- <object class="NSButton" id="425457435">
+ <object class="NSButton" id="148795893">
<reference key="NSNextResponder" ref="78582513"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{192, 14}, {82, 32}}</string>
<reference key="NSSuperview" ref="78582513"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="485421130">
+ <object class="NSButtonCell" key="NSCell" id="538595338">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Go Back</string>
<reference key="NSSupport" ref="388072550"/>
- <reference key="NSControlView" ref="425457435"/>
+ <reference key="NSControlView" ref="148795893"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">134217857</int>
<string key="NSAlternateContents"/>
@@ -1181,6 +1182,285 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPCSVFieldMappingSheet</string>
</object>
+ <object class="NSWindowTemplate" id="280523396">
+ <int key="NSWindowStyleMask">15</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{131, 320}, {238, 182}}</string>
+ <int key="NSWTFlags">880279552</int>
+ <string key="NSWindowTitle">Window</string>
+ <string key="NSWindowClass">NSWindow</string>
+ <nil key="NSViewClass"/>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSWindowContentMinSize">{238, 182}</string>
+ <object class="NSView" key="NSWindowView" id="803374494">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSScrollView" id="466562755">
+ <reference key="NSNextResponder" ref="803374494"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="153719181">
+ <reference key="NSNextResponder" ref="466562755"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableView" id="666379639">
+ <reference key="NSNextResponder" ref="153719181"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{238, 106}</string>
+ <reference key="NSSuperview" ref="153719181"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTableHeaderView" key="NSHeaderView" id="293135471">
+ <reference key="NSNextResponder" ref="236935166"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{238, 17}</string>
+ <reference key="NSSuperview" ref="236935166"/>
+ <reference key="NSTableView" ref="666379639"/>
+ </object>
+ <object class="_NSCornerView" key="NSCornerView" id="535120964">
+ <reference key="NSNextResponder" ref="466562755"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{224, 0}, {16, 17}}</string>
+ <reference key="NSSuperview" ref="466562755"/>
+ </object>
+ <object class="NSMutableArray" key="NSTableColumns">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableColumn" id="1031370429">
+ <string key="NSIdentifier">value_index</string>
+ <double key="NSWidth">30</double>
+ <double key="NSMinWidth">30</double>
+ <double key="NSMaxWidth">1000</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">67110912</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
+ </object>
+ <reference key="NSTextColor" ref="186205954"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="234960425">
+ <int key="NSCellFlags">67239488</int>
+ <int key="NSCellFlags2">67241984</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="666379639"/>
+ <reference key="NSBackgroundColor" ref="518286732"/>
+ <reference key="NSTextColor" ref="263116164"/>
+ </object>
+ <int key="NSResizingMask">1</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <reference key="NSTableView" ref="666379639"/>
+ </object>
+ <object class="NSTableColumn" id="1070769052">
+ <string key="NSIdentifier">global_value</string>
+ <double key="NSWidth">202</double>
+ <double key="NSMinWidth">10</double>
+ <double key="NSMaxWidth">3.4028234663852886e+38</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">Global Source Values</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="646298629"/>
+ <reference key="NSTextColor" ref="186205954"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="871456037">
+ <int key="NSCellFlags">337772096</int>
+ <int key="NSCellFlags2">133120</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="666379639"/>
+ <reference key="NSBackgroundColor" ref="518286732"/>
+ <reference key="NSTextColor" ref="263116164"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="666379639"/>
+ </object>
+ </object>
+ <double key="NSIntercellSpacingWidth">3</double>
+ <double key="NSIntercellSpacingHeight">2</double>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">_sourceListBackgroundColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA</bytes>
+ </object>
+ </object>
+ <reference key="NSGridColor" ref="406268685"/>
+ <double key="NSRowHeight">14</double>
+ <int key="NSTvFlags">1589641216</int>
+ <reference key="NSDelegate"/>
+ <reference key="NSDataSource"/>
+ <int key="NSColumnAutoresizingStyle">4</int>
+ <int key="NSDraggingSourceMaskForLocal">15</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ <int key="NSTableViewSelectionHighlightStyle">1</int>
+ <int key="NSTableViewDraggingDestinationStyle">1</int>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 17}, {238, 106}}</string>
+ <reference key="NSSuperview" ref="466562755"/>
+ <reference key="NSNextKeyView" ref="666379639"/>
+ <reference key="NSDocView" ref="666379639"/>
+ <reference key="NSBGColor" ref="518286732"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="818055239">
+ <reference key="NSNextResponder" ref="466562755"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-100, -100}, {15, 102}}</string>
+ <reference key="NSSuperview" ref="466562755"/>
+ <reference key="NSTarget" ref="466562755"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">0.87179487943649292</double>
+ </object>
+ <object class="NSScroller" id="180324869">
+ <reference key="NSNextResponder" ref="466562755"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-100, -100}, {238, 15}}</string>
+ <reference key="NSSuperview" ref="466562755"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="466562755"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.9834710955619812</double>
+ </object>
+ <object class="NSClipView" id="236935166">
+ <reference key="NSNextResponder" ref="466562755"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="293135471"/>
+ </object>
+ <string key="NSFrame">{{1, 0}, {238, 17}}</string>
+ <reference key="NSSuperview" ref="466562755"/>
+ <reference key="NSNextKeyView" ref="293135471"/>
+ <reference key="NSDocView" ref="293135471"/>
+ <reference key="NSBGColor" ref="518286732"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <reference ref="535120964"/>
+ </object>
+ <string key="NSFrame">{{-1, 48}, {240, 124}}</string>
+ <reference key="NSSuperview" ref="803374494"/>
+ <reference key="NSNextKeyView" ref="153719181"/>
+ <int key="NSsFlags">530</int>
+ <reference key="NSVScroller" ref="818055239"/>
+ <reference key="NSHScroller" ref="180324869"/>
+ <reference key="NSContentView" ref="153719181"/>
+ <reference key="NSHeaderClipView" ref="236935166"/>
+ <reference key="NSCornerView" ref="535120964"/>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBgAAAQYAAAA</bytes>
+ </object>
+ <object class="NSButton" id="380321495">
+ <reference key="NSNextResponder" ref="803374494"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 13}, {20, 23}}</string>
+ <reference key="NSSuperview" ref="803374494"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1062542413">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="380321495"/>
+ <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags2">402653346</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSAddTemplate</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">a</string>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="102647677">
+ <reference key="NSNextResponder" ref="803374494"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{39, 13}, {20, 23}}</string>
+ <reference key="NSSuperview" ref="803374494"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="87720389">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="102647677"/>
+ <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags2">268435618</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSRemoveTemplate</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"></string>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="78067671">
+ <reference key="NSNextResponder" ref="803374494"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{163, 9}, {60, 28}}</string>
+ <reference key="NSSuperview" ref="803374494"/>
+ <int key="NSTag">1</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="360762154">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents">Save</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="78067671"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="792790228">
+ <reference key="NSNextResponder" ref="803374494"/>
+ <int key="NSvFlags">-2147483359</int>
+ <string key="NSFrame">{{105, 9}, {60, 28}}</string>
+ <reference key="NSSuperview" ref="803374494"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="720791357">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134348800</int>
+ <string key="NSContents">Close</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="792790228"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{238, 182}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
+ <string key="NSMinSize">{238, 204}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSFrameAutosaveName">SPGlobalValuesSheet</string>
+ </object>
<object class="NSUserDefaultsController" id="443551699">
<bool key="NSSharedInstance">YES</bool>
</object>
@@ -1384,10 +1664,90 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<object class="IBActionConnection" key="connection">
<string key="label">goBackToFileChooser:</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="425457435"/>
+ <reference key="destination" ref="148795893"/>
</object>
<int key="connectionID">159</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="666379639"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">179</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="666379639"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">180</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">globalValuesSheet</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="803374494"/>
+ </object>
+ <int key="connectionID">181</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">globalValuesTableView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="666379639"/>
+ </object>
+ <int key="connectionID">182</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">removeGlobalValue:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="102647677"/>
+ </object>
+ <int key="connectionID">183</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">addGlobalValueButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="380321495"/>
+ </object>
+ <int key="connectionID">185</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">removeGlobalValueButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="102647677"/>
+ </object>
+ <int key="connectionID">186</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closeGlobalValuesSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="78067671"/>
+ </object>
+ <int key="connectionID">187</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closeGlobalValuesSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="792790228"/>
+ </object>
+ <int key="connectionID">188</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">addGlobalValue:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="380321495"/>
+ </object>
+ <int key="connectionID">189</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1424,7 +1784,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference ref="78582513"/>
</object>
<reference key="parent" ref="0"/>
- <string key="objectName">CSV Field Mapping Sheet New</string>
+ <string key="objectName">CSV Field Mapping Sheet</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
@@ -1448,7 +1808,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference ref="155260473"/>
<reference ref="42651750"/>
<reference ref="746818659"/>
- <reference ref="425457435"/>
+ <reference ref="148795893"/>
</object>
<reference key="parent" ref="420604405"/>
</object>
@@ -1922,17 +2282,161 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<object class="IBObjectRecord">
<int key="objectID">157</int>
- <reference key="object" ref="425457435"/>
+ <reference key="object" ref="148795893"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="485421130"/>
+ <reference ref="538595338"/>
</object>
<reference key="parent" ref="78582513"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">158</int>
- <reference key="object" ref="485421130"/>
- <reference key="parent" ref="425457435"/>
+ <reference key="object" ref="538595338"/>
+ <reference key="parent" ref="148795893"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">160</int>
+ <reference key="object" ref="280523396"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="803374494"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Global Values Sheet</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">161</int>
+ <reference key="object" ref="803374494"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="466562755"/>
+ <reference ref="380321495"/>
+ <reference ref="102647677"/>
+ <reference ref="78067671"/>
+ <reference ref="792790228"/>
+ </object>
+ <reference key="parent" ref="280523396"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">162</int>
+ <reference key="object" ref="466562755"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="818055239"/>
+ <reference ref="180324869"/>
+ <reference ref="666379639"/>
+ <reference ref="293135471"/>
+ </object>
+ <reference key="parent" ref="803374494"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">163</int>
+ <reference key="object" ref="818055239"/>
+ <reference key="parent" ref="466562755"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">164</int>
+ <reference key="object" ref="180324869"/>
+ <reference key="parent" ref="466562755"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">165</int>
+ <reference key="object" ref="666379639"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1031370429"/>
+ <reference ref="1070769052"/>
+ </object>
+ <reference key="parent" ref="466562755"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">166</int>
+ <reference key="object" ref="293135471"/>
+ <reference key="parent" ref="466562755"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">167</int>
+ <reference key="object" ref="1031370429"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="234960425"/>
+ </object>
+ <reference key="parent" ref="666379639"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">170</int>
+ <reference key="object" ref="234960425"/>
+ <reference key="parent" ref="1031370429"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">171</int>
+ <reference key="object" ref="380321495"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1062542413"/>
+ </object>
+ <reference key="parent" ref="803374494"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">172</int>
+ <reference key="object" ref="1062542413"/>
+ <reference key="parent" ref="380321495"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">173</int>
+ <reference key="object" ref="102647677"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="87720389"/>
+ </object>
+ <reference key="parent" ref="803374494"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">174</int>
+ <reference key="object" ref="87720389"/>
+ <reference key="parent" ref="102647677"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">175</int>
+ <reference key="object" ref="78067671"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="360762154"/>
+ </object>
+ <reference key="parent" ref="803374494"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">176</int>
+ <reference key="object" ref="360762154"/>
+ <reference key="parent" ref="78067671"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">177</int>
+ <reference key="object" ref="792790228"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="720791357"/>
+ </object>
+ <reference key="parent" ref="803374494"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">178</int>
+ <reference key="object" ref="720791357"/>
+ <reference key="parent" ref="792790228"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">190</int>
+ <reference key="object" ref="1070769052"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="871456037"/>
+ </object>
+ <reference key="parent" ref="666379639"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">191</int>
+ <reference key="object" ref="871456037"/>
+ <reference key="parent" ref="1070769052"/>
</object>
</object>
</object>
@@ -1986,13 +2490,37 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string>16.IBAttributePlaceholdersKey</string>
<string>16.IBPluginDependency</string>
<string>16.ImportedFromIB2</string>
+ <string>160.IBEditorWindowLastContentRect</string>
+ <string>160.IBPluginDependency</string>
+ <string>160.IBWindowTemplateEditedContentRect</string>
+ <string>160.NSWindowTemplate.visibleAtLaunch</string>
+ <string>160.windowTemplate.hasMinSize</string>
+ <string>160.windowTemplate.minSize</string>
+ <string>161.IBPluginDependency</string>
+ <string>162.IBPluginDependency</string>
+ <string>163.IBPluginDependency</string>
+ <string>164.IBPluginDependency</string>
+ <string>165.IBPluginDependency</string>
+ <string>166.IBPluginDependency</string>
+ <string>167.IBPluginDependency</string>
<string>17.IBAttributePlaceholdersKey</string>
<string>17.IBPluginDependency</string>
<string>17.ImportedFromIB2</string>
+ <string>170.IBPluginDependency</string>
+ <string>171.IBPluginDependency</string>
+ <string>172.IBPluginDependency</string>
+ <string>173.IBPluginDependency</string>
+ <string>174.IBPluginDependency</string>
+ <string>175.IBPluginDependency</string>
+ <string>176.IBPluginDependency</string>
+ <string>177.IBPluginDependency</string>
+ <string>178.IBPluginDependency</string>
<string>18.IBAttributePlaceholdersKey</string>
<string>18.IBPluginDependency</string>
<string>18.ImportedFromIB2</string>
<string>19.IBPluginDependency</string>
+ <string>190.IBPluginDependency</string>
+ <string>191.IBPluginDependency</string>
<string>20.IBAttributePlaceholdersKey</string>
<string>20.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
@@ -2045,9 +2573,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{120, 351}, {465, 405}}</string>
+ <string>{{148, 457}, {465, 405}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{120, 351}, {465, 405}}</string>
+ <string>{{148, 457}, {465, 405}}</string>
<integer value="1"/>
<string>{{387, 725}, {432, 282}}</string>
<integer value="0"/>
@@ -2102,7 +2630,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
- <reference key="object" ref="425457435"/>
+ <reference key="object" ref="148795893"/>
<string key="toolTip">Go back to file chooser (⌥←)</string>
</object>
</object>
@@ -2118,6 +2646,19 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>{{578, 587}, {238, 182}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{578, 587}, {238, 182}}</string>
+ <boolean value="NO"/>
+ <boolean value="YES"/>
+ <string>{238, 182}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -2128,6 +2669,15 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -2139,6 +2689,8 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -2219,7 +2771,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">159</int>
+ <int key="maxID">191</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2256,12 +2808,15 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addGlobalSourceVariable:</string>
+ <string>addGlobalValue:</string>
<string>changeFieldAlignment:</string>
<string>changeHasHeaderCheckbox:</string>
<string>changeImportMethod:</string>
<string>changeTableTarget:</string>
+ <string>closeGlobalValuesSheet:</string>
<string>closeSheet:</string>
<string>goBackToFileChooser:</string>
+ <string>removeGlobalValue:</string>
<string>stepRow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -2274,21 +2829,28 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string>id</string>
<string>id</string>
<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>addGlobalValueButton</string>
<string>alignByPopup</string>
<string>fieldMapperTableView</string>
<string>fieldMappingImportArray</string>
<string>fileSourcePath</string>
+ <string>globalValuesSheet</string>
+ <string>globalValuesTableView</string>
<string>importButton</string>
<string>importFieldNamesHeaderSwitch</string>
<string>importMethodPopup</string>
<string>matchingNameMenuItem</string>
<string>recordCountLabel</string>
+ <string>removeGlobalValueButton</string>
<string>rowDownButton</string>
<string>rowUpButton</string>
<string>tableTargetPopup</string>
@@ -2296,15 +2858,19 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButton</string>
<string>NSPopUpButton</string>
<string>NSTableView</string>
<string>id</string>
<string>NSPathControl</string>
<string>id</string>
+ <string>NSTableView</string>
+ <string>id</string>
<string>id</string>
<string>NSPopUpButton</string>
<string>NSMenuItem</string>
<string>id</string>
+ <string>NSButton</string>
<string>id</string>
<string>id</string>
<string>NSPopUpButton</string>
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index 76eda386..18b71f09 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -139,5 +139,7 @@
<true/>
<key>BlobTextEditorSpellCheckingEnabled</key>
<false/>
+ <key>CSVFieldImportMappingAlignment</key>
+ <integer>2</integer>
</dict>
</plist>
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 86753569..db38835d 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -152,6 +152,7 @@ extern NSString *SPCSVImportLineTerminator;
extern NSString *SPCSVImportFieldEnclosedBy;
extern NSString *SPCSVImportFieldEscapeCharacter;
extern NSString *SPCSVImportFirstLineIsHeader;
+extern NSString *SPCSVFieldImportMappingAlignment;
// Misc
extern NSString *SPContentFilters;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 42859673..338d15d4 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -120,6 +120,7 @@ NSString *SPCSVImportFieldEscapeCharacter = @"CSVImportFieldEscapeCharact
NSString *SPCSVImportFieldTerminator = @"CSVImportFieldTerminator";
NSString *SPCSVImportFirstLineIsHeader = @"CSVImportFirstLineIsHeader";
NSString *SPCSVImportLineTerminator = @"CSVImportLineTerminator";
+NSString *SPCSVFieldImportMappingAlignment = @"CSVFieldImportMappingAlignment";
// Misc
NSString *SPContentFilters = @"ContentFilters";
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 8a2caf15..5f55abe4 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -28,6 +28,7 @@
@interface SPFieldMapperController : NSWindowController {
IBOutlet NSTableView *fieldMapperTableView;
+ IBOutlet NSTableView *globalValuesTableView;
IBOutlet NSPopUpButton *tableTargetPopup;
IBOutlet NSPathControl *fileSourcePath;
IBOutlet NSPopUpButton *importMethodPopup;
@@ -39,17 +40,21 @@
IBOutlet NSPopUpButton *alignByPopup;
IBOutlet NSMenuItem *matchingNameMenuItem;
+ IBOutlet id globalValuesSheet;
+ IBOutlet NSButton *addGlobalValueButton;
+ IBOutlet NSButton *removeGlobalValueButton;
+
id theDelegate;
id fieldMappingImportArray;
NSInteger fieldMappingCurrentRow;
NSMutableArray *fieldMappingArray;
NSMutableArray *fieldMappingTableColumnNames;
- // NSMutableArray *fieldMappingTableDefaultValues;
NSMutableArray *fieldMappingTableTypes;
NSMutableArray *fieldMappingButtonOptions;
NSMutableArray *fieldMappingOperatorOptions;
NSMutableArray *fieldMappingOperatorArray;
+ NSMutableArray *fieldMappingGlobalValues;
NSNumber *doImport;
NSNumber *doNotImport;
@@ -58,6 +63,8 @@
NSString *doNotImportString;
NSString *isEqualString;
+ NSInteger numberOfImportColumns;
+
BOOL fieldMappingImportArrayIsPreview;
BOOL importFieldNamesHeader;
NSNumber *lastDisabledCSVFieldcolumn;
@@ -94,10 +101,15 @@
- (IBAction)closeSheet:(id)sender;
- (IBAction)goBackToFileChooser:(id)sender;
+- (IBAction)addGlobalValue:(id)sender;
+- (IBAction)removeGlobalValue:(id)sender;
+- (IBAction)closeGlobalValuesSheet:(id)sender;
+
// Others
- (void)matchHeaderNames;
- (void)setupFieldMappingArray;
- (void)updateFieldMappingButtonCell;
- (void)updateFieldMappingOperatorOptions;
+- (void)updateFieldNameAlignment;
@end
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 7dc0a3eb..4313dc59 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -58,6 +58,7 @@
fieldMappingButtonOptions = [[NSMutableArray alloc] init];
fieldMappingOperatorOptions = [[NSMutableArray alloc] init];
fieldMappingOperatorArray = [[NSMutableArray alloc] init];
+ fieldMappingGlobalValues = [[NSMutableArray alloc] init];
fieldMappingArray = nil;
lastDisabledCSVFieldcolumn = [NSNumber numberWithInteger:0];
@@ -103,6 +104,9 @@
if([fieldMappingTableColumnNames count])
[fieldMapperTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
+ [removeGlobalValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] > 0)];
+
+ [self updateFieldNameAlignment];
}
- (void)dealloc
@@ -110,12 +114,12 @@
if (mySQLConnection) [mySQLConnection release];
if (sourcePath) [sourcePath release];
if (fieldMappingTableColumnNames) [fieldMappingTableColumnNames release];
- // if (fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release];
if (fieldMappingTableTypes) [fieldMappingTableTypes release];
if (fieldMappingArray) [fieldMappingArray release];
if (fieldMappingButtonOptions) [fieldMappingButtonOptions release];
if (fieldMappingOperatorOptions) [fieldMappingOperatorOptions release];
if (fieldMappingOperatorArray) [fieldMappingOperatorArray release];
+ if (fieldMappingGlobalValues) [fieldMappingGlobalValues release];
[super dealloc];
}
@@ -130,9 +134,22 @@
- (void)setImportDataArray:(id)theFieldMappingImportArray hasHeader:(BOOL)hasHeader isPreview:(BOOL)isPreview
{
+
+ numberOfImportColumns = 0;
+
+ [fieldMappingGlobalValues removeAllObjects];
+
fieldMappingImportArray = theFieldMappingImportArray;
importFieldNamesHeader = hasHeader;
fieldMappingImportArrayIsPreview = isPreview;
+
+ if([fieldMappingImportArray count])
+ numberOfImportColumns = [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count];
+
+ NSInteger i;
+ for(i=0; i<numberOfImportColumns; i++)
+ [fieldMappingGlobalValues addObject:@"…"];
+
}
#pragma mark -
@@ -241,7 +258,7 @@
// Disable Import button if no fields are available
[importButton setEnabled:([fieldMappingTableColumnNames count] > 0)];
- [alignByPopup selectItemWithTag:0];
+ [self updateFieldNameAlignment];
[fieldMapperTableView reloadData];
@@ -287,6 +304,10 @@
break;
}
[fieldMapperTableView reloadData];
+
+ // Remember last field alignment
+ [prefs setInteger:[[alignByPopup selectedItem] tag] forKey:SPCSVFieldImportMappingAlignment];
+
}
/*
* Displays next/previous row in fieldMapping tableView
@@ -314,20 +335,69 @@
[matchingNameMenuItem setEnabled:([importFieldNamesHeaderSwitch state] == NSOnState)?YES:NO];
}
+- (IBAction)goBackToFileChooser:(id)sender
+{
+ [NSApp endSheet:[self window] returnCode:[sender tag]];
+ [theDelegate importFile];
+}
+
- (IBAction)addGlobalSourceVariable:(id)sender
{
+ [NSApp beginSheet:[globalValuesSheet window]
+ modalForWindow:[self window]
+ modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
}
-- (IBAction)goBackToFileChooser:(id)sender
+- (IBAction)addGlobalValue:(id)sender
{
- [NSApp endSheet:[self window] returnCode:[sender tag]];
- [theDelegate importFile];
+ [fieldMappingGlobalValues addObject:@"<value>"];
+ [globalValuesTableView reloadData];
+ [globalValuesTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[fieldMappingGlobalValues count]-1-numberOfImportColumns] byExtendingSelection:NO];
+ [globalValuesTableView editColumn:1 row:[fieldMappingGlobalValues count]-1-numberOfImportColumns withEvent:nil select:YES];
+}
+
+- (IBAction)removeGlobalValue:(id)sender
+{
+ NSIndexSet *indexes = [globalValuesTableView selectedRowIndexes];
+
+ // get last index
+ NSUInteger currentIndex = [indexes lastIndex];
+
+ while (currentIndex != NSNotFound) {
+ [fieldMappingGlobalValues removeObjectAtIndex:currentIndex+numberOfImportColumns];
+ // get next index (beginning from the end)
+ currentIndex = [indexes indexLessThanIndex:currentIndex];
+ }
+
+ [globalValuesTableView reloadData];
+
+ // Set focus to favorite list to avoid an unstable state
+ [[globalValuesSheet window] makeFirstResponder:globalValuesTableView];
+
+ [removeGlobalValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] > 0)];
+}
+
+- (IBAction)closeGlobalValuesSheet:(id)sender
+{
+
+ // Ensure all changes are stored before ordering out
+ [globalValuesTableView validateEditing];
+ if ([globalValuesTableView numberOfSelectedRows] == 1)
+ [[globalValuesSheet window] makeFirstResponder:globalValuesTableView];
+
+ [NSApp endSheet:[globalValuesSheet window] returnCode:[sender tag]];
}
#pragma mark -
#pragma mark Others
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+ [[globalValuesSheet window] orderOut:self];
+}
+
- (void)matchHeaderNames
{
if(![fieldMappingImportArray count]) return;
@@ -352,7 +422,17 @@
if(dist == 0.0f) [matchedHeaderNames addObject:headerName];
}
[fieldMappingArray replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:minIndex]];
+ [fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doImport];
}
+
+ // If a pair with distance 0 was found set doNotImport to those fields which are still mapped
+ // to such csv file header name
+ if([matchedHeaderNames count])
+ for(i=0; i < [tableHeaderNames count]; i++) {
+ NSString *mappedFileHeaderName = [NSArrayObjectAtIndex(fileHeaderNames, [[fieldMappingArray objectAtIndex:i] integerValue]) lowercaseString];
+ if([matchedHeaderNames containsObject:mappedFileHeaderName] && ![mappedFileHeaderName isEqualToString:[NSArrayObjectAtIndex(tableHeaderNames, i) lowercaseString]])
+ [fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doNotImport];
+ }
}
/*
@@ -409,13 +489,41 @@
}
}
+/*
+ * Set field name alignment to default
+ */
+- (void)updateFieldNameAlignment
+{
+
+ NSInteger alignment = 0;
+
+ if([prefs integerForKey:SPCSVFieldImportMappingAlignment]
+ && [prefs integerForKey:SPCSVFieldImportMappingAlignment] >= 0
+ && [prefs integerForKey:SPCSVFieldImportMappingAlignment] < 3) {
+ alignment = [prefs integerForKey:SPCSVFieldImportMappingAlignment];
+ }
+
+ // Set matching names only if csv file has an header
+ if(importFieldNamesHeader && alignment == 2)
+ [alignByPopup selectItemWithTag:2];
+ else if(!importFieldNamesHeader && alignment == 2)
+ [alignByPopup selectItemWithTag:0];
+ else
+ [alignByPopup selectItemWithTag:alignment];
+
+ [self changeFieldAlignment:nil];
+
+}
#pragma mark -
#pragma mark Table view datasource methods
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
{
- return [fieldMappingTableColumnNames count];
+ if(aTableView == fieldMapperTableView)
+ return [fieldMappingTableColumnNames count];
+ else if(aTableView == globalValuesTableView)
+ return [fieldMappingGlobalValues count] - numberOfImportColumns;
}
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
@@ -423,118 +531,156 @@
[aCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
}
-- (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)aTableColumn
+- (void)tableView:(NSTableView*)aTableView didClickTableColumn:(NSTableColumn *)aTableColumn
{
- // A click at the operator column's header toggles all operators
- if ([[aTableColumn identifier] isEqualToString:@"operator"]
- && [self numberOfRowsInTableView:tableView]
- && [fieldMappingOperatorArray count]
- && [fieldMappingTableColumnNames count]) {
- NSInteger i;
- NSNumber *globalValue = doImport;
- if([fieldMappingOperatorArray objectAtIndex:0] == doImport) {
- globalValue = doNotImport;
- // NSTextFieldCell *c = [[[NSTextFieldCell alloc] init] autorelease];
- // [c setStringValue:doNotImportString];
- // [aTableColumn setHeaderCell:c];
- } else {
- // NSTextFieldCell *c = [[[NSTextFieldCell alloc] init] autorelease];
- // [c setStringValue:doImportString];
- // [aTableColumn setHeaderCell:c];
- }
- [fieldMappingOperatorArray removeAllObjects];
- for(i=0; i < [fieldMappingTableColumnNames count]; i++)
- [fieldMappingOperatorArray addObject:globalValue];
- [fieldMapperTableView reloadData];
- }
-
+ if(aTableView == fieldMapperTableView) {
+ // A click at the operator column's header toggles all operators
+ if ([[aTableColumn identifier] isEqualToString:@"operator"]
+ && [self numberOfRowsInTableView:aTableView]
+ && [fieldMappingOperatorArray count]
+ && [fieldMappingTableColumnNames count]) {
+ NSInteger i;
+ NSNumber *globalValue = doImport;
+ if([fieldMappingOperatorArray objectAtIndex:0] == doImport) {
+ globalValue = doNotImport;
+ // NSTextFieldCell *c = [[[NSTextFieldCell alloc] init] autorelease];
+ // [c setStringValue:doNotImportString];
+ // [aTableColumn setHeaderCell:c];
+ } else {
+ // NSTextFieldCell *c = [[[NSTextFieldCell alloc] init] autorelease];
+ // [c setStringValue:doImportString];
+ // [aTableColumn setHeaderCell:c];
+ }
+ [fieldMappingOperatorArray removeAllObjects];
+ for(i=0; i < [fieldMappingTableColumnNames count]; i++)
+ [fieldMappingOperatorArray addObject:globalValue];
+ [fieldMapperTableView reloadData];
+ }
+ }
}
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex mouseLocation:(NSPoint)mouseLocation
{
- if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) {
- if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return @"";
- 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(aTableView == fieldMapperTableView) {
+ if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) {
+ if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return @"";
+ 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([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOffState)
+ return [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description];
+ else if([[aTableColumn identifier] isEqualToString:@"operator"]) {
+ if([aCell objectValue] == doImport)
+ return NSLocalizedString(@"Do import", @"import operator");
+ else if([aCell objectValue] == doNotImport)
+ return NSLocalizedString(@"Do not import", @"do not import operator");
+ else if([aCell objectValue] == isEqual)
+ return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator");
+ else
+ return @"";
+ }
+ else if([[aTableColumn identifier] isEqualToString:@"target_field"])
+ return [fieldMappingTableColumnNames objectAtIndex:rowIndex];
}
- else if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOffState)
- return [NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]) description];
- else if([[aTableColumn identifier] isEqualToString:@"operator"]) {
- if([aCell objectValue] == doImport)
- return NSLocalizedString(@"Do import", @"import operator");
- else if([aCell objectValue] == doNotImport)
- return NSLocalizedString(@"Do not import", @"do not import operator");
- else if([aCell objectValue] == isEqual)
- return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator");
- else
- return @"";
+ else if(aTableView == globalValuesTableView) {
+ if ([[aTableColumn identifier] isEqualToString:@"global_value"])
+ return [fieldMappingGlobalValues objectAtIndex:numberOfImportColumns + rowIndex];
}
- else if([[aTableColumn identifier] isEqualToString:@"target_field"])
- return [fieldMappingTableColumnNames objectAtIndex:rowIndex];
-
-
return @"";
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if ([[aTableColumn identifier] isEqualToString:@"target_field"]) {
- if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
- [(NSPopUpButton *)[aTableColumn dataCell] removeAllItems];
- [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemWithTitle:[fieldMappingTableColumnNames objectAtIndex:rowIndex]];
+
+ if(aTableView == fieldMapperTableView) {
+ if ([[aTableColumn identifier] isEqualToString:@"target_field"]) {
+ if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
+ [(NSPopUpButton *)[aTableColumn dataCell] removeAllItems];
+ [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemWithTitle:[fieldMappingTableColumnNames objectAtIndex:rowIndex]];
+ }
+ return [fieldMappingTableColumnNames objectAtIndex:rowIndex];
}
- return [fieldMappingTableColumnNames objectAtIndex:rowIndex];
- }
- else if ([[aTableColumn identifier] isEqualToString:@"type"]) {
- NSTokenFieldCell *b = [[[NSTokenFieldCell alloc] initTextCell:[fieldMappingTableTypes objectAtIndex:rowIndex]] autorelease];
- [b setEditable:NO];
- [b setAlignment:NSLeftTextAlignment];
- [b setFont:[NSFont systemFontOfSize:9]];
- [b setDelegate:self];
- return b;
+ else if ([[aTableColumn identifier] isEqualToString:@"type"]) {
+ NSTokenFieldCell *b = [[[NSTokenFieldCell alloc] initTextCell:[fieldMappingTableTypes objectAtIndex:rowIndex]] autorelease];
+ [b setEditable:NO];
+ [b setAlignment:NSLeftTextAlignment];
+ [b setFont:[NSFont systemFontOfSize:9]];
+ [b setDelegate:self];
+ return b;
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"import_value"]) {
+ if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
+ [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems];
+ [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions];
+ // Hide csv file column value if user doesn't want to import it
+ if([fieldMappingOperatorArray objectAtIndex:rowIndex] != doNotImport)
+ return [fieldMappingArray objectAtIndex:rowIndex];
+ }
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"operator"]) {
+ if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
+ [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems];
+ [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingOperatorOptions];
+ }
+ return [fieldMappingOperatorArray objectAtIndex:rowIndex];
+ }
}
- else if ([[aTableColumn identifier] isEqualToString:@"import_value"]) {
- if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
- [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems];
- [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions];
- // Hide csv file column value if user doesn't want to import it
- if([fieldMappingOperatorArray objectAtIndex:rowIndex] != doNotImport)
- return [fieldMappingArray objectAtIndex:rowIndex];
+
+
+ else if(aTableView == globalValuesTableView) {
+ if ([[aTableColumn identifier] isEqualToString:@"value_index"]) {
+ return [NSString stringWithFormat:@"%ld.", numberOfImportColumns + rowIndex + 1];
}
- }
- else if ([[aTableColumn identifier] isEqualToString:@"operator"]) {
- if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) {
- [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems];
- [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingOperatorOptions];
+ else if ([[aTableColumn identifier] isEqualToString:@"global_value"]) {
+ return [fieldMappingGlobalValues objectAtIndex:numberOfImportColumns + rowIndex];
}
- return [fieldMappingOperatorArray objectAtIndex:rowIndex];
- }
+ }
+
+
return nil;
}
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if ([[aTableColumn identifier] isEqualToString:@"import_value"]) {
- [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject];
- // If user changed the csv file column set the operator to doImport
- [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doImport];
- }
- else if ([[aTableColumn identifier] isEqualToString:@"operator"]) {
- if([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) {
- [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject];
- [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:lastDisabledCSVFieldcolumn];
- } else {
- if(anObject == doNotImport) lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex];
- [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject];
+
+ if(aTableView == fieldMapperTableView) {
+ if ([[aTableColumn identifier] isEqualToString:@"import_value"]) {
+ [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject];
+ // If user _changed_ the csv file column set the operator to doImport
+ if([(NSNumber*)anObject integerValue] > -1)
+ [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doImport];
}
+ else if ([[aTableColumn identifier] isEqualToString:@"operator"]) {
+ if([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) {
+ [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject];
+ [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:lastDisabledCSVFieldcolumn];
+ } else {
+ if(anObject == doNotImport) lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex];
+ [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:anObject];
+ }
+ }
+ // Refresh table
+ [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.01];
+ }
+ else if(aTableView == globalValuesTableView) {
+ if ([[aTableColumn identifier] isEqualToString:@"global_value"])
+ [fieldMappingGlobalValues replaceObjectAtIndex:(numberOfImportColumns + rowIndex) withObject:anObject];
}
- // Refresh table
- [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.01];
}
+- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
+{
+ id object = [aNotification object];
+
+ if (object == globalValuesTableView) {
+ [removeGlobalValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] > 0)];
+ }
+
+}
@end