Changeset View
Changeset View
Standalone View
Standalone View
src/qt/askpassphrasedialog.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | switch (mode) { | ||||
break; | break; | ||||
case ChangePass: // Ask old passphrase + new passphrase x2 | case ChangePass: // Ask old passphrase + new passphrase x2 | ||||
setWindowTitle(tr("Change passphrase")); | setWindowTitle(tr("Change passphrase")); | ||||
ui->warningLabel->setText(tr( | ui->warningLabel->setText(tr( | ||||
"Enter the old passphrase and new passphrase to the wallet.")); | "Enter the old passphrase and new passphrase to the wallet.")); | ||||
break; | break; | ||||
} | } | ||||
textChanged(); | textChanged(); | ||||
connect(ui->toggleShowPasswordButton, SIGNAL(toggled(bool)), this, | |||||
SLOT(toggleShowPassword(bool))); | |||||
connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, | connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, | ||||
SLOT(textChanged())); | SLOT(textChanged())); | ||||
connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, | connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, | ||||
SLOT(textChanged())); | SLOT(textChanged())); | ||||
connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, | connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, | ||||
SLOT(textChanged())); | SLOT(textChanged())); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if (event->type() == QEvent::KeyPress) { | ||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!")); | ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!")); | ||||
} else { | } else { | ||||
ui->capsLabel->clear(); | ui->capsLabel->clear(); | ||||
} | } | ||||
} | } | ||||
return QWidget::event(event); | return QWidget::event(event); | ||||
} | } | ||||
void AskPassphraseDialog::toggleShowPassword(bool show) { | |||||
ui->toggleShowPasswordButton->setDown(show); | |||||
const auto mode = show ? QLineEdit::Normal : QLineEdit::Password; | |||||
ui->passEdit1->setEchoMode(mode); | |||||
ui->passEdit2->setEchoMode(mode); | |||||
ui->passEdit3->setEchoMode(mode); | |||||
} | |||||
bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event) { | bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event) { | ||||
/* Detect Caps Lock. | /* Detect Caps Lock. | ||||
* There is no good OS-independent way to check a key state in Qt, but we | * There is no good OS-independent way to check a key state in Qt, but we | ||||
* can detect Caps Lock by checking for the following condition: | * can detect Caps Lock by checking for the following condition: | ||||
* Shift key is down and the result is a lower case character, or | * Shift key is down and the result is a lower case character, or | ||||
* Shift key is not down and the result is an upper case character. | * Shift key is not down and the result is an upper case character. | ||||
*/ | */ | ||||
if (event->type() == QEvent::KeyPress) { | if (event->type() == QEvent::KeyPress) { | ||||
Show All 29 Lines |