mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-18 00:06:00 -04: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
|
:rtype: str
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
void setUsername( const QString &username );
|
||||||
|
%Docstring
|
||||||
|
setUsername set the username
|
||||||
|
\param username the user name
|
||||||
|
%End
|
||||||
|
|
||||||
const QString password( ) const;
|
const QString password( ) const;
|
||||||
%Docstring
|
%Docstring
|
||||||
password
|
password
|
||||||
@ -63,6 +69,18 @@ class QgsAuthSettingsWidget : QWidget
|
|||||||
:rtype: str
|
:rtype: str
|
||||||
%End
|
%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;
|
const QString configId( ) const;
|
||||||
%Docstring
|
%Docstring
|
||||||
configId
|
configId
|
||||||
|
@ -36,13 +36,11 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent,
|
|||||||
if ( ! configId.isEmpty( ) )
|
if ( ! configId.isEmpty( ) )
|
||||||
{
|
{
|
||||||
mAuthConfigSelect->setConfigId( configId );
|
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( btnConvertToEncrypted, &QPushButton::clicked, this, &QgsAuthSettingsWidget::convertToEncrypted );
|
||||||
|
connect( txtUserName, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::userNameTextChanged );
|
||||||
|
connect( txtPassword, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::passwordTextChanged );
|
||||||
|
updateSelectedTab();
|
||||||
updateConvertBtnState();
|
updateConvertBtnState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +59,29 @@ const QString QgsAuthSettingsWidget::username() const
|
|||||||
return txtUserName->text();
|
return txtUserName->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsAuthSettingsWidget::setUsername( const QString &username )
|
||||||
|
{
|
||||||
|
txtUserName->setText( username );
|
||||||
|
updateSelectedTab();
|
||||||
|
}
|
||||||
|
|
||||||
const QString QgsAuthSettingsWidget::password() const
|
const QString QgsAuthSettingsWidget::password() const
|
||||||
{
|
{
|
||||||
return txtPassword->text();
|
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
|
const QString QgsAuthSettingsWidget::configId() const
|
||||||
{
|
{
|
||||||
return mAuthConfigSelect->configId();
|
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 );
|
Q_UNUSED( text );
|
||||||
updateConvertBtnState();
|
updateConvertBtnState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsAuthSettingsWidget::on_txtPassword_textChanged( const QString &text )
|
void QgsAuthSettingsWidget::passwordTextChanged( const QString &text )
|
||||||
{
|
{
|
||||||
Q_UNUSED( text );
|
Q_UNUSED( text );
|
||||||
updateConvertBtnState();
|
updateConvertBtnState();
|
||||||
@ -118,3 +134,15 @@ void QgsAuthSettingsWidget::updateConvertBtnState()
|
|||||||
{
|
{
|
||||||
btnConvertToEncrypted->setEnabled( ! txtUserName->text().isEmpty() || ! txtPassword->text().isEmpty() );
|
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;
|
const QString username( ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief setUsername set the username
|
||||||
|
* \param username the user name
|
||||||
|
*/
|
||||||
|
void setUsername( const QString &username );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief password
|
* \brief password
|
||||||
* \return basic authentication password
|
* \return basic authentication password
|
||||||
*/
|
*/
|
||||||
const QString password( ) const;
|
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
|
* \brief configId
|
||||||
* \return authentication configuration id
|
* \return authentication configuration id
|
||||||
@ -107,20 +125,22 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
|||||||
* \param text the changet text
|
* \param text the changet text
|
||||||
* \note Not available in Python bindings
|
* \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
|
* \brief on_txtPassword_textChanged set convert button state
|
||||||
* \param text the changed text
|
* \param text the changed text
|
||||||
* \note Not available in Python bindings
|
* \note Not available in Python bindings
|
||||||
*/
|
*/
|
||||||
void on_txtPassword_textChanged( const QString &text ) SIP_SKIP;
|
void passwordTextChanged( const QString &text ) SIP_SKIP;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateConvertBtnState( );
|
void updateConvertBtnState( );
|
||||||
|
|
||||||
|
void updateSelectedTab( );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSAUTHSETTINGSWIDGET_H
|
#endif // QGSAUTHSETTINGSWIDGET_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user