Skip to content

Commit

Permalink
Fix password generator properties initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ba32107 authored and droidmonkey committed Jun 29, 2019
1 parent 12cefdb commit 11dabfa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Move notes to General tab on Group Preview Panel [#3336]
- Add 'Monospaced font' option to the Notes field [#3321]
- Drop to background when copy feature [#3253]
- Fix password generator issues with special characters [#3303]

2.4.3 (2019-06-12)
=========================
Expand Down
14 changes: 10 additions & 4 deletions src/gui/PasswordGeneratorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,18 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
}

loadSettings();
reset();
}

PasswordGeneratorWidget::~PasswordGeneratorWidget()
{
}

void PasswordGeneratorWidget::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
reset();
}

void PasswordGeneratorWidget::loadSettings()
{
// Password config
Expand All @@ -107,6 +112,8 @@ void PasswordGeneratorWidget::loadSettings()
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", PasswordGenerator::DefaultUpper).toBool());
m_ui->checkBoxUpperAdv->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->checkBoxNumbersAdv->setChecked(
config()->get("generator/Numbers", PasswordGenerator::DefaultNumbers).toBool());
m_ui->advancedBar->setVisible(
Expand All @@ -119,6 +126,7 @@ void PasswordGeneratorWidget::loadSettings()
config()->get("generator/AdvancedMode", PasswordGenerator::DefaultAdvancedMode).toBool());
m_ui->editExcludedChars->setText(
config()->get("generator/ExcludedChars", PasswordGenerator::DefaultExcludedChars).toString());

m_ui->simpleBar->setVisible(
!(config()->get("generator/AdvancedMode", PasswordGenerator::DefaultAdvancedMode).toBool()));
m_ui->checkBoxBraces->setChecked(config()->get("generator/Braces", PasswordGenerator::DefaultBraces).toBool());
Expand Down Expand Up @@ -164,6 +172,7 @@ void PasswordGeneratorWidget::saveSettings()
config()->set("generator/Numbers", m_ui->checkBoxNumbersAdv->isChecked());
config()->set("generator/EASCII", m_ui->checkBoxExtASCIIAdv->isChecked());
}
config()->set("generator/AdvancedMode", m_ui->advancedBar->isVisible());
config()->set("generator/SpecialChars", m_ui->checkBoxSpecialChars->isChecked());
config()->set("generator/Braces", m_ui->checkBoxBraces->isChecked());
config()->set("generator/Punctuation", m_ui->checkBoxPunctuation->isChecked());
Expand Down Expand Up @@ -406,7 +415,6 @@ PasswordGenerator::CharClasses PasswordGeneratorWidget::charClasses()
PasswordGenerator::CharClasses classes;

if (m_ui->simpleBar->isVisible()) {

if (m_ui->checkBoxLower->isChecked()) {
classes |= PasswordGenerator::LowerLetters;
}
Expand All @@ -426,9 +434,7 @@ PasswordGenerator::CharClasses PasswordGeneratorWidget::charClasses()
if (m_ui->checkBoxExtASCII->isChecked()) {
classes |= PasswordGenerator::EASCII;
}

} else {

if (m_ui->checkBoxLowerAdv->isChecked()) {
classes |= PasswordGenerator::LowerLetters;
}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/PasswordGeneratorWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class PasswordGeneratorWidget : public QWidget
QString getGeneratedPassword();
bool isPasswordVisible() const;

protected:
void showEvent(QShowEvent* event) override;

public slots:
void regeneratePassword();
void applyPassword();
Expand Down

0 comments on commit 11dabfa

Please sign in to comment.