diff options
author | Lukas Vogel <lukedirtwalker@gmail.com> | 2018-03-13 16:41:16 +0100 |
---|---|---|
committer | Lukas Vogel <lukedirtwalker@gmail.com> | 2018-03-13 16:41:16 +0100 |
commit | 1f7d97c818ce2c6fb924952d91acdfb5a0b42eda (patch) | |
tree | 69dad5fab3f9a6896beef3933fc09b2319ea88f8 /src/passworddialog.cpp | |
parent | 721d50430950b9d69039a5542fa35a42e658fff4 (diff) |
Respect use template setting in password dialog
When the template is not used the passdialog still showed the template
fields. With this commit the setting is properly respected.
Diffstat (limited to 'src/passworddialog.cpp')
-rw-r--r-- | src/passworddialog.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/passworddialog.cpp b/src/passworddialog.cpp index 7514b0e2..9bf5e027 100644 --- a/src/passworddialog.cpp +++ b/src/passworddialog.cpp @@ -127,17 +127,20 @@ QString PasswordDialog::getPassword() { * @brief PasswordDialog::setTemplate set the template and create the fields. * @param rawFields */ -void PasswordDialog::setTemplate(QString rawFields) { +void PasswordDialog::setTemplate(QString rawFields, bool useTemplate) { fields = rawFields.split('\n'); - QWidget *previous = ui->checkBoxShow; - foreach (QString field, fields) { - if (field.isEmpty()) - continue; - QLineEdit *line = new QLineEdit(); - line->setObjectName(field); - ui->formLayout->addRow(new QLabel(field), line); - setTabOrder(previous, line); - previous = line; + templating = useTemplate; + if (templating) { + QWidget *previous = ui->checkBoxShow; + foreach (QString field, fields) { + if (field.isEmpty()) + continue; + QLineEdit *line = new QLineEdit(); + line->setObjectName(field); + ui->formLayout->addRow(new QLabel(field), line); + setTabOrder(previous, line); + previous = line; + } } } @@ -157,13 +160,6 @@ void PasswordDialog::setFile(QString file) { void PasswordDialog::templateAll(bool templateAll) { allFields = templateAll; } /** - * @brief PasswordDialog::useTemplate basic setter for use in - * PasswordDialog::useTemplate templating. - * @param useTemplate - */ -void PasswordDialog::useTemplate(bool useTemplate) { templating = useTemplate; } - -/** * @brief PasswordDialog::setLength * PasswordDialog::setLength password length. * @param l |