diff options
author | Patrick Klein <42714034+libklein@users.noreply.github.com> | 2021-12-08 07:40:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 07:40:09 +0300 |
commit | a0a063b57f6f577bed505ccd652763eeadd1b876 (patch) | |
tree | 23adb424daf8e154d2a3c1943ea941780e971c6b /src/gui | |
parent | b3896f260048551d1d08245f85038182cb5e303b (diff) |
Add -i/--include option to "generate" CLI command. (#7112)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/PasswordGeneratorWidget.cpp | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp index faa6777af..32e559418 100644 --- a/src/gui/PasswordGeneratorWidget.cpp +++ b/src/gui/PasswordGeneratorWidget.cpp @@ -576,51 +576,15 @@ void PasswordGeneratorWidget::updateGenerator() auto classes = charClasses(); auto flags = generatorFlags(); - int length = 0; - if (flags.testFlag(PasswordGenerator::CharFromEveryGroup)) { - if (classes.testFlag(PasswordGenerator::LowerLetters)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::UpperLetters)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Numbers)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Braces)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Punctuation)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Quotes)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Dashes)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Math)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::Logograms)) { - ++length; - } - if (classes.testFlag(PasswordGenerator::EASCII)) { - ++length; - } - } - - length = qMax(length, m_ui->spinBoxLength->value()); - m_passwordGenerator->setLength(length); - m_passwordGenerator->setCharClasses(classes); - m_passwordGenerator->setFlags(flags); + m_passwordGenerator->setLength(m_ui->spinBoxLength->value()); if (m_ui->buttonAdvancedMode->isChecked()) { - m_passwordGenerator->setAdditionalChars(m_ui->editAdditionalChars->text()); - m_passwordGenerator->setExcludedChars(m_ui->editExcludedChars->text()); + m_passwordGenerator->setCharClasses(classes); + m_passwordGenerator->setCustomCharacterSet(m_ui->editAdditionalChars->text()); + m_passwordGenerator->setCustomCharacterSet(m_ui->editExcludedChars->text()); } else { - m_passwordGenerator->setAdditionalChars(""); - m_passwordGenerator->setExcludedChars(""); + m_passwordGenerator->setCharClasses(classes); } + m_passwordGenerator->setFlags(flags); if (m_passwordGenerator->isValid()) { m_ui->buttonGenerate->setEnabled(true); |