Skip to content

Commit caa934d

Browse files
author
jef
committed
unquote field names in delimited text plugin like in the provider
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13646 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8f7304e commit caa934d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp

+12-7
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,19 @@ void QgsDelimitedTextPluginGui::updateFieldLists()
154154
//
155155
// We don't know anything about a text based field other
156156
// than its name. All fields are assumed to be text
157-
for ( QStringList::Iterator it = fieldList.begin(); it != fieldList.end(); ++it )
157+
foreach( QString field, fieldList )
158158
{
159-
// add item to both drop-downs (X field and Y field)
160-
if (( *it ).length() > 0 )
161-
{
162-
cmbXField->addItem( *it );
163-
cmbYField->addItem( *it );
164-
}
159+
if (( field.left( 1 ) == "'" || field.left( 1 ) == "\"" ) &&
160+
field.left( 1 ) == field.right( 1 ) )
161+
// eat quotes
162+
field = field.mid( 1, field.length() - 2 );
163+
164+
if ( field.length() == 0 )
165+
// skip empty field names
166+
continue;
167+
168+
cmbXField->addItem( field );
169+
cmbYField->addItem( field );
165170
}
166171
// Have a go at setting the selected items in the X and Y
167172
// combo boxes to something sensible.

0 commit comments

Comments
 (0)