[users] Factor out show/hide of AD controls
While here, expand documentation a little.
This commit is contained in:
parent
f674214741
commit
0ef3842da6
@ -226,9 +226,9 @@ public:
|
||||
bool permitWeakPasswords() const { return m_permitWeakPasswords; }
|
||||
/// Current setting for "require strong password"?
|
||||
bool requireStrongPasswords() const { return m_requireStrongPasswords; }
|
||||
/// Is Active Directory enabled?
|
||||
/// Is Active Directory enabled in the config file?
|
||||
bool getActiveDirectoryEnabled() const;
|
||||
/// Is it both enabled and activated?
|
||||
/// Is it both enabled and activated by user choice (checkbox)?
|
||||
bool getActiveDirectoryUsed() const;
|
||||
|
||||
const QList< GroupDescription >& defaultGroups() const { return m_defaultGroups; }
|
||||
|
@ -164,34 +164,13 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
||||
|
||||
// Active Directory is not checked or enabled by default
|
||||
ui->useADCheckbox->setVisible( m_config->getActiveDirectoryEnabled() );
|
||||
ui->domainLabel->setVisible( false );
|
||||
ui->domainField->setVisible( false );
|
||||
ui->domainAdminLabel->setVisible( false );
|
||||
ui->domainAdminField->setVisible( false );
|
||||
ui->domainPasswordField->setVisible( false );
|
||||
ui->domainPasswordLabel->setVisible( false );
|
||||
ui->ipAddressField->setVisible( false );
|
||||
ui->ipAddressLabel->setVisible( false );
|
||||
|
||||
connect( ui->useADCheckbox,
|
||||
&QCheckBox::toggled,
|
||||
[ = ]( bool checked )
|
||||
{
|
||||
ui->domainLabel->setVisible( checked );
|
||||
ui->domainField->setVisible( checked );
|
||||
ui->domainAdminLabel->setVisible( checked );
|
||||
ui->domainAdminField->setVisible( checked );
|
||||
ui->domainPasswordField->setVisible( checked );
|
||||
ui->domainPasswordLabel->setVisible( checked );
|
||||
ui->ipAddressField->setVisible( checked );
|
||||
ui->ipAddressLabel->setVisible( checked );
|
||||
} );
|
||||
onActiveDirectoryToggled( false );
|
||||
|
||||
connect( ui->useADCheckbox, &QCheckBox::toggled, this, &UsersPage::onActiveDirectoryToggled );
|
||||
connect( ui->domainField, &QLineEdit::textChanged, config, &Config::setActiveDirectoryDomain );
|
||||
connect( ui->domainAdminField, &QLineEdit::textChanged, config, &Config::setActiveDirectoryAdminUsername );
|
||||
connect( ui->domainPasswordField, &QLineEdit::textChanged, config, &Config::setActiveDirectoryAdminPassword );
|
||||
connect( ui->ipAddressField, &QLineEdit::textChanged, config, &Config::setActiveDirectoryIP );
|
||||
connect( ui->useADCheckbox, &QCheckBox::toggled, config, &Config::setActiveDirectoryUsed );
|
||||
|
||||
CALAMARES_RETRANSLATE_SLOT( &UsersPage::retranslate );
|
||||
|
||||
@ -314,3 +293,18 @@ UsersPage::onReuseUserPasswordChanged( const int checked )
|
||||
ui->textBoxRootPassword->setVisible( visible );
|
||||
ui->textBoxVerifiedRootPassword->setVisible( visible );
|
||||
}
|
||||
|
||||
void
|
||||
UsersPage::onActiveDirectoryToggled( bool checked )
|
||||
{
|
||||
ui->domainLabel->setVisible( checked );
|
||||
ui->domainField->setVisible( checked );
|
||||
ui->domainAdminLabel->setVisible( checked );
|
||||
ui->domainAdminField->setVisible( checked );
|
||||
ui->domainPasswordField->setVisible( checked );
|
||||
ui->domainPasswordLabel->setVisible( checked );
|
||||
ui->ipAddressField->setVisible( checked );
|
||||
ui->ipAddressLabel->setVisible( checked );
|
||||
|
||||
m_config->setActiveDirectoryUsed( checked );
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ protected slots:
|
||||
void reportUserPasswordStatus( int, const QString& );
|
||||
void reportRootPasswordStatus( int, const QString& );
|
||||
|
||||
void onActiveDirectoryToggled( bool checked );
|
||||
|
||||
private:
|
||||
void retranslate();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user