Generate new password whenever the generator widget is opened.

Closes #414
This commit is contained in:
Felix Geyer 2016-08-06 11:29:47 +02:00
parent 8d16522d39
commit 7d4ef0b8d0
3 changed files with 11 additions and 4 deletions

View File

@ -88,6 +88,14 @@ void PasswordGeneratorWidget::reset()
updateGenerator();
}
void PasswordGeneratorWidget::regeneratePassword()
{
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setEditText(password);
}
}
void PasswordGeneratorWidget::updateApplyEnabled(const QString& password)
{
m_ui->buttonApply->setEnabled(!password.isEmpty());
@ -199,8 +207,5 @@ void PasswordGeneratorWidget::updateGenerator()
m_generator->setCharClasses(classes);
m_generator->setFlags(flags);
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setEditText(password);
}
regeneratePassword();
}

View File

@ -39,6 +39,7 @@ public:
~PasswordGeneratorWidget();
void loadSettings();
void reset();
void regeneratePassword();
Q_SIGNALS:
void newPassword(const QString& password);

View File

@ -487,6 +487,7 @@ void EditEntryWidget::clear()
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)
{
m_mainUi->passwordGenerator->regeneratePassword();
m_mainUi->passwordGenerator->setVisible(checked);
}