[QGIS Commit] r15183 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Feb 17 07:57:38 EST 2011


Author: jef
Date: 2011-02-17 04:57:38 -0800 (Thu, 17 Feb 2011)
New Revision: 15183

Modified:
   trunk/qgis/src/app/qgsnewhttpconnection.cpp
Log:
strip off superfluous parameters from WMS server url (for the common case that GetCapabilities request urls are advertised)

Modified: trunk/qgis/src/app/qgsnewhttpconnection.cpp
===================================================================
--- trunk/qgis/src/app/qgsnewhttpconnection.cpp	2011-02-17 12:56:23 UTC (rev 15182)
+++ trunk/qgis/src/app/qgsnewhttpconnection.cpp	2011-02-17 12:57:38 UTC (rev 15183)
@@ -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 @@
     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() );
 



More information about the QGIS-commit mailing list