[users] Don't mess up cursor position when typing hostname
If the hostname changes while the field has focus, that means that the user is typing in the field, and we shouldn't mess with the cursor position. FIXES #1884
This commit is contained in:
parent
3ea25a901e
commit
fa7394723c
@ -107,7 +107,15 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
|||||||
|
|
||||||
ui->textBoxHostName->setText( config->hostName() );
|
ui->textBoxHostName->setText( config->hostName() );
|
||||||
connect( ui->textBoxHostName, &QLineEdit::textEdited, config, &Config::setHostName );
|
connect( ui->textBoxHostName, &QLineEdit::textEdited, config, &Config::setHostName );
|
||||||
connect( config, &Config::hostNameChanged, ui->textBoxHostName, &QLineEdit::setText );
|
connect( config,
|
||||||
|
&Config::hostNameChanged,
|
||||||
|
[ this ]( const QString& name )
|
||||||
|
{
|
||||||
|
if ( !ui->textBoxHostName->hasFocus() )
|
||||||
|
{
|
||||||
|
ui->textBoxHostName->setText( name );
|
||||||
|
}
|
||||||
|
} );
|
||||||
connect( config, &Config::hostNameStatusChanged, this, &UsersPage::reportHostNameStatus );
|
connect( config, &Config::hostNameStatusChanged, this, &UsersPage::reportHostNameStatus );
|
||||||
|
|
||||||
ui->textBoxLoginName->setText( config->loginName() );
|
ui->textBoxLoginName->setText( config->loginName() );
|
||||||
@ -116,9 +124,10 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
|||||||
connect( config, &Config::loginNameStatusChanged, this, &UsersPage::reportLoginNameStatus );
|
connect( config, &Config::loginNameStatusChanged, this, &UsersPage::reportLoginNameStatus );
|
||||||
|
|
||||||
ui->checkBoxDoAutoLogin->setChecked( m_config->doAutoLogin() );
|
ui->checkBoxDoAutoLogin->setChecked( m_config->doAutoLogin() );
|
||||||
connect( ui->checkBoxDoAutoLogin, &QCheckBox::stateChanged, this, [this]( int checked ) {
|
connect( ui->checkBoxDoAutoLogin,
|
||||||
m_config->setAutoLogin( checked != Qt::Unchecked );
|
&QCheckBox::stateChanged,
|
||||||
} );
|
this,
|
||||||
|
[ this ]( int checked ) { m_config->setAutoLogin( checked != Qt::Unchecked ); } );
|
||||||
connect( config, &Config::autoLoginChanged, ui->checkBoxDoAutoLogin, &QCheckBox::setChecked );
|
connect( config, &Config::autoLoginChanged, ui->checkBoxDoAutoLogin, &QCheckBox::setChecked );
|
||||||
|
|
||||||
ui->checkBoxReusePassword->setVisible( m_config->writeRootPassword() );
|
ui->checkBoxReusePassword->setVisible( m_config->writeRootPassword() );
|
||||||
@ -133,9 +142,10 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
|||||||
ui->checkBoxRequireStrongPassword->setChecked( m_config->requireStrongPasswords() );
|
ui->checkBoxRequireStrongPassword->setChecked( m_config->requireStrongPasswords() );
|
||||||
if ( m_config->permitWeakPasswords() )
|
if ( m_config->permitWeakPasswords() )
|
||||||
{
|
{
|
||||||
connect( ui->checkBoxRequireStrongPassword, &QCheckBox::stateChanged, this, [this]( int checked ) {
|
connect( ui->checkBoxRequireStrongPassword,
|
||||||
m_config->setRequireStrongPasswords( checked != Qt::Unchecked );
|
&QCheckBox::stateChanged,
|
||||||
} );
|
this,
|
||||||
|
[ this ]( int checked ) { m_config->setRequireStrongPasswords( checked != Qt::Unchecked ); } );
|
||||||
connect(
|
connect(
|
||||||
config, &Config::requireStrongPasswordsChanged, ui->checkBoxRequireStrongPassword, &QCheckBox::setChecked );
|
config, &Config::requireStrongPasswordsChanged, ui->checkBoxRequireStrongPassword, &QCheckBox::setChecked );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user