Skip to content

Commit

Permalink
fix #2029
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@11833 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 24, 2009
1 parent 1fbebf1 commit 175e531
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/qgsattributetypedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <QFile>
#include <QMessageBox>
#include <QFileDialog>
#include <QTextStream>

#include <climits>
#include <cfloat>
Expand Down Expand Up @@ -120,21 +121,25 @@ void QgsAttributeTypeDialog::loadFromCSVButtonPushed()
{
QMessageBox::information( NULL,
tr( "Error" ),
tr( "Could not open file %1\nError was:%2" ).arg( fileName ).arg( f.errorString() ), QMessageBox::Cancel );
tr( "Could not open file %1\nError was:%2" ).arg( fileName ).arg( f.errorString() ),
QMessageBox::Cancel );
return;
}

QTextStream s(&f);
s.setAutoDetectUnicode(true);

QRegExp re0( "^([^;]*);(.*)$" );
re0.setMinimal( true );
QRegExp re1( "^([^,]*),(.*)$" );
re1.setMinimal( true );
QMap<QString, QVariant> map;

f.readLine();
s.readLine();

while ( !f.atEnd() )
while ( !s.atEnd() )
{
QString l = f.readLine().trimmed();
QString l = s.readLine().trimmed();

QString key, val;
if ( re0.indexIn( l ) >= 0 && re0.numCaptures() == 2 )
Expand Down

0 comments on commit 175e531

Please sign in to comment.