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 committed Jun 6, 2019
1 parent 95137dc commit 018df8c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/gui/auto_generated/qgsnewhttpconnection.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Returns the "test connection" button.




virtual QString wfsSettingsKey( const QString &base, const QString &connectionName ) const;
%Docstring
Returns the QSettings key for WFS related settings for the connection.
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgsnewhttpconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,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
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,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
Original file line number Diff line number Diff line change
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 018df8c

Please sign in to comment.