From c20ac0836eb11e76f63e994675df91b5d0103380 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 24 Feb 2020 16:11:14 +0100 Subject: [PATCH] [users] Take setRootPassword into account when hiding fields --- src/modules/users/UsersPage.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index 21f472a40..a18d3a82d 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -105,6 +105,16 @@ UsersPage::UsersPage( QWidget* parent ) checkReady( isReady() ); } ); connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged, this, [this]( int checked ) { + /* When "reuse" is checked, hide the fields for explicitly + * entering the root password. However, if we're going to + * disable the root password anyway, hide them all regardless of + * the checkbox -- so when writeRoot is false, checked needs + * to be true, to hide them all. + */ + if ( !m_writeRootPassword ) + { + checked = true; + } ui->labelChooseRootPassword->setVisible( !checked ); ui->labelRootPassword->setVisible( !checked ); ui->labelRootPasswordError->setVisible( !checked ); @@ -246,8 +256,8 @@ UsersPage::onActivate() void UsersPage::setWriteRootPassword( bool write ) { - ui->checkBoxReusePassword->setVisible( write ); m_writeRootPassword = write; + ui->checkBoxReusePassword->setVisible( write ); }