9#ifndef SRC_PASSWORDDISPLAYPANEL_H_
10#define SRC_PASSWORDDISPLAYPANEL_H_
55 QWidget *widgetParent, QObject *parent =
nullptr);
87 const AppSettings &s,
const QString &otpConfig = {});
155 auto eventFilter(QObject *watched, QEvent *event) ->
bool override;
170 void addField(
int position,
const QString &field,
const QString &value,
180 void addRow(
int position, QLabel *label, QFrame *frame);
190 void addOtpField(
int position,
const QString &otpConfig,
217 const QString &value,
const QString &lineStyle);
The NamedValues class is mostly a list of NamedValue but also has a method to take a specific NamedVa...
auto isSecret(const QString &field, const AppSettings &s) const -> bool
Whether a field is a secret "Hide password" hides: one a template marks (setMarkedSecrets()),...
void qrRequested(const QString &text)
Emitted when a field's QR button is clicked.
QWidget * m_widgetParent
Parent for the buttons the panel creates and source of the palette used by applyFrameStyle(); not own...
void refreshPalette()
Re-derive palette-dependent styling after a runtime theme change.
QStringList m_markedSecrets
Field names the current template marks as secret, compared case-insensitively in isSecret(); set by s...
void setMarkedSecrets(const QStringList &names)
Set the field names a template marks as secret.
void displayFields(const QString &password, const NamedValues &namedValues, const AppSettings &s, const QString &otpConfig={})
Render the password and template fields of a decrypted entry.
auto eventFilter(QObject *watched, QEvent *event) -> bool override
Turn a left double-click on a field row into editRequested().
QGridLayout * m_grid
The grid the rows go into; owned by MainWindow's .ui.
void addActionButtons(QLayout *layout, const QString &field, const QString &value, const AppSettings &s)
Add the copy, QR and open-in-browser buttons a field gets, per the settings.
QBoxLayout * m_container
Layout around the grid whose spacing is 0 while empty and 6 once rows are shown; owned by MainWindow'...
void addField(int position, const QString &field, const QString &value, const AppSettings &s)
Render one name: value row: action buttons, then the value either behind the eye button (see hides())...
void clear()
Remove all field rows and collapse the container spacing.
auto createFieldFrame() -> QFrame *
New bordered frame with a tight horizontal layout, styled by applyFrameStyle(); shared by addField() ...
PasswordDisplayPanel(QGridLayout *grid, QBoxLayout *container, QWidget *widgetParent, QObject *parent=nullptr)
Construct a panel that renders into the given layouts.
void textCopied(const QString &text)
Text was selected and copied out of a field's value (Ctrl+C, the context menu, a drag,...
void addRow(int position, QLabel *label, QFrame *frame)
Put a row's label and value frame into the grid, listening for a double-click on either (and on the f...
void copyRequested(const QString &text)
Emitted when a field's copy button is clicked.
void addOtpField(int position, const QString &otpConfig, const AppSettings &s)
Render the live OTP row: an OtpCodeWidget in a field frame under an "OTP code" label....
void addHiddenPassword(QLayout *layout, const QString &field, const QString &value, const QString &lineStyle)
Add the password, hidden, with a button that shows it.
auto currentOtpCode() const -> QString
The one-time password currently on display, if there is one.
void editRequested()
Emitted on a double-click anywhere on a field row: the user wants to change what they are looking at.
auto hides(const QString &field, const AppSettings &s) const -> bool
Whether a field is shown behind the eye button: the password, a field a template marks,...
void applyFrameStyle(QFrame *frame) const
Give a field frame its rounded border in the current QPalette::Mid colour. The colour is baked into t...
Parser for a decrypted password entry: password line, key: value fields, remaining text and the OTP c...
Plain value-object holding all flat QtPass configuration.