Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
back to a more safe const method
  • Loading branch information
luipir committed Feb 12, 2019
1 parent ee18eb5 commit a5866df
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -1470,9 +1470,11 @@ void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg ) const

QString QgsMapLayer::saveSldStyle( const QString &uri, bool &resultFlag ) const
{
const QgsMapLayer *mlayer = qobject_cast<const QgsMapLayer *>( this );

QString errorMsg;
QDomDocument myDocument;
exportSldStyle( myDocument, errorMsg );
mlayer->exportSldStyle( myDocument, errorMsg );
if ( !errorMsg.isNull() )
{
resultFlag = false;
Expand All @@ -1481,17 +1483,17 @@ QString QgsMapLayer::saveSldStyle( const QString &uri, bool &resultFlag ) const
// check if the uri is a file or ends with .sld,
// which indicates that it should become one
QString filename;
if ( providerType() == QLatin1String( "ogr" ) )
if ( mlayer->providerType() == QLatin1String( "ogr" ) )
{
QStringList theURIParts = uri.split( '|' );
filename = theURIParts[0];
}
else if ( providerType() == QLatin1String( "gpx" ) )
else if ( mlayer->providerType() == QLatin1String( "gpx" ) )
{
QStringList theURIParts = uri.split( '?' );
filename = theURIParts[0];
}
else if ( providerType() == QLatin1String( "delimitedtext" ) )
else if ( mlayer->providerType() == QLatin1String( "delimitedtext" ) )
{
filename = QUrl::fromEncoded( uri.toLatin1() ).toLocalFile();
// toLocalFile() returns an empty string if theURI is a plain Windows-path, e.g. "C:/style.qml"
Expand Down

0 comments on commit a5866df

Please sign in to comment.