QGIS API Documentation 3.43.0-Master (3ee7834ace6)
qgsnewhttpconnection.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsnewhttpconnection.cpp - selector for a new HTTP server for WMS, etc.
3 -------------------
4 begin : 3 April 2005
5 copyright : (C) 2005 by Brendan Morley
6 email : morb at ozemail dot com dot au
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18#include "moc_qgsnewhttpconnection.cpp"
20#include "qgssettings.h"
21#include "qgshelp.h"
22#include "qgsgui.h"
24#include "qgsowsconnection.h"
27
28#include <QMessageBox>
29#include <QUrl>
30#include <QPushButton>
31#include <QRegularExpression>
32#include <QRegularExpressionValidator>
33#include <QUrlQuery>
34
35const QgsSettingsEntryBool *QgsNewHttpConnection::settingsIgnoreReportedLayerExtentsDefault = new QgsSettingsEntryBool( QStringLiteral( "ignore-reported-layer-extents-default" ), sTreeHttpConnectionDialog, false );
36
37QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes types, const QString &serviceName, const QString &connectionName, QgsNewHttpConnection::Flags flags, Qt::WindowFlags fl )
38 : QDialog( parent, fl )
39 , mTypes( types )
40 , mServiceName( serviceName )
41 , mOriginalConnName( connectionName )
42{
43 setupUi( this );
44
45 // compatibility fix with former API (pre 3.26) when serviceName was a setting key instead
46 if ( mServiceName.startsWith( QLatin1String( "qgis/" ) ) )
47 {
48 // It would be obviously much better to use mBaseKey also for credentials,
49 // but for some strange reason a different hardcoded key was used instead.
50 // WFS and WMS credentials were mixed with the same key WMS.
51 // Only WMS and WFS providers are using QgsNewHttpConnection at this moment
52 // using connection-wms and connection-wfs -> parse credential key from it.
53 mServiceName = mServiceName.split( '-' ).last().toUpper();
54 }
55
56 if ( !( flags & FlagShowHttpSettings ) )
57 mHttpHeaders->hide();
58
60
61 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsNewHttpConnection::showHelp );
62
63 QString connectionType = mServiceName;
64 if ( mServiceName == QLatin1String( "WMS" ) )
65 {
66 connectionType = QStringLiteral( "WMS/WMTS" );
67 }
68 setWindowTitle( tr( "Create a New %1 Connection" ).arg( connectionType ) );
69
70 txtName->setValidator( new QRegularExpressionValidator( QRegularExpression( "[^\\/]+" ), txtName ) );
71
72 cmbDpiMode->clear();
73 cmbDpiMode->addItem( tr( "all" ), static_cast<int>( Qgis::DpiMode::All ) );
74 cmbDpiMode->addItem( tr( "off" ), static_cast<int>( Qgis::DpiMode::Off ) );
75 cmbDpiMode->addItem( tr( "QGIS" ), static_cast<int>( Qgis::DpiMode::QGIS ) );
76 cmbDpiMode->addItem( tr( "UMN" ), static_cast<int>( Qgis::DpiMode::UMN ) );
77 cmbDpiMode->addItem( tr( "GeoServer" ), static_cast<int>( Qgis::DpiMode::GeoServer ) );
78
79 cmbTilePixelRatio->clear();
80 cmbTilePixelRatio->addItem( tr( "Undefined (not scaled)" ), static_cast<int>( Qgis::TilePixelRatio::Undefined ) );
81 cmbTilePixelRatio->addItem( tr( "Standard (96 DPI)" ), static_cast<int>( Qgis::TilePixelRatio::StandardDpi ) );
82 cmbTilePixelRatio->addItem( tr( "High (192 DPI)" ), static_cast<int>( Qgis::TilePixelRatio::HighDpi ) );
83
84 cmbVersion->clear();
85 cmbVersion->addItem( tr( "Maximum" ) );
86 cmbVersion->addItem( tr( "1.0" ) );
87 cmbVersion->addItem( tr( "1.1" ) );
88 cmbVersion->addItem( tr( "2.0" ) );
89 cmbVersion->addItem( tr( "OGC API - Features" ) );
90 connect( cmbVersion, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsNewHttpConnection::wfsVersionCurrentIndexChanged );
91
92 mComboHttpMethod->addItem( QStringLiteral( "GET" ), QVariant::fromValue( Qgis::HttpMethod::Get ) );
93 mComboHttpMethod->addItem( QStringLiteral( "POST" ), QVariant::fromValue( Qgis::HttpMethod::Post ) );
94 mComboHttpMethod->setCurrentIndex( mComboHttpMethod->findData( QVariant::fromValue( Qgis::HttpMethod::Get ) ) );
95
96 cmbFeaturePaging->clear();
97 cmbFeaturePaging->addItem( tr( "Default (trust server capabilities)" ) );
98 cmbFeaturePaging->addItem( tr( "Enabled" ) );
99 cmbFeaturePaging->addItem( tr( "Disabled" ) );
100 connect( cmbFeaturePaging, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsNewHttpConnection::wfsFeaturePagingCurrentIndexChanged );
101
102 cbxWmsIgnoreReportedLayerExtents->setChecked( settingsIgnoreReportedLayerExtentsDefault->value() );
103
104 if ( !connectionName.isEmpty() )
105 {
106 // populate the dialog with the information stored for the connection
107 // populate the fields with the stored setting parameters
108
109 txtName->setText( connectionName );
110 const QStringList detailParameters { mServiceName.toLower(), connectionName };
111 txtUrl->setText( QgsOwsConnection::settingsUrl->value( detailParameters ) );
112 mHttpHeaders->setHeaders( QgsHttpHeaders( QgsOwsConnection::settingsHeaders->value( detailParameters ) ) );
113
115
116 // Authentication
117 mAuthSettings->setUsername( QgsOwsConnection::settingsUsername->value( detailParameters ) );
118 mAuthSettings->setPassword( QgsOwsConnection::settingsPassword->value( detailParameters ) );
119 mAuthSettings->setConfigId( QgsOwsConnection::settingsAuthCfg->value( detailParameters ) );
120 }
121 mWfsVersionDetectButton->setDisabled( txtUrl->text().isEmpty() );
122
123 if ( !( mTypes & ConnectionWms ) && !( mTypes & ConnectionWcs ) )
124 {
125 mWmsOptionsGroupBox->setVisible( false );
126 mGroupBox->layout()->removeWidget( mWmsOptionsGroupBox );
127 }
128 if ( !( mTypes & ConnectionWfs ) )
129 {
130 mWfsOptionsGroupBox->setVisible( false );
131 mGroupBox->layout()->removeWidget( mWfsOptionsGroupBox );
132 }
133 else
134 {
135 txtUrl->setToolTip( tr( "HTTP address of the WFS service, or landing page of a OGC API service<br>(an ending slash might be needed for some OGC API servers)" ) );
136 }
137
138 if ( mTypes & ConnectionWcs )
139 {
140 cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) );
141 cbxWmsIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) );
142 if ( !( mTypes & ConnectionWms ) )
143 {
144 mWmsOptionsGroupBox->setTitle( tr( "WCS Options" ) );
145
146 cbxIgnoreGetFeatureInfoURI->setVisible( false );
147 mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
148
149 sbFeatureCount->setVisible( false );
150 mGroupBox->layout()->removeWidget( sbFeatureCount );
151 lblFeatureCount->setVisible( false );
152 mGroupBox->layout()->removeWidget( lblFeatureCount );
153
154 cmbDpiMode->setVisible( false );
155 mGroupBox->layout()->removeWidget( cmbDpiMode );
156 lblDpiMode->setVisible( false );
157 mGroupBox->layout()->removeWidget( lblDpiMode );
158 cmbTilePixelRatio->setVisible( false );
159 mGroupBox->layout()->removeWidget( cmbTilePixelRatio );
160 lblTilePixelRatio->setVisible( false );
161 mGroupBox->layout()->removeWidget( lblTilePixelRatio );
162 }
163 }
164
165 if ( !( flags & FlagShowTestConnection ) )
166 {
167 mTestConnectionButton->hide();
168 mGroupBox->layout()->removeWidget( mTestConnectionButton );
169 }
170
171 if ( flags & FlagHideAuthenticationGroup )
172 {
173 mAuthGroupBox->hide();
174 mGroupBox->layout()->removeWidget( mAuthGroupBox );
175 }
176 // Adjust height
177 const int w = width();
178 adjustSize();
179 resize( w, height() );
180
181 connect( txtName, &QLineEdit::textChanged, this, &QgsNewHttpConnection::nameChanged );
182 connect( txtUrl, &QLineEdit::textChanged, this, &QgsNewHttpConnection::urlChanged );
183
184 buttonBox->button( QDialogButtonBox::Ok )->setDisabled( true );
185 connect( txtName, &QLineEdit::textChanged, this, &QgsNewHttpConnection::updateOkButtonState );
186 connect( txtUrl, &QLineEdit::textChanged, this, &QgsNewHttpConnection::updateOkButtonState );
187
188 nameChanged( connectionName );
189}
190
191void QgsNewHttpConnection::wfsVersionCurrentIndexChanged( int index )
192{
193 // For now 2019-06-06, leave paging checkable for some WFS version 1.1 servers with support
194 const bool pagingOptionsEnabled = ( index == WFS_VERSION_MAX || index >= WFS_VERSION_1_1 );
195 cmbFeaturePaging->setEnabled( pagingOptionsEnabled );
196 lblPageSize->setEnabled( pagingOptionsEnabled );
197 txtPageSize->setEnabled( pagingOptionsEnabled );
198 cbxWfsIgnoreAxisOrientation->setEnabled( index != WFS_VERSION_1_0 && index != WFS_VERSION_API_FEATURES_1_0 );
199 cbxWfsInvertAxisOrientation->setEnabled( index != WFS_VERSION_API_FEATURES_1_0 );
200 wfsUseGml2EncodingForTransactions()->setEnabled( index == WFS_VERSION_1_1 );
201}
202
203void QgsNewHttpConnection::wfsFeaturePagingCurrentIndexChanged( int index )
204{
205 const bool pagingNotDisabled = index != static_cast<int>( QgsNewHttpConnection::WfsFeaturePagingIndex::DISABLED );
206 lblPageSize->setEnabled( pagingNotDisabled );
207 txtPageSize->setEnabled( pagingNotDisabled );
208}
209
211{
212 return txtName->text();
213}
214
216{
217 return txtUrl->text();
218}
219
220void QgsNewHttpConnection::nameChanged( const QString &text )
221{
222 Q_UNUSED( text )
223 buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
224}
225
226void QgsNewHttpConnection::urlChanged( const QString &text )
227{
228 Q_UNUSED( text )
229 buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
230 mWfsVersionDetectButton->setDisabled( txtUrl->text().isEmpty() );
231}
232
233void QgsNewHttpConnection::updateOkButtonState()
234{
235 const bool enabled = !txtName->text().isEmpty() && !txtUrl->text().isEmpty();
236 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled );
237}
238
240{
241 const QString newConnectionName = txtName->text();
242
243 bool urlExists = QgsOwsConnection::settingsUrl->exists( { mServiceName.toLower(), newConnectionName } );
244
245 // warn if entry was renamed to an existing connection
246 if ( ( mOriginalConnName.isNull() || mOriginalConnName.compare( newConnectionName, Qt::CaseInsensitive ) != 0 ) && urlExists && QMessageBox::question( this, tr( "Save Connection" ), tr( "Should the existing connection %1 be overwritten?" ).arg( txtName->text() ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
247 {
248 return false;
249 }
250
251 if ( !mAuthSettings->password().isEmpty() && QMessageBox::question( this, tr( "Saving Passwords" ), tr( "WARNING: You have entered a password. It will be stored in unsecured plain text in your project files and your home directory (Unix-like OS) or user profile (Windows). If you want to avoid this, press Cancel and either:\n\na) Don't provide a password in the connection settings — it will be requested interactively when needed;\nb) Use the Configuration tab to add your credentials in an HTTP Basic Authentication method and store them in an encrypted database." ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
252 {
253 return false;
254 }
255
256 return true;
257}
258
260{
261 return mTestConnectionButton;
262}
263
268
270{
271 return mWfsVersionDetectButton;
272}
273
275{
276 return cmbVersion;
277}
278
280{
281 return cmbFeaturePaging;
282}
283
285{
286 return cbxWfsUseGml2EncodingForTransactions;
287}
288
290{
291 return txtPageSize;
292}
293
295{
296 return mComboHttpMethod->currentData().value< Qgis::HttpMethod >();
297}
298
299QString QgsNewHttpConnection::wfsSettingsKey( const QString &base, const QString &connectionName ) const
300{
301 return base + connectionName;
302}
303
304QString QgsNewHttpConnection::wmsSettingsKey( const QString &base, const QString &connectionName ) const
305{
306 return base + connectionName;
307}
308
310{
311 QStringList detailsParameters = { mServiceName.toLower(), mOriginalConnName };
312
313 cbxIgnoreGetMapURI->setChecked( QgsOwsConnection::settingsIgnoreGetMapURI->value( detailsParameters ) );
314 cbxWmsIgnoreReportedLayerExtents->setChecked( QgsOwsConnection::settingsReportedLayerExtents->value( detailsParameters ) );
315 cbxWfsIgnoreAxisOrientation->setChecked( QgsOwsConnection::settingsIgnoreAxisOrientation->value( detailsParameters ) );
316 cbxWfsInvertAxisOrientation->setChecked( QgsOwsConnection::settingsInvertAxisOrientation->value( detailsParameters ) );
317 cbxWfsUseGml2EncodingForTransactions->setChecked( QgsOwsConnection::settingsPreferCoordinatesForWfsT11->value( detailsParameters ) );
318
319 cbxWmsIgnoreAxisOrientation->setChecked( QgsOwsConnection::settingsIgnoreAxisOrientation->value( detailsParameters ) );
320 cbxWmsInvertAxisOrientation->setChecked( QgsOwsConnection::settingsInvertAxisOrientation->value( detailsParameters ) );
321 cbxIgnoreGetFeatureInfoURI->setChecked( QgsOwsConnection::settingsIgnoreGetFeatureInfoURI->value( detailsParameters ) );
322 cbxSmoothPixmapTransform->setChecked( QgsOwsConnection::settingsSmoothPixmapTransform->value( detailsParameters ) );
323
324 Qgis::DpiMode dpiMode = QgsOwsConnection::settingsDpiMode->value( detailsParameters );
325 cmbDpiMode->setCurrentIndex( cmbDpiMode->findData( static_cast<int>( dpiMode ) ) );
326 Qgis::TilePixelRatio tilePixelRatio = QgsOwsConnection::settingsTilePixelRatio->value( detailsParameters );
327 cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData( static_cast<int>( tilePixelRatio ) ) );
328
329 sbFeatureCount->setValue( QgsOwsConnection::settingsFeatureCount->value( detailsParameters ) );
330
331 const QString version = QgsOwsConnection::settingsVersion->value( detailsParameters );
332 int versionIdx = WFS_VERSION_MAX; // AUTO
333 if ( version == QLatin1String( "1.0.0" ) )
334 versionIdx = WFS_VERSION_1_0;
335 else if ( version == QLatin1String( "1.1.0" ) )
336 versionIdx = WFS_VERSION_1_1;
337 else if ( version == QLatin1String( "2.0.0" ) )
338 versionIdx = WFS_VERSION_2_0;
339 else if ( version == QLatin1String( "OGC_API_FEATURES" ) )
340 versionIdx = WFS_VERSION_API_FEATURES_1_0;
341 cmbVersion->setCurrentIndex( versionIdx );
342
343 // Enable/disable these items per WFS versions
344 wfsVersionCurrentIndexChanged( versionIdx );
345
346 mHttpHeaders->setHeaders( QgsHttpHeaders( QgsOwsConnection::settingsHeaders->value( { mServiceName.toLower(), mOriginalConnName } ) ) );
347
348 txtMaxNumFeatures->setText( QgsOwsConnection::settingsMaxNumFeatures->value( detailsParameters ) );
349
350 // Only default to paging enabled if WFS 2.0.0 or higher
351 const QString pagingEnabled = QgsOwsConnection::settingsPagingEnabled->value( detailsParameters );
352 if ( pagingEnabled == QLatin1String( "enabled" ) )
353 cmbFeaturePaging->setCurrentIndex( static_cast<int>( QgsNewHttpConnection::WfsFeaturePagingIndex::ENABLED ) );
354 else if ( pagingEnabled == QLatin1String( "disabled" ) )
355 cmbFeaturePaging->setCurrentIndex( static_cast<int>( QgsNewHttpConnection::WfsFeaturePagingIndex::DISABLED ) );
356 else
357 cmbFeaturePaging->setCurrentIndex( static_cast<int>( QgsNewHttpConnection::WfsFeaturePagingIndex::DEFAULT ) );
358
359 mComboHttpMethod->setCurrentIndex( mComboHttpMethod->findData( QVariant::fromValue( QgsOwsConnection::settingsPreferredHttpMethod->value( detailsParameters ) ) ) );
360 txtPageSize->setText( QgsOwsConnection::settingsPagesize->value( detailsParameters ) );
361}
362
364{
365 QUrl url( txtUrl->text().trimmed() );
366 QUrlQuery query( url );
367 const QList<QPair<QString, QString>> items = query.queryItems( QUrl::FullyEncoded );
368 QHash<QString, QPair<QString, QString>> params;
369 for ( const QPair<QString, QString> &it : items )
370 {
371 params.insert( it.first.toUpper(), it );
372 }
373
374 if ( params[QStringLiteral( "SERVICE" )].second.toUpper() == "WMS" || params[QStringLiteral( "SERVICE" )].second.toUpper() == "WFS" || params[QStringLiteral( "SERVICE" )].second.toUpper() == "WCS" )
375 {
376 query.removeQueryItem( params.value( QStringLiteral( "SERVICE" ) ).first );
377 query.removeQueryItem( params.value( QStringLiteral( "REQUEST" ) ).first );
378 query.removeQueryItem( params.value( QStringLiteral( "FORMAT" ) ).first );
379 }
380
381 url.setQuery( query );
382
383 if ( url.path( QUrl::FullyEncoded ).isEmpty() )
384 {
385 url.setPath( fromEncodedComponent_helper( "/" ) );
386 }
387 return url;
388}
389
391{
392 const QString newConnectionName = txtName->text();
393
394 if ( !validate() )
395 return;
396
397 QgsSettings settings;
398
399 // on rename delete original entry first
400 if ( !mOriginalConnName.isNull() && mOriginalConnName != newConnectionName )
401 {
402 QgsOwsConnection::sTreeOwsConnections->deleteItem( mOriginalConnName, { mServiceName.toLower() } );
403 settings.sync();
404 }
405
406 QStringList detailsParameters = { mServiceName.toLower(), newConnectionName };
407
408 const QUrl url( urlTrimmed() );
409 QgsOwsConnection::settingsUrl->setValue( url.toString(), detailsParameters );
410
411 if ( mTypes & ConnectionWfs )
412 {
413 QgsOwsConnection::settingsIgnoreAxisOrientation->setValue( cbxWfsIgnoreAxisOrientation->isChecked(), detailsParameters );
414 QgsOwsConnection::settingsInvertAxisOrientation->setValue( cbxWfsInvertAxisOrientation->isChecked(), detailsParameters );
415 QgsOwsConnection::settingsPreferCoordinatesForWfsT11->setValue( cbxWfsUseGml2EncodingForTransactions->isChecked(), detailsParameters );
416 }
417 if ( mTypes & ConnectionWms || mTypes & ConnectionWcs )
418 {
419 QgsOwsConnection::settingsIgnoreAxisOrientation->setValue( cbxWmsIgnoreAxisOrientation->isChecked(), detailsParameters );
420 QgsOwsConnection::settingsInvertAxisOrientation->setValue( cbxWmsInvertAxisOrientation->isChecked(), detailsParameters );
421
422 QgsOwsConnection::settingsReportedLayerExtents->setValue( cbxWmsIgnoreReportedLayerExtents->isChecked(), detailsParameters );
423 QgsOwsConnection::settingsIgnoreGetMapURI->setValue( cbxIgnoreGetMapURI->isChecked(), detailsParameters );
424 QgsOwsConnection::settingsSmoothPixmapTransform->setValue( cbxSmoothPixmapTransform->isChecked(), detailsParameters );
425
426 Qgis::DpiMode dpiMode = cmbDpiMode->currentData().value<Qgis::DpiMode>();
427 QgsOwsConnection::settingsDpiMode->setValue( dpiMode, detailsParameters );
428 Qgis::TilePixelRatio tilePixelRatio = cmbTilePixelRatio->currentData().value<Qgis::TilePixelRatio>();
429 QgsOwsConnection::settingsTilePixelRatio->setValue( tilePixelRatio, detailsParameters );
430
431 QgsOwsConnection::settingsHeaders->setValue( mHttpHeaders->httpHeaders().headers(), detailsParameters );
432 }
433 if ( mTypes & ConnectionWms )
434 {
435 QgsOwsConnection::settingsIgnoreGetFeatureInfoURI->setValue( cbxIgnoreGetFeatureInfoURI->isChecked(), detailsParameters );
436 QgsOwsConnection::settingsFeatureCount->setValue( sbFeatureCount->value(), detailsParameters );
437 }
438 if ( mTypes & ConnectionWfs )
439 {
440 QString version = QStringLiteral( "auto" );
441 switch ( cmbVersion->currentIndex() )
442 {
443 case WFS_VERSION_MAX:
444 version = QStringLiteral( "auto" );
445 break;
446 case WFS_VERSION_1_0:
447 version = QStringLiteral( "1.0.0" );
448 break;
449 case WFS_VERSION_1_1:
450 version = QStringLiteral( "1.1.0" );
451 break;
452 case WFS_VERSION_2_0:
453 version = QStringLiteral( "2.0.0" );
454 break;
456 version = QStringLiteral( "OGC_API_FEATURES" );
457 break;
458 }
459 QgsOwsConnection::settingsVersion->setValue( version, detailsParameters );
460 QgsOwsConnection::settingsMaxNumFeatures->setValue( txtMaxNumFeatures->text(), detailsParameters );
461 QgsOwsConnection::settingsPagesize->setValue( txtPageSize->text(), detailsParameters );
462 QgsOwsConnection::settingsPreferredHttpMethod->setValue( mComboHttpMethod->currentData().value< Qgis::HttpMethod >(), detailsParameters );
463
464 QString pagingEnabled = QStringLiteral( "default" );
465 switch ( cmbFeaturePaging->currentIndex() )
466 {
468 pagingEnabled = QStringLiteral( "default" );
469 break;
471 pagingEnabled = QStringLiteral( "enabled" );
472 break;
474 pagingEnabled = QStringLiteral( "disabled" );
475 break;
476 }
477 QgsOwsConnection::settingsPagingEnabled->setValue( pagingEnabled, detailsParameters );
478 }
479
480 QStringList credentialsParameters = { mServiceName.toLower(), newConnectionName };
481 QgsOwsConnection::settingsUsername->setValue( mAuthSettings->username(), credentialsParameters );
482 QgsOwsConnection::settingsPassword->setValue( mAuthSettings->password(), credentialsParameters );
483 QgsOwsConnection::settingsAuthCfg->setValue( mAuthSettings->configId(), credentialsParameters );
484
485 if ( mHttpHeaders->isVisible() )
486 QgsOwsConnection::settingsHeaders->setValue( mHttpHeaders->httpHeaders().headers(), credentialsParameters );
487
488 QgsOwsConnection::sTreeOwsConnections->setSelectedItem( newConnectionName, { mServiceName.toLower() } );
489
490 QDialog::accept();
491}
492
493void QgsNewHttpConnection::showHelp()
494{
495 QgsHelp::openHelp( QStringLiteral( "working_with_ogc/index.html" ) );
496}
TilePixelRatio
DpiMode enum.
Definition qgis.h:3240
@ Undefined
Undefined (not scale)
@ HighDpi
High (192 DPI)
@ StandardDpi
Standard (96 DPI)
DpiMode
DpiMode enum.
Definition qgis.h:3226
@ GeoServer
GeoServer.
HttpMethod
Different methods of HTTP requests.
Definition qgis.h:1001
@ Post
POST method.
@ Get
GET method.
Widget for entering authentication credentials both in the form username/password and by using QGIS A...
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Definition qgsgui.cpp:210
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition qgshelp.cpp:39
This class implements simple http header management.
Qgis::HttpMethod preferredHttpMethod() const
Returns the selected preferred HTTP method.
QPushButton * testConnectButton()
Returns the "test connection" button.
QgsAuthSettingsWidget * authSettingsWidget()
Returns the current authentication settings widget.
QComboBox * wfsPagingComboBox()
Returns the "WFS paging" combobox.
virtual bool validate()
Returns true if dialog settings are valid, or false if current settings are not valid and the dialog ...
QgsNewHttpConnection(QWidget *parent=nullptr, QgsNewHttpConnection::ConnectionTypes types=ConnectionWms, const QString &serviceName="WMS", const QString &connectionName=QString(), QgsNewHttpConnection::Flags flags=QgsNewHttpConnection::Flags(), Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor for QgsNewHttpConnection.
QString name() const
Returns the current connection name.
@ FlagShowHttpSettings
Display the 'http' group.
@ FlagHideAuthenticationGroup
Hide the Authentication group.
@ FlagShowTestConnection
Display the 'test connection' button.
QCheckBox * wfsUseGml2EncodingForTransactions()
Returns the "Use GML2 encoding for transactions" checkbox.
QComboBox * wfsVersionComboBox()
Returns the "WFS version" combobox.
virtual QString wmsSettingsKey(const QString &base, const QString &connectionName) const
Returns the QSettings key for WMS related settings for the connection.
virtual QString wfsSettingsKey(const QString &base, const QString &connectionName) const
Returns the QSettings key for WFS related settings for the connection.
QString url() const
Returns the current connection url.
QPushButton * wfsVersionDetectButton()
Returns the "WFS version detect" button.
static const QgsSettingsEntryBool * settingsIgnoreReportedLayerExtentsDefault
QUrl urlTrimmed() const
Returns the url.
QLineEdit * wfsPageSizeLineEdit()
Returns the "WFS page size" edit.
void updateServiceSpecificSettings()
Triggers a resync of the GUI widgets for the service specific settings (i.e.
@ ConnectionWms
WMS connection.
@ ConnectionWfs
WFS connection.
@ ConnectionWcs
WCS connection.
QFlags< ConnectionType > ConnectionTypes
static const QgsSettingsEntryInteger * settingsFeatureCount
static const QgsSettingsEntryBool * settingsPreferCoordinatesForWfsT11
static const QgsSettingsEntryEnumFlag< Qgis::HttpMethod > * settingsPreferredHttpMethod
static const QgsSettingsEntryString * settingsPagingEnabled
static const QgsSettingsEntryString * settingsMaxNumFeatures
static QgsSettingsTreeNamedListNode * sTreeOwsConnections
static const QgsSettingsEntryBool * settingsIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryBool * settingsReportedLayerExtents
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > * settingsDpiMode
static const QgsSettingsEntryBool * settingsIgnoreAxisOrientation
static const QgsSettingsEntryBool * settingsInvertAxisOrientation
static const QgsSettingsEntryString * settingsVersion
static const QgsSettingsEntryString * settingsPagesize
static const QgsSettingsEntryString * settingsAuthCfg
static const QgsSettingsEntryEnumFlag< Qgis::TilePixelRatio > * settingsTilePixelRatio
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryBool * settingsSmoothPixmapTransform
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryBool * settingsIgnoreGetMapURI
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
bool setValue(const T &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.
A boolean settings entry.
void deleteItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Deletes a named item from the named list node.
void setSelectedItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Sets the selected named item from the named list node.
This class is a composition of two QSettings instances:
Definition qgssettings.h:64
void sync()
Writes any unsaved changes to permanent storage, and reloads any settings that have been changed in t...
QString fromEncodedComponent_helper(const QByteArray &ba)