17#include "moc_qgsauthsettingswidget.cpp"
26 , mDataprovider( dataprovider )
37 mAuthConfigSelect->setConfigId(
configId );
43 connect( txtUserName, &QLineEdit::textChanged,
this, &QgsAuthSettingsWidget::userNameTextChanged );
44 connect( txtPassword, &QLineEdit::textChanged,
this, &QgsAuthSettingsWidget::passwordTextChanged );
50 updateConvertBtnState();
55 lblWarning->setText( warningText );
60 lblBasic->setText( basicText );
62 lblBasic->setVisible( !basicText.isEmpty() );
67 return txtUserName->text();
78 return txtPassword->text();
89 mAuthConfigSelect->setConfigId(
configId );
101 return mDataprovider;
106 const QString out = tr(
"Warning: credentials stored as plain text in %1." );
110 return out.arg( tr(
"project file" ) );
112 return out.arg( tr(
"user settings" ) );
119 return mAuthConfigSelect->configId();
124 return btnConvertToEncrypted->isEnabled();
131 cbStorePassword->show();
132 cbStoreUsername->show();
136 cbStorePassword->hide();
137 cbStoreUsername->hide();
143 cbStoreUsername->setChecked( checked );
148 cbStorePassword->setChecked( checked );
153 return cbStorePassword->isChecked();
158 return cbStoreUsername->isChecked();
163 return tabAuth->currentIndex() == tabAuth->indexOf( tabConfigurations );
168 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
170 config.
setName( tr(
"Converted config %1" ).arg( QDateTime::currentDateTime().toString() ) );
171 config.
setConfig( QStringLiteral(
"username" ), txtUserName->text() );
172 config.
setConfig( QStringLiteral(
"password" ), txtPassword->text() );
175 mAuthConfigSelect->showMessage( tr(
"Couldn't create a Basic authentication configuration!" ) );
180 txtUserName->setText( QString() );
181 txtPassword->setText( QString() );
182 mAuthConfigSelect->setConfigId( config.
id() );
187void QgsAuthSettingsWidget::userNameTextChanged(
const QString &text )
190 updateConvertBtnState();
194void QgsAuthSettingsWidget::passwordTextChanged(
const QString &text )
197 updateConvertBtnState();
201void QgsAuthSettingsWidget::updateConvertBtnState()
203 btnConvertToEncrypted->setEnabled( !txtUserName->text().isEmpty() || !txtPassword->text().isEmpty() );
206void QgsAuthSettingsWidget::updateSelectedTab()
208 if ( !mAuthConfigSelect->configId().isEmpty() )
210 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
212 else if ( !( txtUserName->text().isEmpty() && txtPassword->text().isEmpty() ) )
214 tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
void selectedConfigIdChanged(const QString &authcfg)
Emitted when authentication config is changed or missing.
Configuration storage class for authentication method configurations.
void setName(const QString &name)
Sets name of configuration.
const QString id() const
Gets 'authcfg' 7-character alphanumeric ID of the config.
void setConfig(const QString &key, const QString &value)
Set a single config value per key in the map.