Disable buttonGenerate when no classes.

This commit is contained in:
Louis-Bertrand Varin 2017-01-26 18:38:50 -05:00 committed by Louis-Bertrand Varin
parent 3f1a75f40a
commit a80c415fc0

View File

@ -132,8 +132,10 @@ void PasswordGeneratorWidget::updatePasswordStrength(const QString& password)
void PasswordGeneratorWidget::generatePassword()
{
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setText(password);
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setText(password);
}
}
void PasswordGeneratorWidget::applyPassword()
@ -279,5 +281,12 @@ void PasswordGeneratorWidget::updateGenerator()
m_generator->setCharClasses(classes);
m_generator->setFlags(flags);
if (m_generator->isValid()) {
m_ui->buttonGenerate->setEnabled(true);
}
else {
m_ui->buttonGenerate->setEnabled(false);
}
regeneratePassword();
}