Improved PasswordPromptDialog

- can now also set caption
- can set initial state of save option
- improved size and spacing
This commit is contained in:
eelke 2018-11-11 12:30:53 +01:00
parent 634345b38f
commit 24751f81dd
3 changed files with 59 additions and 19 deletions

View file

@ -138,6 +138,7 @@ bool MasterController::retrieveConnectionPassword(ConnectionConfig &cc)
// ook aan de gebruiker vragen zoals hier gebeurd.
QString str = ConnectionListModel::makeLongDescription(cc);
auto dlg = std::make_unique<PasswordPromptDialog>(PasswordPromptDialog::SaveOption, nullptr);
dlg->setCaption(tr("Connection password prompt"));
dlg->setDescription(QString(tr("Please provide password for connection %1")).arg(str));
int exec_result = dlg->exec();
@ -181,7 +182,8 @@ bool MasterController::UnlockPasswordManagerIfNeeded()
while (true) {
// ask user for passphrase
auto dlg = std::make_unique<PasswordPromptDialog>(nullptr, nullptr);
dlg->setDescription(tr("Enter passphrase for password manager"));
dlg->setCaption(tr("Unlock password manager"));
dlg->setDescription(tr("Enter password for password manager"));
int exec_result = dlg->exec();
bool ok = (exec_result == QDialog::Accepted);
@ -200,7 +202,10 @@ bool MasterController::UnlockPasswordManagerIfNeeded()
// Ask user for passphrase + confirmation, clearly instruct this is first setup
// create
auto dlg = std::make_unique<PasswordPromptDialog>(PasswordPromptDialog::ConfirmPassword, nullptr);
dlg->setDescription(tr("Enter passphrase for password manager initialization"));
dlg->setCaption(tr("Password manager setup"));
dlg->setDescription(tr("Enter a strong password for password manager initialization. A strong key will be "
"derived from your password and it will be impossible to recover anything from the "
"password manager without the password you enter here."));
int exec_result = dlg->exec();
if (exec_result == QDialog::Accepted) {
QString passphrase = dlg->password();