@@ -68,9 +68,6 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
6868 mAddButton ->setEnabled ( false );
6969 populateConnectionList ();
7070
71- cbxIgnoreGetMap->setEnabled ( false );
72- cbxIgnoreGetFeatureInfo->setEnabled ( false );
73-
7471 QHBoxLayout *layout = new QHBoxLayout;
7572 mImageFormatGroup = new QButtonGroup;
7673
@@ -411,57 +408,6 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
411408 lstLayers->expandItem ( lstLayers->topLevelItem ( 0 ) );
412409 }
413410
414- if ( wmsProvider->baseUrl () != wmsProvider->getMapUrl () )
415- {
416- QApplication::setOverrideCursor ( Qt::ArrowCursor );
417-
418- if ( QMessageBox::information ( this ,
419- tr ( " WMS Provider" ),
420- tr ( " Advertised GetMap URL\n\n %2\n\n is different from GetCapabilities URL\n\n %1\n\n "
421- " This might be an server configuration error. Should the URL be used?" )
422- .arg ( wmsProvider->baseUrl () )
423- .arg ( wmsProvider->getMapUrl () ),
424- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
425- {
426- cbxIgnoreGetMap->setChecked ( false );
427- }
428- else
429- {
430- cbxIgnoreGetMap->setChecked ( true );
431- }
432- cbxIgnoreGetMap->setEnabled ( true );
433-
434- QApplication::restoreOverrideCursor ();
435- }
436- else
437- {
438- cbxIgnoreGetMap->setEnabled ( false );
439- cbxIgnoreGetMap->setChecked ( false );
440- }
441-
442- if ( wmsProvider->baseUrl () != wmsProvider->getFeatureInfoUrl () )
443- {
444- QApplication::setOverrideCursor ( Qt::ArrowCursor );
445-
446- if ( QMessageBox::information ( this ,
447- tr ( " WMS Provider" ),
448- tr ( " Advertised GetFeatureInfo URL\n\n %2\n\n is different from GetCapabilities URL\n\n %1\n\n "
449- " This might be an server configuration error. Should the URL be used?" )
450- .arg ( wmsProvider->baseUrl () )
451- .arg ( wmsProvider->getFeatureInfoUrl () ),
452- QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
453- {
454- cbxIgnoreGetFeatureInfo->setChecked ( false );
455- }
456- else
457- {
458- cbxIgnoreGetFeatureInfo->setChecked ( true );
459- }
460- cbxIgnoreGetFeatureInfo->setEnabled ( true );
461-
462- QApplication::restoreOverrideCursor ();
463- }
464-
465411 return true ;
466412}
467413
@@ -475,12 +421,9 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
475421 QString credentialsKey = " /Qgis/WMS/" + cmbConnections->currentText ();
476422
477423 QStringList connStringParts;
478- QString part;
479-
480- connStringParts += settings.value ( key + " /url" ).toString ();
481424
482425 mConnName = cmbConnections->currentText ();
483- mConnectionInfo = connStringParts. join ( " " );
426+ mConnectionInfo = settings. value ( key + " /url " ). toString ( );
484427
485428 // Check for credentials and prepend to the connection info
486429 QString username = settings.value ( credentialsKey + " /username" ).toString ();
@@ -495,6 +438,29 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
495438 mConnectionInfo = " username=" + username + " ,password=" + password + " ,url=" + mConnectionInfo ;
496439 }
497440
441+ bool ignoreGetMap = settings.value ( key + " /ignoreGetMapURI" , false ).toBool ();
442+ bool ignoreGetFeatureInfo = settings.value ( key + " /ignoreGetFeatureInfoURI" , false ).toBool ();
443+ if ( ignoreGetMap || ignoreGetFeatureInfo )
444+ {
445+ QString connArgs = " ignoreUrl=" ;
446+ if ( ignoreGetMap )
447+ {
448+ connArgs += " GetMap" ;
449+ if ( ignoreGetFeatureInfo )
450+ connArgs += " ;" ;
451+ }
452+ if ( ignoreGetFeatureInfo )
453+ connArgs += " GetFeatureInfo" ;
454+
455+ if ( mConnectionInfo .startsWith ( " username=" ) )
456+ {
457+ mConnectionInfo .prepend ( connArgs + " ," );
458+ }
459+ else
460+ {
461+ mConnectionInfo .prepend ( connArgs + " ,url=" );
462+ }
463+ }
498464
499465 QgsDebugMsg ( QString ( " Connection info: '%1'." ).arg ( mConnectionInfo ) );
500466
@@ -572,31 +538,6 @@ void QgsWMSSourceSelect::addClicked()
572538 }
573539 }
574540
575- if ( cbxIgnoreGetMap->isChecked () || cbxIgnoreGetFeatureInfo->isChecked () )
576- {
577- QString connArgs = " ignoreUrl=" ;
578-
579- if ( cbxIgnoreGetMap->isChecked () )
580- {
581- connArgs += " GetMap" ;
582- if ( cbxIgnoreGetFeatureInfo->isChecked () )
583- connArgs += " ;GetFeatureInfo" ;
584- }
585- else
586- {
587- connArgs += " GetFeatureInfo" ;
588- }
589-
590- if ( connInfo.startsWith ( " username=" ) || connInfo.startsWith ( " tiled=" ) )
591- {
592- connInfo.prepend ( connArgs + " ," );
593- }
594- else
595- {
596- connInfo.prepend ( connArgs + " ,url=" );
597- }
598- }
599-
600541 QgisApp::instance ()->addRasterLayer ( connInfo,
601542 leLayerName->text ().isEmpty () ? layers.join ( " /" ) : leLayerName->text (),
602543 " wms" , layers, styles, format, crs );
@@ -823,7 +764,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
823764 }
824765 }
825766
826- gbCRS->setTitle ( tr ( " Coordinate Reference System (%n available)" , " crs count" , mCRSs .count () ) );
767+ gbCRS->setTitle ( tr ( " Options (%n coordinate reference systems available)" , " crs count" , mCRSs .count () ) );
827768 btnChangeSpatialRefSys->setDisabled ( mCRSs .isEmpty () );
828769
829770 if ( !layers.isEmpty () && !mCRSs .isEmpty () )
0 commit comments