Home GnuPG

qt: Support passphrase formatting

Description

qt: Support passphrase formatting

* qt/main.cpp (qt_cmd_handler): Pass formatted passphrase options to
the dialog.
* qt/pinentrydialog.cpp, qt/pinentrydialog.h
(PinEntryDialog::setFormattedPassphrase,
PinEntryDialog::toggleFormattedPassphrase): New.
* qt/pinentrydialog.cpp (PinEntryDialog::PinEntryDialog): Initialize
new field. Construct widgets in the order they appear on the screen.
Add widget for enabling passphrase formatting.
(PinEntryDialog::setPin, PinEntryDialog::generatePin): Use
PinLineEdit::setPin() instead of setText().
(PinEntryDialog::pin, PinEntryDialog::textChanged,
PinEntryDialog::repeatedPin): Use PinLineEdit::pin() instead of text().
(PinEntryDialog::toggleVisibility): Call toggleFormattedPassphrase().
* qt/pinentrydialog.h (enum PinEntryDialog::FormattedPassphraseMode,
struct PinEntryDialog::FormattedPassphraseOptions): New.
* qt/pinentrydialog.h (PinEntryDialog): Change type of field mRepeat.
Add field mFormattedPassphraseCB.
* qt/pinlineedit.cpp, qt/pinlineedit.h (PinLineEdit::~PinLineEdit,
PinLineEdit::setPin, PinLineEdit::pin,
PinLineEdit::setFormattedPassphrase, PinLineEdit::textEdited,
class PinLineEdit::Private): New.
* qt/pinlineedit.cpp: Add static constants FormattedPassphraseGroupSize,
FormattedPassphraseSeparator.
(PinLineEdit::PinLineEdit): Initialize new field. Connect textEdited
signal.
* qt/pinlineedit.h (PinLineEdit::PinLineEdit): Add explicit specifier.
Make argument optional.
(PinLineEdit::keyPressEvent): Add override specifier.
(PinLineEdit): Make inherited QLineEdit::setText and QLineEdit::text
private. Add field d.

This adds support for optional passphrase formatting, i.e. it allows
the user to enable display of the passphrase (in particular a generated
passphrase) formatted for better readability. Formatting groups the
passphrase into groups of four characters separated by non-breaking
spaces.

Details

Provenance
ikloeckerAuthored on Jul 13 2021, 12:51 PM
Parents
rPdeb97f3eb65f: Add support for formatted passphrase options
Branches
Unknown
Tags
Unknown
Tasks
T5517: Improvements for symmetric encryption