Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use filename for title of WMS top layer if project title empty (ticket
…#3719)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15695 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 12, 2011
1 parent b3cfb17 commit 882be41
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -33,6 +33,8 @@
#include "qgscomposerscalebar.h"
#include "qgscomposershape.h"

#include "QFileInfo"


QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
{
Expand Down Expand Up @@ -621,12 +623,18 @@ QString QgsProjectParser::projectTitle() const
}

QDomElement titleElem = qgisElem.firstChildElement( "title" );
if ( titleElem.isNull() )
if ( !titleElem.isNull() )
{
return QString();
QString title = titleElem.text();
if ( !title.isEmpty() )
{
return title;
}
}

return titleElem.text();
//no title element or not project title set. Use project filename without extension
QFileInfo projectFileInfo( mProjectPath );
return projectFileInfo.baseName();
}

QList<QDomElement> QgsProjectParser::projectLayerElements() const
Expand Down

0 comments on commit 882be41

Please sign in to comment.