From e2c361198678c48e6f79f387d9ecc8079d6b6b46 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 31 Jan 2025 12:39:28 +1000 Subject: [PATCH] [sensorthings] Remove option for basic authentication This is not supported by the provider, only authentication config is supported Fixes #59721 --- .../gui/auto_generated/auth/qgsauthsettingswidget.sip.in | 7 +++++++ .../gui/auto_generated/auth/qgsauthsettingswidget.sip.in | 7 +++++++ src/gui/auth/qgsauthsettingswidget.cpp | 6 ++++++ src/gui/auth/qgsauthsettingswidget.h | 7 +++++++ .../sensorthings/qgssensorthingsconnectionwidget.cpp | 3 +++ 5 files changed, 30 insertions(+) diff --git a/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in b/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in index 3d604f327b15..c6df7f3d0b2f 100644 --- a/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in +++ b/python/PyQt6/gui/auto_generated/auth/qgsauthsettingswidget.sip.in @@ -39,6 +39,13 @@ from existing configs, or creating/removing them from auth database :param username: :param password: :param dataprovider: The key of the calling layer provider, if applicable +%End + + void removeBasicSettings(); +%Docstring +Removes the basic authentication tab from the widget. + +.. versionadded:: 3.42 %End void setWarningText( const QString &warningText ); diff --git a/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in b/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in index a7a969fa8c8a..aebdcc09c56b 100644 --- a/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in +++ b/python/gui/auto_generated/auth/qgsauthsettingswidget.sip.in @@ -39,6 +39,13 @@ from existing configs, or creating/removing them from auth database :param username: :param password: :param dataprovider: The key of the calling layer provider, if applicable +%End + + void removeBasicSettings(); +%Docstring +Removes the basic authentication tab from the widget. + +.. versionadded:: 3.42 %End void setWarningText( const QString &warningText ); diff --git a/src/gui/auth/qgsauthsettingswidget.cpp b/src/gui/auth/qgsauthsettingswidget.cpp index c49f11cd2c31..02bfe356e6cd 100644 --- a/src/gui/auth/qgsauthsettingswidget.cpp +++ b/src/gui/auth/qgsauthsettingswidget.cpp @@ -50,6 +50,12 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent, const QString &co updateConvertBtnState(); } +void QgsAuthSettingsWidget::removeBasicSettings() +{ + tabAuth->removeTab( tabAuth->indexOf( tabBasic ) ); + tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) ); +} + void QgsAuthSettingsWidget::setWarningText( const QString &warningText ) { lblWarning->setText( warningText ); diff --git a/src/gui/auth/qgsauthsettingswidget.h b/src/gui/auth/qgsauthsettingswidget.h index e3a422b3fc15..eadfdeccba9e 100644 --- a/src/gui/auth/qgsauthsettingswidget.h +++ b/src/gui/auth/qgsauthsettingswidget.h @@ -62,6 +62,13 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett */ explicit QgsAuthSettingsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &configId = QString(), const QString &username = QString(), const QString &password = QString(), const QString &dataprovider = QString() ); + /** + * Removes the basic authentication tab from the widget. + * + * \since QGIS 3.42 + */ + void removeBasicSettings(); + /** * \brief setWarningText set the text of the warning label * \param warningText the text of the warning label diff --git a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp index e16b5409e2c9..c15dcf2d3a85 100644 --- a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp +++ b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp @@ -29,6 +29,9 @@ QgsSensorThingsConnectionWidget::QgsSensorThingsConnectionWidget( QWidget *paren connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::validate ); connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::changed ); + // only auth config supported, not basic auth + mAuthSettings->removeBasicSettings(); + connect( mAuthSettings, &QgsAuthSettingsWidget::configIdChanged, this, &QgsSensorThingsConnectionWidget::changed ); connect( mAuthSettings, &QgsAuthSettingsWidget::usernameChanged, this, &QgsSensorThingsConnectionWidget::changed ); connect( mAuthSettings, &QgsAuthSettingsWidget::passwordChanged, this, &QgsSensorThingsConnectionWidget::changed );