Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251if (fCapsLock) {252ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));253} else {254ui->capsLabel->clear();255}256}257return QWidget::event(event);258}260void AskPassphraseDialog::toggleShowPassword(bool show)261{262ui->toggleShowPasswordButton->setDown(show);263const auto mode = show ? QLineEdit::Normal : QLineEdit::Password;264ui->passEdit1->setEchoMode(mode);265ui->passEdit2->setEchoMode(mode);266ui->passEdit3->setEchoMode(mode);267}269bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)270{271/* Detect Caps Lock.272* There is no good OS-independent way to check a key state in Qt, but we273* can detect Caps Lock by checking for the following condition:274* Shift key is down and the result is a lower case character, or275* Shift key is not down and the result is an upper case character.276*/277if (event->type() == QEvent::KeyPress) {278QKeyEvent *ke = static_cast<QKeyEvent *>(event);279QString str = ke->text();280if (str.length() != 0) {281const QChar *psz = str.unicode();282bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0;283if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) {284fCapsLock = true;285ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));286} else if (psz->isLetter()) {287fCapsLock = false;288ui->capsLabel->clear();289}290}291}292return QDialog::eventFilter(object, event);293}295static void SecureClearQLineEdit(QLineEdit* edit)296{297// Attempt to overwrite text so that they do not linger around in memory298edit->setText(QString(" ").repeated(edit->text().size()));299edit->clear();300}302void AskPassphraseDialog::secureClearPassFields()303{304SecureClearQLineEdit(ui->passEdit1);305SecureClearQLineEdit(ui->passEdit2);306SecureClearQLineEdit(ui->passEdit3);307}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.