PasswordDialog: UI improvements

This commit is contained in:
tobtoht 2022-05-27 11:49:32 +02:00
parent 6633353bf3
commit ef5f831013
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
4 changed files with 14 additions and 6 deletions

View file

@ -1627,15 +1627,15 @@ void MainWindow::updateRecentlyOpenedMenu() {
}
bool MainWindow::verifyPassword() {
bool ok;
bool incorrectPassword = false;
while (true) {
PasswordDialog passwordDialog{this->walletName(), false, this};
PasswordDialog passwordDialog{this->walletName(), incorrectPassword, true, this};
int ret = passwordDialog.exec();
if (ret == QDialog::Rejected) {
return false;
}
if (passwordDialog.password != m_ctx->wallet->getPassword()) {
QMessageBox::warning(this, "Error", "Incorrect password");
incorrectPassword = true;
continue;
}
break;

View file

@ -6,7 +6,7 @@
#include "utils/Icons.h"
PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword, QWidget *parent)
PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword, bool sensitive, QWidget *parent)
: WindowModalDialog(parent)
, ui(new Ui::PasswordDialog)
{
@ -15,6 +15,7 @@ PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword
this->setWindowIcon(icons()->icon("appicons/64x64.png"));
ui->label_wallet->setText(QString("Please enter password for wallet: %1").arg(walletName));
ui->label_incorrectPassword->setVisible(incorrectPassword);
ui->label_sensitive->setVisible(sensitive);
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this]{
password = ui->line_password->text();

View file

@ -17,7 +17,7 @@ class PasswordDialog : public WindowModalDialog
Q_OBJECT
public:
explicit PasswordDialog(const QString &walletName, bool incorrectPassword, QWidget *parent = nullptr);
explicit PasswordDialog(const QString &walletName, bool incorrectPassword, bool sensitive = false, QWidget *parent = nullptr);
~PasswordDialog() override;
QString password = "";

View file

@ -7,13 +7,20 @@
<x>0</x>
<y>0</y>
<width>832</width>
<height>158</height>
<height>168</height>
</rect>
</property>
<property name="windowTitle">
<string>Password required</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_sensitive">
<property name="text">
<string>This dialog contains sensitive information.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_wallet">
<property name="text">