|
QtPass 2.0.0
Developer documentation
|
Dialog for selecting GPG recipients for password encryption. More...
#include <usersdialog.h>
Public Types | |
| enum class | Preselect { FromList , Nothing } |
| Whether the recipients on disk are ticked when it opens. More... | |
Public Slots | |
| void | accept () override |
| Handle dialog acceptance. | |
Public Member Functions | |
| UsersDialog (Pass *pass, const AppSettings &s, QString dir, QWidget *parent=nullptr) | |
| Construct users dialog. | |
| UsersDialog (Pass *pass, const AppSettings &s, QString dir, Preselect preselect, QWidget *parent=nullptr) | |
| Construct users dialog, saying what to preselect. | |
| ~UsersDialog () override | |
| Destroys the dialog and its generated form. | |
| void | setInitOnAccept (bool initOnAccept) |
| Choose whether OK runs Pass::Init on the folder. | |
| auto | selectedUsers () const -> QList< UserInfo > |
| The key list with the user's choice in each entry's enabled flag. | |
| auto | hasSelection () const -> bool |
| Whether at least one key is ticked. | |
Protected Member Functions | |
| void | keyPressEvent (QKeyEvent *event) override |
| Handle key press. | |
Private Slots | |
| void | itemChange (QListWidgetItem *item) |
| Handle user selection change. | |
| void | on_lineEdit_textChanged (const QString &filter) |
| Filter user list. | |
| void | on_checkBox_clicked () |
| Handle select all checkbox. | |
| void | on_importKeyButton_clicked () |
| Import a GPG key and refresh the list. | |
| void | selectImportedKey (const QString &importedKey) |
| Make the key gpg just imported the current row. gpg reports a 16-character long ID (IMPORTED) or a 40-character fingerprint (IMPORT_OK), so the two are compared both ways, by suffix. | |
Private Member Functions | |
| void | updateOkButton () |
| Enable OK only while at least one key is ticked (hasSelection()). | |
| void | restoreDialogState () |
| void | connectSignals () |
| Connect dialog signals. | |
| auto | loadGpgKeys () -> bool |
| Load GPG keys and determine secret key status. | |
| void | markSecretKeys (QList< UserInfo > &users) |
| Mark which keys have secret counterparts. | |
| void | loadRecipients () |
| Load recipients and handle missing keys. | |
| void | showRecipientWarning (const QString &text) |
Show text above the key list in bold red, for a recipient list that could not be verified. | |
| void | selectRecipients (const QStringList &recipients) |
| Tick the keys the folder is encrypted to, and list recipients no key in the keyring answers to, so saving does not drop them silently. | |
| void | populateList (const QString &filter=QString()) |
| Populate user list. | |
| bool | passesFilter (const UserInfo &user, const QString &filter, const QRegularExpression &nameFilter) const |
| Check if user passes filter. | |
| auto | isUserExpired (const UserInfo &user) const -> bool |
| Check if GPG key is expired. | |
| QString | buildUserText (const UserInfo &user) const |
| Build display text for user. | |
| void | applyUserStyling (QListWidgetItem *item, const UserInfo &user) const |
| Apply visual styling to user item. | |
Private Attributes | |
| QScopedPointer< Ui::UsersDialog > | ui |
| The widgets from usersdialog.ui. | |
| Pass * | m_pass |
| QString | m_passStore |
| QString | m_gpgExe |
| QList< UserInfo > | m_userList |
| bool | m_initOnAccept {true} |
| QString | m_dir |
| Preselect | m_preselect = Preselect::FromList |
| QString | m_lastFilter |
| QString | m_cachedPatternString |
| QRegularExpression | m_cachedNameFilter |
| QDateTime | m_cachedCurrentDateTime |
| bool | m_cachedDateTimeValid |
Dialog for selecting GPG recipients for password encryption.
UsersDialog allows users to select which GPG keys to encrypt passwords to. It displays available keys, supports filtering, and shows key expiration status.
Definition at line 35 of file usersdialog.h.
|
strong |
Whether the recipients on disk are ticked when it opens.
| Enumerator | |
|---|---|
| FromList | The folder's recipient list, as the backend reads it. |
| Nothing | None: for a store that had no list when it was chosen. |
Definition at line 40 of file usersdialog.h.
|
explicit |
Construct users dialog.
| pass | Active Pass backend. |
| s | Application settings snapshot. |
| dir | Password store directory path. |
| parent | Parent widget. |
Definition at line 34 of file usersdialog.cpp.
| UsersDialog::UsersDialog | ( | Pass * | pass, |
| const AppSettings & | s, | ||
| QString | dir, | ||
| Preselect | preselect, | ||
| QWidget * | parent = nullptr ) |
Construct users dialog, saying what to preselect.
| pass | Active Pass backend. |
| s | Application settings snapshot. |
| dir | Password store directory path. |
| preselect | What is ticked when it opens. |
| parent | Parent widget. |
Definition at line 38 of file usersdialog.cpp.
|
overrideslot |
Handle dialog acceptance.
Definition at line 250 of file usersdialog.cpp.
|
private |
Apply visual styling to user item.
| item | List item. |
| user | User info. |
Definition at line 374 of file usersdialog.cpp.
|
private |
Build display text for user.
| user | User info. |
Definition at line 361 of file usersdialog.cpp.
|
private |
Connect dialog signals.
Definition at line 58 of file usersdialog.cpp.
|
nodiscard |
Whether at least one key is ticked.
Definition at line 263 of file usersdialog.cpp.
|
private |
Check if GPG key is expired.
| user | User to check. |
Definition at line 351 of file usersdialog.cpp.
|
privateslot |
Handle user selection change.
| item | Changed list item. |
Definition at line 284 of file usersdialog.cpp.
|
overrideprotected |
|
private |
Load GPG keys and determine secret key status.
Definition at line 74 of file usersdialog.cpp.
|
private |
Load recipients and handle missing keys.
Definition at line 226 of file usersdialog.cpp.
|
private |
Mark which keys have secret counterparts.
| users | List of users to mark. |
Definition at line 89 of file usersdialog.cpp.
|
privateslot |
Handle select all checkbox.
Definition at line 414 of file usersdialog.cpp.
|
privateslot |
Import a GPG key and refresh the list.
Definition at line 437 of file usersdialog.cpp.
|
privateslot |
Filter user list.
| filter | Filter text. |
Definition at line 410 of file usersdialog.cpp.
|
private |
Check if user passes filter.
| user | User to check. |
| filter | Text filter. |
| nameFilter | Regex filter. |
Definition at line 337 of file usersdialog.cpp.
|
private |
Populate user list.
| filter | Optional filter text. |
Definition at line 305 of file usersdialog.cpp.
|
private |
Attach WindowStateStore, which restores the dialog's saved geometry now and saves it under "usersDialog" when the dialog closes.
Definition at line 70 of file usersdialog.cpp.
|
inlinenodiscard |
The key list with the user's choice in each entry's enabled flag.
Definition at line 83 of file usersdialog.h.
|
privateslot |
Make the key gpg just imported the current row. gpg reports a 16-character long ID (IMPORTED) or a 40-character fingerprint (IMPORT_OK), so the two are compared both ways, by suffix.
| importedKey | What gpg reported. |
Definition at line 416 of file usersdialog.cpp.
|
private |
Tick the keys the folder is encrypted to, and list recipients no key in the keyring answers to, so saving does not drop them silently.
| recipients | The folder's recipients, as listed in its .gpg-id. |
Definition at line 158 of file usersdialog.cpp.
|
inline |
Choose whether OK runs Pass::Init on the folder.
On by default. Off, the dialog only collects the selection; the caller reads selectedUsers() and initialises the folder itself (new profiles, which must not go through the backend of the active store).
| initOnAccept | false to skip Pass::Init. |
Definition at line 77 of file usersdialog.h.
|
private |
Show text above the key list in bold red, for a recipient list that could not be verified.
| text | The warning, plain text. |
Definition at line 102 of file usersdialog.cpp.
|
private |
Enable OK only while at least one key is ticked (hasSelection()).
Definition at line 268 of file usersdialog.cpp.
|
mutableprivate |
Cached current date/time for expiry checks
Definition at line 148 of file usersdialog.h.
|
mutableprivate |
Whether cached date/time is valid
Definition at line 150 of file usersdialog.h.
|
private |
Cached regex filter
Definition at line 147 of file usersdialog.h.
|
private |
Cached pattern string
Definition at line 146 of file usersdialog.h.
|
private |
Password store directory
Definition at line 143 of file usersdialog.h.
|
private |
GPG executable path
Definition at line 138 of file usersdialog.h.
|
private |
Whether accept() runs Pass::Init.
Definition at line 140 of file usersdialog.h.
|
private |
Last filter text for caching
Definition at line 145 of file usersdialog.h.
|
private |
Active Pass backend
Definition at line 136 of file usersdialog.h.
|
private |
Password store root path
Definition at line 137 of file usersdialog.h.
|
private |
What opens ticked
Definition at line 144 of file usersdialog.h.
|
private |
List of available GPG users
Definition at line 139 of file usersdialog.h.
|
private |
The widgets from usersdialog.ui.
Definition at line 135 of file usersdialog.h.