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 tabAuth->removeTab( tabAuth->indexOf( tabBasic ) );
56 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
61 lblWarning->setText( warningText );
66 lblBasic->setText( basicText );
68 lblBasic->setVisible( !basicText.isEmpty() );
73 return txtUserName->text();
84 return txtPassword->text();
95 mAuthConfigSelect->setConfigId(
configId );
107 return mDataprovider;
112 const QString out = tr(
"Warning: credentials stored as plain text in %1." );
116 return out.arg( tr(
"project file" ) );
118 return out.arg( tr(
"user settings" ) );
125 return mAuthConfigSelect->configId();
130 return btnConvertToEncrypted->isEnabled();
137 cbStorePassword->show();
138 cbStoreUsername->show();
142 cbStorePassword->hide();
143 cbStoreUsername->hide();
149 cbStoreUsername->setChecked( checked );
154 cbStorePassword->setChecked( checked );
159 return cbStorePassword->isChecked();
164 return cbStoreUsername->isChecked();
169 return tabAuth->currentIndex() == tabAuth->indexOf( tabConfigurations );
174 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
176 config.
setName( tr(
"Converted config %1" ).arg( QDateTime::currentDateTime().toString() ) );
177 config.
setConfig( QStringLiteral(
"username" ), txtUserName->text() );
178 config.
setConfig( QStringLiteral(
"password" ), txtPassword->text() );
181 mAuthConfigSelect->showMessage( tr(
"Couldn't create a Basic authentication configuration!" ) );
186 txtUserName->setText( QString() );
187 txtPassword->setText( QString() );
188 mAuthConfigSelect->setConfigId( config.
id() );
193void QgsAuthSettingsWidget::userNameTextChanged(
const QString &text )
196 updateConvertBtnState();
200void QgsAuthSettingsWidget::passwordTextChanged(
const QString &text )
203 updateConvertBtnState();
207void QgsAuthSettingsWidget::updateConvertBtnState()
209 btnConvertToEncrypted->setEnabled( !txtUserName->text().isEmpty() || !txtPassword->text().isEmpty() );
212void QgsAuthSettingsWidget::updateSelectedTab()
214 if ( !mAuthConfigSelect->configId().isEmpty() )
216 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
218 else if ( !( txtUserName->text().isEmpty() && txtPassword->text().isEmpty() ) )
220 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.