QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
24 const QString &configId,
25 const QString &username,
26 const QString &password,
27 const QString &dataprovider )
29 , mDataprovider( dataprovider )
40 mAuthConfigSelect->setConfigId(
configId );
51 updateConvertBtnState();
56 lblWarning->setText( warningText );
61 lblBasic->setText( basicText );
63 lblBasic->setVisible( ! basicText.isEmpty() );
68 return txtUserName->text();
79 return txtPassword->text();
90 mAuthConfigSelect->setConfigId(
configId );
102 return mDataprovider;
107 QString out = tr(
"Warning: credentials stored as plain text in %1." );
111 return out.arg( tr(
"project file" ) );
113 return out.arg( tr(
"user settings" ) );
120 return mAuthConfigSelect->configId();
125 return btnConvertToEncrypted->isEnabled( );
132 cbStorePassword->show();
133 cbStoreUsername->show();
137 cbStorePassword->hide();
138 cbStoreUsername->hide();
144 cbStoreUsername->setChecked( checked );
149 cbStorePassword->setChecked( checked );
154 return cbStorePassword->isChecked( );
159 return cbStoreUsername->isChecked( );
164 return tabAuth->currentIndex( ) == tabAuth->indexOf( tabConfigurations );
169 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
171 config.
setName( tr(
"Converted config %1" ).arg( QDateTime::currentDateTime().toString( ) ) );
172 config.
setConfig( QStringLiteral(
"username" ), txtUserName->text() );
173 config.
setConfig( QStringLiteral(
"password" ), txtPassword->text() );
176 mAuthConfigSelect->showMessage( tr(
"Couldn't create a Basic authentication configuration!" ) );
181 txtUserName->setText( QString( ) );
182 txtPassword->setText( QString( ) );
183 mAuthConfigSelect->setConfigId( config.
id( ) );
191 updateConvertBtnState();
197 updateConvertBtnState();
200 void QgsAuthSettingsWidget::updateConvertBtnState()
202 btnConvertToEncrypted->setEnabled( ! txtUserName->text().isEmpty() || ! txtPassword->text().isEmpty() );
205 void QgsAuthSettingsWidget::updateSelectedTab()
207 if ( ! mAuthConfigSelect->configId().isEmpty( ) )
209 tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
211 else if ( !( txtUserName->text( ).isEmpty() && txtPassword->text( ).isEmpty( ) ) )
213 tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
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.
void setName(const QString &name)
Sets name of configuration.
Configuration storage class for authentication method configurations.