Skip to content

Commit 635bc69

Browse files
author
jef
committed
fix #3573 and apply #3570
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15420 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 86895ff commit 635bc69

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

src/app/qgshandlebadlayers.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <QDomElement>
2929
#include <QPushButton>
3030
#include <QMessageBox>
31+
#include <QUrl>
3132

3233
QgsHandleBadLayersHandler::QgsHandleBadLayersHandler()
3334
{
@@ -49,7 +50,6 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers, const QDo
4950
{
5051
setupUi( this );
5152

52-
5353
mVectorFileFilter = QgsProviderRegistry::instance()->fileVectorFilters();
5454
QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );
5555

@@ -102,8 +102,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers, const QDo
102102
}
103103
else if ( provider == "delimitedtext" )
104104
{
105-
QStringList theURIParts = datasource.split( "?" );
106-
filename = theURIParts[0];
105+
filename = QUrl::fromEncoded( datasource.toAscii() ).toLocalFile();
107106
}
108107
else if ( provider == "postgres" || provider == "sqlanywhere" )
109108
{
@@ -296,9 +295,10 @@ void QgsHandleBadLayers::apply()
296295
}
297296
else if ( provider == "delimitedtext" )
298297
{
299-
QStringList theURIParts = datasource.split( "?" );
300-
theURIParts[0] = filename;
301-
datasource = theURIParts.join( "?" );
298+
QUrl uriSource = QUrl::fromEncoded( datasource.toAscii() );
299+
QUrl uriDest = QUrl::fromLocalFile( filename );
300+
uriDest.setQueryItems( uriSource.queryItems() );
301+
datasource = QString::fromAscii( uriDest.toEncoded() );
302302
}
303303
}
304304
else

src/core/qgsmaplayer.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <QDomElement>
2828
#include <QDomImplementation>
2929
#include <QTextStream>
30+
#include <QUrl>
3031

3132
#include <sqlite3.h>
3233

@@ -177,9 +178,10 @@ bool QgsMapLayer::readXML( QDomNode & layer_node )
177178
}
178179
else if ( provider == "delimitedtext" )
179180
{
180-
QStringList theURIParts = mDataSource.split( "?" );
181-
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
182-
mDataSource = theURIParts.join( "?" );
181+
QUrl urlSource = QUrl::fromEncoded( mDataSource.toAscii() );
182+
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->readPath( urlSource.toLocalFile() ) );
183+
urlDest.setQueryItems( urlSource.queryItems() );
184+
mDataSource = QString::fromAscii( urlDest.toEncoded() );
183185
}
184186
else
185187
{

src/core/qgsproject.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,9 @@ bool QgsProject::read()
860860
QPair< bool, QList<QDomNode> > getMapLayersResults = _getMapLayers( *doc );
861861

862862
// review the integrity of the retrieved map layers
863+
bool clean = getMapLayersResults.first;
863864

864-
if ( ! getMapLayersResults.first )
865+
if ( !clean )
865866
{
866867
QgsDebugMsg( "Unable to get map layers from project file." );
867868

@@ -878,8 +879,9 @@ bool QgsProject::read()
878879
// read the project: used by map canvas and legend
879880
emit readProject( *doc );
880881

881-
// can't be dirty since we're allegedly in pristine state
882-
dirty( false );
882+
// if all went well, we're allegedly in pristine state
883+
if ( clean )
884+
dirty( false );
883885

884886
return true;
885887

src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ void QgsDelimitedTextPluginGui::on_buttonBox_accepted()
132132
url.addQueryItem( "skipLines", QString( "%1" ).arg( skipLines ) );
133133

134134
// add the layer to the map
135+
emit drawVectorLayer( QString::fromAscii( url.toEncoded() ), txtLayerName->text(), "delimitedtext" );
135136

136-
QString uri( url.toEncoded() );
137-
emit drawVectorLayer( uri, txtLayerName->text(), "delimitedtext" );
138137
// store the settings
139-
140138
QSettings settings;
141139
QString key = "/Plugin-DelimitedText";
142140
settings.setValue( key + "/delimiter", txtDelimiter->text() );

src/providers/delimitedtext/qgsdelimitedtextprovider.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
150150
, mWkbType( QGis::WKBNoGeometry )
151151
{
152152

153-
QUrl url = QUrl::fromEncoded( uri.toUtf8() );
153+
QUrl url = QUrl::fromEncoded( uri.toAscii() );
154154

155155
// Extract the provider definition from the url
156156

0 commit comments

Comments
 (0)