[QGIS Commit] r15420 - in trunk/qgis/src: app core
plugins/delimited_text providers/delimitedtext
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Mar 10 15:23:26 EST 2011
Author: jef
Date: 2011-03-10 12:23:26 -0800 (Thu, 10 Mar 2011)
New Revision: 15420
Modified:
trunk/qgis/src/app/qgshandlebadlayers.cpp
trunk/qgis/src/core/qgsmaplayer.cpp
trunk/qgis/src/core/qgsproject.cpp
trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Log:
fix #3573 and apply #3570
Modified: trunk/qgis/src/app/qgshandlebadlayers.cpp
===================================================================
--- trunk/qgis/src/app/qgshandlebadlayers.cpp 2011-03-10 19:47:59 UTC (rev 15419)
+++ trunk/qgis/src/app/qgshandlebadlayers.cpp 2011-03-10 20:23:26 UTC (rev 15420)
@@ -28,6 +28,7 @@
#include <QDomElement>
#include <QPushButton>
#include <QMessageBox>
+#include <QUrl>
QgsHandleBadLayersHandler::QgsHandleBadLayersHandler()
{
@@ -49,7 +50,6 @@
{
setupUi( this );
-
mVectorFileFilter = QgsProviderRegistry::instance()->fileVectorFilters();
QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );
@@ -102,8 +102,7 @@
}
else if ( provider == "delimitedtext" )
{
- QStringList theURIParts = datasource.split( "?" );
- filename = theURIParts[0];
+ filename = QUrl::fromEncoded( datasource.toAscii() ).toLocalFile();
}
else if ( provider == "postgres" || provider == "sqlanywhere" )
{
@@ -296,9 +295,10 @@
}
else if ( provider == "delimitedtext" )
{
- QStringList theURIParts = datasource.split( "?" );
- theURIParts[0] = filename;
- datasource = theURIParts.join( "?" );
+ QUrl uriSource = QUrl::fromEncoded( datasource.toAscii() );
+ QUrl uriDest = QUrl::fromLocalFile( filename );
+ uriDest.setQueryItems( uriSource.queryItems() );
+ datasource = QString::fromAscii( uriDest.toEncoded() );
}
}
else
Modified: trunk/qgis/src/core/qgsmaplayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.cpp 2011-03-10 19:47:59 UTC (rev 15419)
+++ trunk/qgis/src/core/qgsmaplayer.cpp 2011-03-10 20:23:26 UTC (rev 15420)
@@ -27,6 +27,7 @@
#include <QDomElement>
#include <QDomImplementation>
#include <QTextStream>
+#include <QUrl>
#include <sqlite3.h>
@@ -177,9 +178,10 @@
}
else if ( provider == "delimitedtext" )
{
- QStringList theURIParts = mDataSource.split( "?" );
- theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
- mDataSource = theURIParts.join( "?" );
+ QUrl urlSource = QUrl::fromEncoded( mDataSource.toAscii() );
+ QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->readPath( urlSource.toLocalFile() ) );
+ urlDest.setQueryItems( urlSource.queryItems() );
+ mDataSource = QString::fromAscii( urlDest.toEncoded() );
}
else
{
Modified: trunk/qgis/src/core/qgsproject.cpp
===================================================================
--- trunk/qgis/src/core/qgsproject.cpp 2011-03-10 19:47:59 UTC (rev 15419)
+++ trunk/qgis/src/core/qgsproject.cpp 2011-03-10 20:23:26 UTC (rev 15420)
@@ -860,8 +860,9 @@
QPair< bool, QList<QDomNode> > getMapLayersResults = _getMapLayers( *doc );
// review the integrity of the retrieved map layers
+ bool clean = getMapLayersResults.first;
- if ( ! getMapLayersResults.first )
+ if ( !clean )
{
QgsDebugMsg( "Unable to get map layers from project file." );
@@ -878,8 +879,9 @@
// read the project: used by map canvas and legend
emit readProject( *doc );
- // can't be dirty since we're allegedly in pristine state
- dirty( false );
+ // if all went well, we're allegedly in pristine state
+ if ( clean )
+ dirty( false );
return true;
Modified: trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp 2011-03-10 19:47:59 UTC (rev 15419)
+++ trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp 2011-03-10 20:23:26 UTC (rev 15420)
@@ -132,11 +132,9 @@
url.addQueryItem( "skipLines", QString( "%1" ).arg( skipLines ) );
// add the layer to the map
+ emit drawVectorLayer( QString::fromAscii( url.toEncoded() ), txtLayerName->text(), "delimitedtext" );
- QString uri( url.toEncoded() );
- emit drawVectorLayer( uri, txtLayerName->text(), "delimitedtext" );
// store the settings
-
QSettings settings;
QString key = "/Plugin-DelimitedText";
settings.setValue( key + "/delimiter", txtDelimiter->text() );
Modified: trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
===================================================================
--- trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp 2011-03-10 19:47:59 UTC (rev 15419)
+++ trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp 2011-03-10 20:23:26 UTC (rev 15420)
@@ -150,7 +150,7 @@
, mWkbType( QGis::WKBNoGeometry )
{
- QUrl url = QUrl::fromEncoded( uri.toUtf8() );
+ QUrl url = QUrl::fromEncoded( uri.toAscii() );
// Extract the provider definition from the url
More information about the QGIS-commit
mailing list