diff --git a/src/app/qgsmanageconnectionsdialog.cpp b/src/app/qgsmanageconnectionsdialog.cpp
index cbb8349d67b..72420ea2a7f 100644
--- a/src/app/qgsmanageconnectionsdialog.cpp
+++ b/src/app/qgsmanageconnectionsdialog.cpp
@@ -286,6 +286,8 @@ QDomDocument QgsManageConnectionsDialog::saveWMSConnections( const QStringList &
QDomElement el = doc.createElement( "wms" );
el.setAttribute( "name", connections[ i ] );
el.setAttribute( "url", settings.value( path + connections[ i ] + "/url", "" ).toString() );
+ el.setAttribute( "ignoreGetMapURI", settings.value( path + connections[i] + "/ignoreGetMapURI", false ).toBool() ? "true" : "false" );
+ el.setAttribute( "ignoreGetFeatureInfoURI", settings.value( path + connections[i] + "/ignoreGetFeatureInfoURI", false ).toBool() ? "true" : "false" );
path = "/Qgis/WMS/";
el.setAttribute( "username", settings.value( path + connections[ i ] + "/username", "" ).toString() );
@@ -423,6 +425,8 @@ void QgsManageConnectionsDialog::loadWMSConnections( const QDomDocument &doc, co
// no dups detected or overwrite is allowed
settings.beginGroup( "/Qgis/connections-wms" );
settings.setValue( QString( "/" + connectionName + "/url" ) , child.attribute( "url" ) );
+ settings.setValue( QString( "/" + connectionName + "/ignoreGetMapURI" ), child.attribute( "ignoreGetMapURI" ) == "true" );
+ settings.setValue( QString( "/" + connectionName + "/ignoreGetFeatureInfoURI" ), child.attribute( "ignoreGetFeatureInfoURI" ) == "true" );
settings.endGroup();
if ( !child.attribute( "username" ).isEmpty() )
diff --git a/src/app/qgsnewhttpconnection.cpp b/src/app/qgsnewhttpconnection.cpp
index cdfd6353762..c8cb0e273d3 100644
--- a/src/app/qgsnewhttpconnection.cpp
+++ b/src/app/qgsnewhttpconnection.cpp
@@ -41,6 +41,18 @@ QgsNewHttpConnection::QgsNewHttpConnection(
QString credentialsKey = "/Qgis/WMS/" + connName;
txtName->setText( connName );
txtUrl->setText( settings.value( key + "/url" ).toString() );
+
+ if ( mBaseKey == "/Qgis/connections-wms/" )
+ {
+ cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
+ cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
+ }
+ else
+ {
+ cbxIgnoreGetMapURI->setVisible( false );
+ cbxIgnoreGetFeatureInfoURI->setVisible( false );
+ }
+
txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() );
}
@@ -96,6 +108,12 @@ void QgsNewHttpConnection::accept()
url.setEncodedQueryItems( params );
settings.setValue( key + "/url", url.toString() );
+ if ( mBaseKey == "/Qgis/connections-wms/" )
+ {
+ settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
+ settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
+ }
+
settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );
diff --git a/src/app/qgswmssourceselect.cpp b/src/app/qgswmssourceselect.cpp
index eafd20637c4..0cc4ab38b27 100644
--- a/src/app/qgswmssourceselect.cpp
+++ b/src/app/qgswmssourceselect.cpp
@@ -68,9 +68,6 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
mAddButton->setEnabled( false );
populateConnectionList();
- cbxIgnoreGetMap->setEnabled( false );
- cbxIgnoreGetFeatureInfo->setEnabled( false );
-
QHBoxLayout *layout = new QHBoxLayout;
mImageFormatGroup = new QButtonGroup;
@@ -411,57 +408,6 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
}
- if ( wmsProvider->baseUrl() != wmsProvider->getMapUrl() )
- {
- QApplication::setOverrideCursor( Qt::ArrowCursor );
-
- if ( QMessageBox::information( this,
- tr( "WMS Provider" ),
- tr( "Advertised GetMap URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
- "This might be an server configuration error. Should the URL be used?" )
- .arg( wmsProvider->baseUrl() )
- .arg( wmsProvider->getMapUrl() ),
- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
- {
- cbxIgnoreGetMap->setChecked( false );
- }
- else
- {
- cbxIgnoreGetMap->setChecked( true );
- }
- cbxIgnoreGetMap->setEnabled( true );
-
- QApplication::restoreOverrideCursor();
- }
- else
- {
- cbxIgnoreGetMap->setEnabled( false );
- cbxIgnoreGetMap->setChecked( false );
- }
-
- if ( wmsProvider->baseUrl() != wmsProvider->getFeatureInfoUrl() )
- {
- QApplication::setOverrideCursor( Qt::ArrowCursor );
-
- if ( QMessageBox::information( this,
- tr( "WMS Provider" ),
- tr( "Advertised GetFeatureInfo URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
- "This might be an server configuration error. Should the URL be used?" )
- .arg( wmsProvider->baseUrl() )
- .arg( wmsProvider->getFeatureInfoUrl() ),
- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
- {
- cbxIgnoreGetFeatureInfo->setChecked( false );
- }
- else
- {
- cbxIgnoreGetFeatureInfo->setChecked( true );
- }
- cbxIgnoreGetFeatureInfo->setEnabled( true );
-
- QApplication::restoreOverrideCursor();
- }
-
return true;
}
@@ -475,12 +421,9 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
QString credentialsKey = "/Qgis/WMS/" + cmbConnections->currentText();
QStringList connStringParts;
- QString part;
-
- connStringParts += settings.value( key + "/url" ).toString();
mConnName = cmbConnections->currentText();
- mConnectionInfo = connStringParts.join( " " );
+ mConnectionInfo = settings.value( key + "/url" ).toString();
// Check for credentials and prepend to the connection info
QString username = settings.value( credentialsKey + "/username" ).toString();
@@ -495,6 +438,29 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
mConnectionInfo = "username=" + username + ",password=" + password + ",url=" + mConnectionInfo;
}
+ bool ignoreGetMap = settings.value( key + "/ignoreGetMapURI", false ).toBool();
+ bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool();
+ if ( ignoreGetMap || ignoreGetFeatureInfo )
+ {
+ QString connArgs = "ignoreUrl=";
+ if ( ignoreGetMap )
+ {
+ connArgs += "GetMap";
+ if ( ignoreGetFeatureInfo )
+ connArgs += ";";
+ }
+ if ( ignoreGetFeatureInfo )
+ connArgs += "GetFeatureInfo";
+
+ if ( mConnectionInfo.startsWith( "username=" ) )
+ {
+ mConnectionInfo.prepend( connArgs + "," );
+ }
+ else
+ {
+ mConnectionInfo.prepend( connArgs + ",url=" );
+ }
+ }
QgsDebugMsg( QString( "Connection info: '%1'." ).arg( mConnectionInfo ) );
@@ -572,31 +538,6 @@ void QgsWMSSourceSelect::addClicked()
}
}
- if ( cbxIgnoreGetMap->isChecked() || cbxIgnoreGetFeatureInfo->isChecked() )
- {
- QString connArgs = "ignoreUrl=";
-
- if ( cbxIgnoreGetMap->isChecked() )
- {
- connArgs += "GetMap";
- if ( cbxIgnoreGetFeatureInfo->isChecked() )
- connArgs += ";GetFeatureInfo";
- }
- else
- {
- connArgs += "GetFeatureInfo";
- }
-
- if ( connInfo.startsWith( "username=" ) || connInfo.startsWith( "tiled=" ) )
- {
- connInfo.prepend( connArgs + "," );
- }
- else
- {
- connInfo.prepend( connArgs + ",url=" );
- }
- }
-
QgisApp::instance()->addRasterLayer( connInfo,
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms", layers, styles, format, crs );
@@ -823,7 +764,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
}
}
- gbCRS->setTitle( tr( "Coordinate Reference System (%n available)", "crs count", mCRSs.count() ) );
+ gbCRS->setTitle( tr( "Options (%n coordinate reference systems available)", "crs count", mCRSs.count() ) );
btnChangeSpatialRefSys->setDisabled( mCRSs.isEmpty() );
if ( !layers.isEmpty() && !mCRSs.isEmpty() )
diff --git a/src/ui/qgsnewhttpconnectionbase.ui b/src/ui/qgsnewhttpconnectionbase.ui
index 5b74225a11c..3dd4ca7f57c 100644
--- a/src/ui/qgsnewhttpconnectionbase.ui
+++ b/src/ui/qgsnewhttpconnectionbase.ui
@@ -6,8 +6,8 @@
0
0
- 512
- 254
+ 507
+ 322
@@ -20,12 +20,65 @@
true
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+
-
Connection details
+
-
+
+
+ URL
+
+
+ 5
+
+
+ txtUrl
+
+
+
+ -
+
+
+ If the service requires basic authentication, enter a user name and optional password
+
+
+ Qt::PlainText
+
+
+ true
+
+
+
+ -
+
+
+ Password
+
+
+ txtPassword
+
+
+
+ -
+
+
+ &User name
+
+
+ txtUserName
+
+
+
-
@@ -42,7 +95,7 @@
- -
+
-
@@ -58,100 +111,44 @@
- -
-
-
- URL
-
-
- 5
-
-
- txtUrl
-
-
-
- -
+
-
HTTP address of the Web Map Server
- -
-
-
- If the service requires basic authentication, enter a user name and optional password
-
-
- Qt::PlainText
-
-
- true
-
-
+
-
+
- -
-
-
- &User name
-
-
- txtUserName
-
-
-
- -
-
-
-
- 120
- 16777215
-
-
-
-
- -
-
-
- Password
-
-
- txtPassword
-
-
-
- -
+
-
-
-
- 120
- 120
-
-
QLineEdit::Password
+ -
+
+
+ Ignore GetFeatureInfo URI reported in capabilities
+
+
+
+ -
+
+
+ Ignore GetMap URI reported in capabilities
+
+
+
- -
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
-
-
-
- txtName
- txtUrl
- txtUserName
- txtPassword
buttonBox
diff --git a/src/ui/qgswmssourceselectbase.ui b/src/ui/qgswmssourceselectbase.ui
index d0c5bac160b..1b8527540c9 100644
--- a/src/ui/qgswmssourceselectbase.ui
+++ b/src/ui/qgswmssourceselectbase.ui
@@ -6,7 +6,7 @@
0
0
- 767
+ 773
539
@@ -223,30 +223,6 @@
- -
-
-
-
-
-
- Use base url instead of advertised GetFeatureInfo URL
-
-
- Ignore GetMap URL
-
-
-
- -
-
-
- Use base url instead of advertised GetFeatureInfo URL
-
-
- Ignore GetFeatureInfo URL
-
-
-
-
-
@@ -445,8 +421,6 @@
lstLayers
leLayerName
btnChangeSpatialRefSys
- cbxIgnoreGetMap
- cbxIgnoreGetFeatureInfo
mLayerUpButton
mLayerDownButton
mLayerOrderTreeWidget