aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-19 10:50:26 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-19 10:50:26 +0000
commite0e594cf921768218f19d9596f3214419482ff09 (patch)
tree8112ef9e166f4d24d0075a64ede987235d65e34b
parentdc2f4652e24c76c4eac74eab1a3d8bcca923b2ca (diff)
downloadsequelpro-e0e594cf921768218f19d9596f3214419482ff09.tar.gz
sequelpro-e0e594cf921768218f19d9596f3214419482ff09.tar.bz2
sequelpro-e0e594cf921768218f19d9596f3214419482ff09.zip
• CSV Import Field Mapper
- added to csv field popup menu: "Ignore all fields", "Import all fields" - if user changed a matching pair field change the "Align fields by:" to "custom order" to make it more transparent - if user inserts a just added global var to a field which was set to "Ignore field" set it to "Import field" - unified some messages
-rw-r--r--Interfaces/English.lproj/DataMigrationDialog.xib38
-rw-r--r--Source/SPFieldMapperController.m52
2 files changed, 74 insertions, 16 deletions
diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib
index 6c5b787a..96e2d8da 100644
--- a/Interfaces/English.lproj/DataMigrationDialog.xib
+++ b/Interfaces/English.lproj/DataMigrationDialog.xib
@@ -12,8 +12,8 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="12"/>
<integer value="162"/>
+ <integer value="12"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -805,9 +805,9 @@
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
<object class="NSMutableString" key="NSString">
- <bytes key="NS.bytes">CeKAlQlEbyBpbXBvcnQgZmllbGQKCQlEbyBub3QgaW1wb3J0IGZpZWxkCglJTlNFUlQJQWRkIGFzIG5l
-dyByb3dzIElOU0VSVCBJTlRPIOKApglSRVBMQUNFCVVwZGF0ZSBleGlzdGluZyByb3dzIG9yIGFkZCBh
-cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
+ <bytes key="NS.bytes">CeKAlQlJbXBvcnQgZmllbGQKCQlJZ25vcmUgZmllbGQKCUlOU0VSVAlBZGQgYXMgbmV3IHJvd3MgSU5T
+RVJUIElOVE8g4oCmCVJFUExBQ0UJVXBkYXRlIGV4aXN0aW5nIHJvd3Mgb3IgYWRkIGFzIAoJCW5ldyBy
+b3dzIFJFUExBQ0UgSU5UTyDigKY</bytes>
</object>
<object class="NSMutableArray" key="NSAttributes">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -907,7 +907,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
</object>
<object class="NSMutableData" key="NSAttributeInfo">
- <bytes key="NS.bytes">AQABAQEADwIDABMCAgAGAwEAGwIDAAcDAQA3AgIAA</bytes>
+ <bytes key="NS.bytes">AQABAQEADAIDAAwCAgAGAwEAGwIDAAcDAQA3AgIAA</bytes>
</object>
<nil key="NSDelegate"/>
</object>
@@ -1086,6 +1086,18 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference key="NSTarget" ref="940205369"/>
</object>
<reference ref="863046035"/>
+ <object class="NSMenuItem" id="275652671">
+ <reference key="NSMenu" ref="877368345"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <string key="NSTitle">custom order</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="884724275"/>
+ <reference key="NSMixedImage" ref="1071040955"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">3</int>
+ <reference key="NSTarget" ref="940205369"/>
+ </object>
</object>
<bool key="NSNoAutoenable">YES</bool>
<reference key="NSMenuFont" ref="388072550"/>
@@ -2270,6 +2282,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference ref="863046035"/>
<reference ref="288483296"/>
<reference ref="771511410"/>
+ <reference ref="275652671"/>
</object>
<reference key="parent" ref="940205369"/>
</object>
@@ -2517,6 +2530,11 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<reference key="object" ref="574058264"/>
<reference key="parent" ref="757708847"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">224</int>
+ <reference key="object" ref="275652671"/>
+ <reference key="parent" ref="877368345"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2607,6 +2625,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<string>221.IBAttributePlaceholdersKey</string>
<string>221.IBPluginDependency</string>
<string>222.IBPluginDependency</string>
+ <string>224.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
<string>25.IBAttributePlaceholdersKey</string>
<string>25.IBPluginDependency</string>
@@ -2656,9 +2675,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{284, 107}, {465, 405}}</string>
+ <string>{{231, 344}, {465, 405}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{284, 107}, {465, 405}}</string>
+ <string>{{231, 344}, {465, 405}}</string>
<integer value="1"/>
<string>{{387, 725}, {432, 282}}</string>
<integer value="0"/>
@@ -2677,7 +2696,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{126, 403}, {161, 54}}</string>
+ <string>{{237, 379}, {161, 71}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2803,6 +2822,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
<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">
@@ -2872,7 +2892,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">223</int>
+ <int key="maxID">224</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 3c365dcf..a44f5ca2 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -108,6 +108,7 @@
[insertNULLValueButton setEnabled:([globalValuesTableView numberOfSelectedRows] == 1)];
[self updateFieldNameAlignment];
+
}
- (void)dealloc
@@ -311,8 +312,9 @@
}
[fieldMapperTableView reloadData];
- // Remember last field alignment
- [prefs setInteger:[[alignByPopup selectedItem] tag] forKey:SPCSVFieldImportMappingAlignment];
+ // Remember last field alignment if not "custom order"
+ if([[alignByPopup selectedItem] tag] != 3)
+ [prefs setInteger:[[alignByPopup selectedItem] tag] forKey:SPCSVFieldImportMappingAlignment];
}
/*
@@ -411,8 +413,17 @@
// 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]];
+
+ // Set corresponding operator to doImport
+ [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport];
+
[fieldMapperTableView reloadData];
+
+ // Set alignment popup to "custom order"
+ [alignByPopup selectItemWithTag:3];
+
}
[NSApp endSheet:[globalValuesSheet window] returnCode:[sender tag]];
@@ -539,7 +550,7 @@
if([prefs integerForKey:SPCSVFieldImportMappingAlignment]
&& [prefs integerForKey:SPCSVFieldImportMappingAlignment] >= 0
- && [prefs integerForKey:SPCSVFieldImportMappingAlignment] < 3) {
+ && [prefs integerForKey:SPCSVFieldImportMappingAlignment] < 4) {
alignment = [prefs integerForKey:SPCSVFieldImportMappingAlignment];
}
@@ -618,11 +629,11 @@
else if([[aTableColumn identifier] isEqualToString:@"operator"]) {
if([aCell objectValue] == doImport)
- return NSLocalizedString(@"Do import", @"import operator");
+ return NSLocalizedString(@"Import field", @"import field operator tooltip");
else if([aCell objectValue] == doNotImport)
- return NSLocalizedString(@"Do not import", @"do not import operator");
+ return NSLocalizedString(@"Ignore field", @"ignore field operator tooltip");
else if([aCell objectValue] == isEqual)
- return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator");
+ return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator tooltip");
else
return @"";
}
@@ -666,6 +677,9 @@
[c addItemsWithTitles:fieldMappingButtonOptions];
[m addItem:[NSMenuItem separatorItem]];
[c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field menu item")];
+ [c addItemWithTitle:NSLocalizedString(@"Ignore all fields", @"ignore all fields menu item")];
+ [c addItemWithTitle:NSLocalizedString(@"Import all fields", @"import all fields menu item")];
+ [m addItem:[NSMenuItem separatorItem]];
[c addItemWithTitle:NSLocalizedString(@"Add global value…", @"add global value menu item")];
// Hide csv file column value if user doesn't want to import it
@@ -710,14 +724,38 @@
[fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport];
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
}
- // Add global value
+ // Ignore all field - set all operator to doNotImport
else if([anObject integerValue] == [fieldMappingButtonOptions count]+2) {
+ NSInteger i;
+ NSNumber *globalValue = doNotImport;
+ [fieldMappingOperatorArray removeAllObjects];
+ for(i=0; i < [fieldMappingTableColumnNames count]; i++)
+ [fieldMappingOperatorArray addObject:globalValue];
+ [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
+ }
+ // Import all field - set all operator to doImport
+ else if([anObject integerValue] == [fieldMappingButtonOptions count]+3) {
+ NSInteger i;
+ NSNumber *globalValue = doImport;
+ [fieldMappingOperatorArray removeAllObjects];
+ for(i=0; i < [fieldMappingTableColumnNames count]; i++)
+ [fieldMappingOperatorArray addObject:globalValue];
+ [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
+ }
+ // Add global value
+ else if([anObject integerValue] == [fieldMappingButtonOptions count]+5) {
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
[self addGlobalSourceVariable:nil];
}
return;
}
+
+ // If user changed the order set alignment popup to "custom order"
+ if([fieldMappingArray objectAtIndex:rowIndex] != anObject)
+ [alignByPopup selectItemWithTag:3];
+
[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];