Skip to content

Commit b9ec495

Browse files
dakcartonyalldawson
authored andcommittedJun 9, 2019
Fix WFS connection's version Detect button, which did not support auth
Adds QgsNewHttpConnection protected member to access auth settings
1 parent 904b90d commit b9ec495

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed
 

‎src/gui/qgsnewhttpconnection.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ QPushButton *QgsNewHttpConnection::testConnectButton()
235235
return mTestConnectionButton;
236236
}
237237

238+
QgsAuthSettingsWidget *QgsNewHttpConnection::authSettingsWidget()
239+
{
240+
return mAuthSettings;
241+
}
242+
238243
QPushButton *QgsNewHttpConnection::wfsVersionDetectButton()
239244
{
240245
return mWfsVersionDetectButton;

‎src/gui/qgsnewhttpconnection.h

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

118+
/**
119+
* Returns the current authentication settings widget.
120+
* \since QGIS 3.8
121+
*/
122+
QgsAuthSettingsWidget *authSettingsWidget() SIP_SKIP;
123+
118124
/**
119125
* Returns the "WFS version detect" button.
120126
* \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.