@@ -68,9 +68,6 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
68
68
mAddButton ->setEnabled ( false );
69
69
populateConnectionList ();
70
70
71
- cbxIgnoreGetMap->setEnabled ( false );
72
- cbxIgnoreGetFeatureInfo->setEnabled ( false );
73
-
74
71
QHBoxLayout *layout = new QHBoxLayout;
75
72
mImageFormatGroup = new QButtonGroup;
76
73
@@ -411,57 +408,6 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
411
408
lstLayers->expandItem ( lstLayers->topLevelItem ( 0 ) );
412
409
}
413
410
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
-
465
411
return true ;
466
412
}
467
413
@@ -475,12 +421,9 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
475
421
QString credentialsKey = " /Qgis/WMS/" + cmbConnections->currentText ();
476
422
477
423
QStringList connStringParts;
478
- QString part;
479
-
480
- connStringParts += settings.value ( key + " /url" ).toString ();
481
424
482
425
mConnName = cmbConnections->currentText ();
483
- mConnectionInfo = connStringParts. join ( " " );
426
+ mConnectionInfo = settings. value ( key + " /url " ). toString ( );
484
427
485
428
// Check for credentials and prepend to the connection info
486
429
QString username = settings.value ( credentialsKey + " /username" ).toString ();
@@ -495,6 +438,29 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
495
438
mConnectionInfo = " username=" + username + " ,password=" + password + " ,url=" + mConnectionInfo ;
496
439
}
497
440
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
+ }
498
464
499
465
QgsDebugMsg ( QString ( " Connection info: '%1'." ).arg ( mConnectionInfo ) );
500
466
@@ -572,31 +538,6 @@ void QgsWMSSourceSelect::addClicked()
572
538
}
573
539
}
574
540
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
-
600
541
QgisApp::instance ()->addRasterLayer ( connInfo,
601
542
leLayerName->text ().isEmpty () ? layers.join ( " /" ) : leLayerName->text (),
602
543
" wms" , layers, styles, format, crs );
@@ -823,7 +764,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
823
764
}
824
765
}
825
766
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 () ) );
827
768
btnChangeSpatialRefSys->setDisabled ( mCRSs .isEmpty () );
828
769
829
770
if ( !layers.isEmpty () && !mCRSs .isEmpty () )
0 commit comments