[QGIS Commit] r13646 - trunk/qgis/src/plugins/delimited_text

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Jun 4 09:47:13 EDT 2010


Author: jef
Date: 2010-06-04 09:47:11 -0400 (Fri, 04 Jun 2010)
New Revision: 13646

Modified:
   trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
Log:
unquote field names in delimited text plugin like in the provider

Modified: trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp	2010-06-04 12:26:33 UTC (rev 13645)
+++ trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp	2010-06-04 13:47:11 UTC (rev 13646)
@@ -154,14 +154,19 @@
         //
         // We don't know anything about a text based field other
         // than its name. All fields are assumed to be text
-        for ( QStringList::Iterator it = fieldList.begin(); it != fieldList.end(); ++it )
+        foreach( QString field, fieldList )
         {
-          // add item to both drop-downs (X field and Y field)
-          if (( *it ).length() > 0 )
-          {
-            cmbXField->addItem( *it );
-            cmbYField->addItem( *it );
-          }
+          if (( field.left( 1 ) == "'" || field.left( 1 ) == "\"" ) &&
+              field.left( 1 ) == field.right( 1 ) )
+            // eat quotes
+            field = field.mid( 1, field.length() - 2 );
+
+          if ( field.length() == 0 )
+            // skip empty field names
+            continue;
+
+          cmbXField->addItem( field );
+          cmbYField->addItem( field );
         }
         // Have a go at setting the selected items in the X and Y
         // combo boxes to something sensible.



More information about the QGIS-commit mailing list