centralize every password generator default option. add extended ASCII to XC_HTTP generator

This commit is contained in:
thez3ro 2018-02-05 12:31:13 +01:00
parent 33b95836b9
commit 6723f4215a
No known key found for this signature in database
GPG key ID: F628F9E41DD7C073
11 changed files with 103 additions and 43 deletions

View file

@ -68,9 +68,9 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
}
// set default separator to Space
m_ui->editWordSeparator->setText(" ");
m_ui->editWordSeparator->setText(PassphraseGenerator::DefaultSeparator);
QDir path(filePath()->dataPath("wordlists/"));
QDir path(filePath()->wordlistPath(""));
QStringList files = path.entryList(QDir::Files);
m_ui->comboBoxWordList->addItems(files);
if (files.size() > 1) {
@ -93,19 +93,19 @@ PasswordGeneratorWidget::~PasswordGeneratorWidget()
void PasswordGeneratorWidget::loadSettings()
{
// Password config
m_ui->checkBoxLower->setChecked(config()->get("generator/LowerCase", true).toBool());
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", true).toBool());
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", true).toBool());
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", false).toBool());
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", false).toBool());
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", true).toBool());
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", true).toBool());
m_ui->checkBoxLower->setChecked(config()->get("generator/LowerCase", PasswordGenerator::DefaultLower).toBool());
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", PasswordGenerator::DefaultUpper).toBool());
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", PasswordGenerator::DefaultNumbers).toBool());
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", PasswordGenerator::DefaultSpecial).toBool());
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", PasswordGenerator::DefaultEASCII).toBool());
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", PasswordGenerator::DefaultLookAlike).toBool());
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", PasswordGenerator::DefaultFromEveryGroup).toBool());
m_ui->spinBoxLength->setValue(config()->get("generator/Length", PasswordGenerator::DefaultLength).toInt());
// Diceware config
m_ui->spinBoxWordCount->setValue(config()->get("generator/WordCount", 6).toInt());
m_ui->editWordSeparator->setText(config()->get("generator/WordSeparator", " ").toString());
m_ui->comboBoxWordList->setCurrentText(config()->get("generator/WordList", "eff_large.wordlist").toString());
m_ui->spinBoxWordCount->setValue(config()->get("generator/WordCount", PassphraseGenerator::DefaultWordCount).toInt());
m_ui->editWordSeparator->setText(config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString());
m_ui->comboBoxWordList->setCurrentText(config()->get("generator/WordList", PassphraseGenerator::DefaultWordList).toString());
// Password or diceware?
m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 0).toInt());
@ -394,7 +394,7 @@ void PasswordGeneratorWidget::updateGenerator()
m_dicewareGenerator->setWordCount(m_ui->spinBoxWordCount->value());
if (!m_ui->comboBoxWordList->currentText().isEmpty()) {
QString path = filePath()->dataPath("wordlists/" + m_ui->comboBoxWordList->currentText());
QString path = filePath()->wordlistPath(m_ui->comboBoxWordList->currentText());
m_dicewareGenerator->setWordList(path);
}
m_dicewareGenerator->setWordSeparator(m_ui->editWordSeparator->text());