24#include "moc_qgsauthsettingswidget.cpp"
39 mAuthConfigSelect->setConfigId(
configId );
45 connect( txtUserName, &QLineEdit::textChanged,
this, &QgsAuthSettingsWidget::userNameTextChanged );
46 connect( txtPassword, &QLineEdit::textChanged,
this, &QgsAuthSettingsWidget::passwordTextChanged );
52 updateConvertBtnState();
57 tabAuth->removeTab( tabAuth->indexOf( tabBasic ) );
58 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
63 lblWarning->setText( warningText );
68 lblBasic->setText( basicText );
70 lblBasic->setVisible( !basicText.isEmpty() );
75 return txtUserName->text();
86 return txtPassword->text();
97 mAuthConfigSelect->setConfigId(
configId );
109 return mDataprovider;
114 const QString out = tr(
"Warning: credentials stored as plain text in %1." );
118 return out.arg( tr(
"project file" ) );
120 return out.arg( tr(
"user settings" ) );
127 return mAuthConfigSelect->configId();
132 return btnConvertToEncrypted->isEnabled();
139 cbStorePassword->show();
140 cbStoreUsername->show();
144 cbStorePassword->hide();
145 cbStoreUsername->hide();
151 cbStoreUsername->setChecked( checked );
156 cbStorePassword->setChecked( checked );
161 return cbStorePassword->isChecked();
166 return cbStoreUsername->isChecked();
171 return tabAuth->currentIndex() == tabAuth->indexOf( tabConfigurations );
176 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
178 config.
setName( tr(
"Converted config %1" ).arg( QDateTime::currentDateTime().toString() ) );
179 config.
setConfig( QStringLiteral(
"username" ), txtUserName->text() );
180 config.
setConfig( QStringLiteral(
"password" ), txtPassword->text() );
183 mAuthConfigSelect->showMessage( tr(
"Couldn't create a Basic authentication configuration!" ) );
188 txtUserName->setText( QString() );
189 txtPassword->setText( QString() );
190 mAuthConfigSelect->setConfigId( config.
id() );
195void QgsAuthSettingsWidget::userNameTextChanged(
const QString &text )
198 updateConvertBtnState();
202void QgsAuthSettingsWidget::passwordTextChanged(
const QString &text )
205 updateConvertBtnState();
209void QgsAuthSettingsWidget::updateConvertBtnState()
211 btnConvertToEncrypted->setEnabled( !txtUserName->text().isEmpty() || !txtPassword->text().isEmpty() );
214void QgsAuthSettingsWidget::updateSelectedTab()
216 if ( !mAuthConfigSelect->configId().isEmpty() )
218 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
220 else if ( !( txtUserName->text().isEmpty() && txtPassword->text().isEmpty() ) )
222 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.