Skip to content

Commit

Permalink
Fix WFS connection's version Detect button, which did not support auth
Browse files Browse the repository at this point in the history
Adds QgsNewHttpConnection protected member to access auth settings
  • Loading branch information
dakcarto authored and nyalldawson committed Jun 9, 2019
1 parent 904b90d commit b9ec495
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -235,6 +235,11 @@ QPushButton *QgsNewHttpConnection::testConnectButton()
return mTestConnectionButton;
}

QgsAuthSettingsWidget *QgsNewHttpConnection::authSettingsWidget()
{
return mAuthSettings;
}

QPushButton *QgsNewHttpConnection::wfsVersionDetectButton()
{
return mWfsVersionDetectButton;
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsnewhttpconnection.h
Expand Up @@ -115,6 +115,12 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo
*/
QPushButton *testConnectButton();

/**
* Returns the current authentication settings widget.
* \since QGIS 3.8
*/
QgsAuthSettingsWidget *authSettingsWidget() SIP_SKIP;

/**
* Returns the "WFS version detect" button.
* \since QGIS 3.2
Expand Down
10 changes: 9 additions & 1 deletion src/providers/wfs/qgswfsnewconnection.cpp
Expand Up @@ -35,7 +35,15 @@ QgsWFSNewConnection::~QgsWFSNewConnection()
void QgsWFSNewConnection::versionDetectButton()
{
delete mCapabilities;
mCapabilities = new QgsWfsCapabilities( urlTrimmed().toString() );

// Honor any defined authentication settings
QgsDataSourceUri uri = QgsDataSourceUri();
uri.setParam( QStringLiteral( "url" ), urlTrimmed().toString() );
uri.setUsername( authSettingsWidget()->username() );
uri.setPassword( authSettingsWidget()->password() );
uri.setAuthConfigId( authSettingsWidget()->configId() );

mCapabilities = new QgsWfsCapabilities( uri.uri( false ) );
connect( mCapabilities, &QgsWfsCapabilities::gotCapabilities, this, &QgsWFSNewConnection::capabilitiesReplyFinished );
const bool synchronous = false;
const bool forceRefresh = true;
Expand Down

0 comments on commit b9ec495

Please sign in to comment.