Skip to content

Commit b1e4a27

Browse files
authoredJun 7, 2019
Merge pull request #30103 from boundlessgeo/master-wfs-conn-dlg
Fix some issues with WFS connection dialog
2 parents 4a60e18 + 3c2022b commit b1e4a27

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed
 

‎python/gui/auto_generated/qgsnewhttpconnection.sip.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Returns the "test connection" button.
9898

9999

100100

101+
101102
virtual QString wfsSettingsKey( const QString &base, const QString &connectionName ) const;
102103
%Docstring
103104
Returns the QSettings key for WFS related settings for the connection.

‎src/gui/qgsnewhttpconnection.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ
165165

166166
void QgsNewHttpConnection::wfsVersionCurrentIndexChanged( int index )
167167
{
168-
cbxWfsFeaturePaging->setEnabled( index == 0 || index == 3 );
169-
lblPageSize->setEnabled( index == 0 || index == 3 );
170-
txtPageSize->setEnabled( index == 0 || index == 3 );
168+
// For now 2019-06-06, leave paging checkable for some WFS version 1.1 servers with support
169+
cbxWfsFeaturePaging->setEnabled( index == 0 || index >= 2 );
170+
lblPageSize->setEnabled( cbxWfsFeaturePaging->isChecked() && ( index == 0 || index >= 2 ) );
171+
txtPageSize->setEnabled( cbxWfsFeaturePaging->isChecked() && ( index == 0 || index >= 2 ) );
171172
cbxWfsIgnoreAxisOrientation->setEnabled( index != 1 );
172173
}
173174

@@ -239,6 +240,11 @@ QPushButton *QgsNewHttpConnection::testConnectButton()
239240
return mTestConnectionButton;
240241
}
241242

243+
QgsAuthSettingsWidget *QgsNewHttpConnection::authSettingsWidget()
244+
{
245+
return mAuthSettings;
246+
}
247+
242248
QPushButton *QgsNewHttpConnection::wfsVersionDetectButton()
243249
{
244250
return mWfsVersionDetectButton;
@@ -317,13 +323,17 @@ void QgsNewHttpConnection::updateServiceSpecificSettings()
317323
txtReferer->setText( settings.value( wmsKey + "/referer" ).toString() );
318324
txtMaxNumFeatures->setText( settings.value( wfsKey + "/maxnumfeatures" ).toString() );
319325

320-
bool pagingEnabled = settings.value( wfsKey + "/pagingenabled", true ).toBool();
326+
// Only default to paging enabled if WFS 2.0.0 or higher
327+
bool pagingEnabled = settings.value( wfsKey + "/pagingenabled", ( versionIdx == 0 || versionIdx >= 3 ) ).toBool();
321328
txtPageSize->setText( settings.value( wfsKey + "/pagesize" ).toString() );
322329
cbxWfsFeaturePaging->setChecked( pagingEnabled );
323330

324-
txtPageSize->setEnabled( pagingEnabled );
325-
lblPageSize->setEnabled( pagingEnabled );
326-
cbxWfsFeaturePaging->setEnabled( pagingEnabled );
331+
// Enable/disable these items per WFS versions
332+
// For now 2019-06-06, leave paging checkable for some WFS version 1.1 servers with support
333+
txtPageSize->setEnabled( pagingEnabled && ( versionIdx == 0 || versionIdx >= 2 ) );
334+
lblPageSize->setEnabled( pagingEnabled && ( versionIdx == 0 || versionIdx >= 2 ) );
335+
cbxWfsFeaturePaging->setEnabled( versionIdx == 0 || versionIdx >= 2 );
336+
cbxWfsIgnoreAxisOrientation->setEnabled( versionIdx != 1 );
327337
}
328338

329339
QUrl QgsNewHttpConnection::urlTrimmed() const

‎src/gui/qgsnewhttpconnection.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo
116116
*/
117117
QPushButton *testConnectButton();
118118

119+
/**
120+
* Returns the current authentication settings widget.
121+
* \since QGIS 3.8
122+
*/
123+
QgsAuthSettingsWidget *authSettingsWidget() SIP_SKIP;
124+
119125
/**
120126
* Returns the "WFS version detect" button.
121127
* \since QGIS 3.2

‎src/providers/wfs/qgswfsnewconnection.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ QgsWFSNewConnection::~QgsWFSNewConnection()
3535
void QgsWFSNewConnection::versionDetectButton()
3636
{
3737
delete mCapabilities;
38-
mCapabilities = new QgsWfsCapabilities( urlTrimmed().toString() );
38+
39+
// Honor any defined authentication settings
40+
QgsDataSourceUri uri = QgsDataSourceUri();
41+
uri.setParam( QStringLiteral( "url" ), urlTrimmed().toString() );
42+
uri.setUsername( authSettingsWidget()->username() );
43+
uri.setPassword( authSettingsWidget()->password() );
44+
uri.setAuthConfigId( authSettingsWidget()->configId() );
45+
46+
mCapabilities = new QgsWfsCapabilities( uri.uri( false ) );
3947
connect( mCapabilities, &QgsWfsCapabilities::gotCapabilities, this, &QgsWFSNewConnection::capabilitiesReplyFinished );
4048
const bool synchronous = false;
4149
const bool forceRefresh = true;

0 commit comments

Comments
 (0)
Please sign in to comment.