mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[auth] Added setters to the auth settings widget
Also: - removed wrapper goupBox for added flexibility - explicit connections
This commit is contained in:
parent
2fa68110e3
commit
bdddc3ba66
@ -56,6 +56,12 @@ class QgsAuthSettingsWidget : QWidget
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
void setUsername( const QString &username );
|
||||
%Docstring
|
||||
setUsername set the username
|
||||
\param username the user name
|
||||
%End
|
||||
|
||||
const QString password( ) const;
|
||||
%Docstring
|
||||
password
|
||||
@ -63,6 +69,18 @@ class QgsAuthSettingsWidget : QWidget
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
void setPassword( const QString &password );
|
||||
%Docstring
|
||||
setPassword set the password
|
||||
\param password the password
|
||||
%End
|
||||
|
||||
void setConfigId( const QString &configId );
|
||||
%Docstring
|
||||
setConfigId set the authentication configuration id
|
||||
param configId the authentication configuration id
|
||||
%End
|
||||
|
||||
const QString configId( ) const;
|
||||
%Docstring
|
||||
configId
|
||||
|
@ -36,13 +36,11 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent,
|
||||
if ( ! configId.isEmpty( ) )
|
||||
{
|
||||
mAuthConfigSelect->setConfigId( configId );
|
||||
tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
|
||||
}
|
||||
else if ( !( username.isEmpty() && password.isEmpty( ) ) )
|
||||
{
|
||||
tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
|
||||
}
|
||||
connect( btnConvertToEncrypted, &QPushButton::clicked, this, &QgsAuthSettingsWidget::convertToEncrypted );
|
||||
connect( txtUserName, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::userNameTextChanged );
|
||||
connect( txtPassword, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::passwordTextChanged );
|
||||
updateSelectedTab();
|
||||
updateConvertBtnState();
|
||||
}
|
||||
|
||||
@ -61,11 +59,29 @@ const QString QgsAuthSettingsWidget::username() const
|
||||
return txtUserName->text();
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::setUsername( const QString &username )
|
||||
{
|
||||
txtUserName->setText( username );
|
||||
updateSelectedTab();
|
||||
}
|
||||
|
||||
const QString QgsAuthSettingsWidget::password() const
|
||||
{
|
||||
return txtPassword->text();
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::setPassword( const QString &password )
|
||||
{
|
||||
txtPassword->setText( password );
|
||||
updateSelectedTab();
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::setConfigId( const QString &configId )
|
||||
{
|
||||
mAuthConfigSelect->setConfigId( configId );
|
||||
updateSelectedTab();
|
||||
}
|
||||
|
||||
const QString QgsAuthSettingsWidget::configId() const
|
||||
{
|
||||
return mAuthConfigSelect->configId();
|
||||
@ -102,13 +118,13 @@ bool QgsAuthSettingsWidget::convertToEncrypted( )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::on_txtUserName_textChanged( const QString &text )
|
||||
void QgsAuthSettingsWidget::userNameTextChanged( const QString &text )
|
||||
{
|
||||
Q_UNUSED( text );
|
||||
updateConvertBtnState();
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::on_txtPassword_textChanged( const QString &text )
|
||||
void QgsAuthSettingsWidget::passwordTextChanged( const QString &text )
|
||||
{
|
||||
Q_UNUSED( text );
|
||||
updateConvertBtnState();
|
||||
@ -118,3 +134,15 @@ void QgsAuthSettingsWidget::updateConvertBtnState()
|
||||
{
|
||||
btnConvertToEncrypted->setEnabled( ! txtUserName->text().isEmpty() || ! txtPassword->text().isEmpty() );
|
||||
}
|
||||
|
||||
void QgsAuthSettingsWidget::updateSelectedTab()
|
||||
{
|
||||
if ( ! mAuthConfigSelect->configId().isEmpty( ) )
|
||||
{
|
||||
tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
|
||||
}
|
||||
else if ( !( txtUserName->text( ).isEmpty() && txtPassword->text( ).isEmpty( ) ) )
|
||||
{
|
||||
tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
|
||||
}
|
||||
}
|
||||
|
@ -68,12 +68,30 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
*/
|
||||
const QString username( ) const;
|
||||
|
||||
/**
|
||||
* \brief setUsername set the username
|
||||
* \param username the user name
|
||||
*/
|
||||
void setUsername( const QString &username );
|
||||
|
||||
/**
|
||||
* \brief password
|
||||
* \return basic authentication password
|
||||
*/
|
||||
const QString password( ) const;
|
||||
|
||||
/**
|
||||
* \brief setPassword set the password
|
||||
* \param password the password
|
||||
*/
|
||||
void setPassword( const QString &password );
|
||||
|
||||
/**
|
||||
* \brief setConfigId set the authentication configuration id
|
||||
* param configId the authentication configuration id
|
||||
*/
|
||||
void setConfigId( const QString &configId );
|
||||
|
||||
/**
|
||||
* \brief configId
|
||||
* \return authentication configuration id
|
||||
@ -107,20 +125,22 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
* \param text the changet text
|
||||
* \note Not available in Python bindings
|
||||
*/
|
||||
void on_txtUserName_textChanged( const QString &text ) SIP_SKIP;
|
||||
void userNameTextChanged( const QString &text ) SIP_SKIP;
|
||||
|
||||
/**
|
||||
* \brief on_txtPassword_textChanged set convert button state
|
||||
* \param text the changed text
|
||||
* \note Not available in Python bindings
|
||||
*/
|
||||
void on_txtPassword_textChanged( const QString &text ) SIP_SKIP;
|
||||
void passwordTextChanged( const QString &text ) SIP_SKIP;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void updateConvertBtnState( );
|
||||
|
||||
void updateSelectedTab( );
|
||||
|
||||
};
|
||||
|
||||
#endif // QGSAUTHSETTINGSWIDGET_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user