Skip to content

Commit

Permalink
fix #3573 and apply #3570
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15420 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 10, 2011
1 parent 86895ff commit 635bc69
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/app/qgshandlebadlayers.cpp
Expand Up @@ -28,6 +28,7 @@
#include <QDomElement>
#include <QPushButton>
#include <QMessageBox>
#include <QUrl>

QgsHandleBadLayersHandler::QgsHandleBadLayersHandler()
{
Expand All @@ -49,7 +50,6 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers, const QDo
{
setupUi( this );


mVectorFileFilter = QgsProviderRegistry::instance()->fileVectorFilters();
QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );

Expand Down Expand Up @@ -102,8 +102,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers, const QDo
}
else if ( provider == "delimitedtext" )
{
QStringList theURIParts = datasource.split( "?" );
filename = theURIParts[0];
filename = QUrl::fromEncoded( datasource.toAscii() ).toLocalFile();
}
else if ( provider == "postgres" || provider == "sqlanywhere" )
{
Expand Down Expand Up @@ -296,9 +295,10 @@ void QgsHandleBadLayers::apply()
}
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
Expand Down
8 changes: 5 additions & 3 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -27,6 +27,7 @@
#include <QDomElement>
#include <QDomImplementation>
#include <QTextStream>
#include <QUrl>

#include <sqlite3.h>

Expand Down Expand Up @@ -177,9 +178,10 @@ bool QgsMapLayer::readXML( QDomNode & layer_node )
}
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
{
Expand Down
8 changes: 5 additions & 3 deletions src/core/qgsproject.cpp
Expand Up @@ -860,8 +860,9 @@ bool QgsProject::read()
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." );

Expand All @@ -878,8 +879,9 @@ bool QgsProject::read()
// 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;

Expand Down
4 changes: 1 addition & 3 deletions src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
Expand Up @@ -132,11 +132,9 @@ void QgsDelimitedTextPluginGui::on_buttonBox_accepted()
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() );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -150,7 +150,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
, mWkbType( QGis::WKBNoGeometry )
{

QUrl url = QUrl::fromEncoded( uri.toUtf8() );
QUrl url = QUrl::fromEncoded( uri.toAscii() );

// Extract the provider definition from the url

Expand Down

0 comments on commit 635bc69

Please sign in to comment.