mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 05:57:37 +03:00
Add word case option to passphrase generator (#3172)
* Closes #1933 * Adds word case options for lower, UPPER, and Title Case to passphrase generation
This commit is contained in:
parent
2ee97ed191
commit
7ead8e7290
9 changed files with 192 additions and 42 deletions
|
@ -60,6 +60,7 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||
connect(m_ui->comboBoxWordList, SIGNAL(currentIndexChanged(int)), SLOT(updateGenerator()));
|
||||
connect(m_ui->optionButtons, SIGNAL(buttonClicked(int)), SLOT(updateGenerator()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(updateGenerator()));
|
||||
connect(m_ui->wordCaseComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateGenerator()));
|
||||
|
||||
// set font size of password quality and entropy labels dynamically to 80% of
|
||||
// the default font size, but make it no smaller than 8pt
|
||||
|
@ -74,6 +75,11 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||
// set default separator to Space
|
||||
m_ui->editWordSeparator->setText(PassphraseGenerator::DefaultSeparator);
|
||||
|
||||
// add passphrase generator case options
|
||||
m_ui->wordCaseComboBox->addItem(tr("lower case"), PassphraseGenerator::LOWERCASE);
|
||||
m_ui->wordCaseComboBox->addItem(tr("UPPER CASE"), PassphraseGenerator::UPPERCASE);
|
||||
m_ui->wordCaseComboBox->addItem(tr("Title Case"), PassphraseGenerator::TITLECASE);
|
||||
|
||||
QDir path(filePath()->wordlistPath(""));
|
||||
QStringList files = path.entryList(QDir::Files);
|
||||
m_ui->comboBoxWordList->addItems(files);
|
||||
|
@ -85,7 +91,6 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||
m_ui->labelWordList->setVisible(false);
|
||||
}
|
||||
|
||||
m_dicewareGenerator->setDefaultWordList();
|
||||
loadSettings();
|
||||
reset();
|
||||
}
|
||||
|
@ -139,6 +144,7 @@ void PasswordGeneratorWidget::loadSettings()
|
|||
config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString());
|
||||
m_ui->comboBoxWordList->setCurrentText(
|
||||
config()->get("generator/WordList", PassphraseGenerator::DefaultWordList).toString());
|
||||
m_ui->wordCaseComboBox->setCurrentIndex(config()->get("generator/WordCase", 0).toInt());
|
||||
|
||||
// Password or diceware?
|
||||
m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 0).toInt());
|
||||
|
@ -174,6 +180,7 @@ void PasswordGeneratorWidget::saveSettings()
|
|||
config()->set("generator/WordCount", m_ui->spinBoxWordCount->value());
|
||||
config()->set("generator/WordSeparator", m_ui->editWordSeparator->text());
|
||||
config()->set("generator/WordList", m_ui->comboBoxWordList->currentText());
|
||||
config()->set("generator/WordCase", m_ui->wordCaseComboBox->currentIndex());
|
||||
|
||||
// Password or diceware?
|
||||
config()->set("generator/Type", m_ui->tabWidget->currentIndex());
|
||||
|
@ -556,6 +563,9 @@ void PasswordGeneratorWidget::updateGenerator()
|
|||
m_updatingSpinBox = false;
|
||||
}
|
||||
|
||||
m_dicewareGenerator->setWordCase(
|
||||
static_cast<PassphraseGenerator::PassphraseWordCase>(m_ui->wordCaseComboBox->currentData().toInt()));
|
||||
|
||||
m_ui->spinBoxWordCount->setMinimum(minWordCount);
|
||||
m_ui->sliderWordCount->setMinimum(minWordCount);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue