Skip to content
Permalink
Browse files

update old delimited text provider datasources on load

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15437 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 11, 2011
1 parent 16261f2 commit cbf1bc2f8396cfddb2f0bd5e646d6e9d781814a5
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/core/qgsmaplayer.cpp
@@ -179,6 +179,14 @@ bool QgsMapLayer::readXML( QDomNode & layer_node )
else if ( provider == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( mDataSource.toAscii() );

if ( !mDataSource.startsWith( "file://" ) )
{
QUrl file = QUrl::fromLocalFile( mDataSource.left( mDataSource.indexOf( "?" ) ) );
urlSource.setScheme( "file" );
urlSource.setPath( file.path() );
}

QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->readPath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
mDataSource = QString::fromAscii( urlDest.toEncoded() );
@@ -309,9 +317,10 @@ bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QStringList theURIParts = src.split( "?" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0] );
src = theURIParts.join( "?" );
QUrl urlSource = QUrl::fromEncoded( src.toAscii() );
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->writePath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
}
else
{
@@ -678,8 +687,7 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QStringList theURIParts = theURI.split( "?" );
filename = theURIParts[0];
filename = QUrl::fromEncoded( theURI.toAscii() ).toLocalFile();
}
else
{

0 comments on commit cbf1bc2

Please sign in to comment.
You can’t perform that action at this time.