Skip to content
Permalink
Browse files
strip off superfluous parameters from WMS server url (for the common …
…case that GetCapabilities request urls are advertised)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15183 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 17, 2011
1 parent 2025236 commit a0241d32ae514438e65baa194221310c808b62d0
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/app/qgsnewhttpconnection.cpp
@@ -19,6 +19,7 @@
#include "qgscontexthelp.h"
#include <QSettings>
#include <QMessageBox>
#include <QUrl>

QgsNewHttpConnection::QgsNewHttpConnection(
QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl ):
@@ -73,7 +74,21 @@ void QgsNewHttpConnection::accept()
settings.remove( "/Qgis/WMS/" + mOriginalConnName );
}

settings.setValue( key + "/url", txtUrl->text().trimmed() );
QUrl url( txtUrl->text().trimmed() );

QList< QPair<QByteArray, QByteArray> > params = url.encodedQueryItems();
for ( int i = 0; i < params.size(); i++ )
{
if ( params[i].first.toUpper() == "SERVICE" ||
params[i].first.toUpper() == "REQUEST" ||
params[i].first.toUpper() == "FORMAT" )
{
params.removeAt( i-- );
}
}
url.setEncodedQueryItems( params );

settings.setValue( key + "/url", url.toString() );
settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );

0 comments on commit a0241d3

Please sign in to comment.