Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #30103 from boundlessgeo/master-wfs-conn-dlg
Browse files Browse the repository at this point in the history
Fix some issues with WFS connection dialog
  • Loading branch information
rouault committed Jun 7, 2019
2 parents 4a60e18 + 3c2022b commit b1e4a27
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions python/gui/auto_generated/qgsnewhttpconnection.sip.in
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
24 changes: 17 additions & 7 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -165,9 +165,10 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ

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

Expand Down Expand Up @@ -239,6 +240,11 @@ QPushButton *QgsNewHttpConnection::testConnectButton()
return mTestConnectionButton;
}

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

QPushButton *QgsNewHttpConnection::wfsVersionDetectButton()
{
return mWfsVersionDetectButton;
Expand Down Expand Up @@ -317,13 +323,17 @@ void QgsNewHttpConnection::updateServiceSpecificSettings()
txtReferer->setText( settings.value( wmsKey + "/referer" ).toString() );
txtMaxNumFeatures->setText( settings.value( wfsKey + "/maxnumfeatures" ).toString() );

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

txtPageSize->setEnabled( pagingEnabled );
lblPageSize->setEnabled( pagingEnabled );
cbxWfsFeaturePaging->setEnabled( pagingEnabled );
// Enable/disable these items per WFS versions
// For now 2019-06-06, leave paging checkable for some WFS version 1.1 servers with support
txtPageSize->setEnabled( pagingEnabled && ( versionIdx == 0 || versionIdx >= 2 ) );
lblPageSize->setEnabled( pagingEnabled && ( versionIdx == 0 || versionIdx >= 2 ) );
cbxWfsFeaturePaging->setEnabled( versionIdx == 0 || versionIdx >= 2 );
cbxWfsIgnoreAxisOrientation->setEnabled( versionIdx != 1 );
}

QUrl QgsNewHttpConnection::urlTrimmed() const
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsnewhttpconnection.h
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
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 b1e4a27

Please sign in to comment.