|
QtPass 2.0.0
Developer documentation
|
The ConfigDialog handles the configuration interface. More...
#include <configdialog.h>
Classes | |
| struct | ProfileEntry |
| One row of the profile list while the dialog is open. A QList rather than the Profiles map so a profile can pass through an empty or duplicate name while it is being typed; getProfiles() builds the map. More... | |
| struct | ProfileProblems |
| What is wrong with one profile's fields; empty strings where nothing is. More... | |
| struct | SigningStores |
Public Member Functions | |
| ConfigDialog (QWidget *parent) | |
| Construct a ConfigDialog associated with the given main window. | |
| void | useSelection (bool useSelection) |
| Enable or disable clipboard selection mode. | |
| auto | getProfiles () -> Profiles |
| Return all configured profiles. | |
| void | useTrayIcon (bool useSystray) |
| Show or hide the system tray icon. | |
| void | useGit (bool useGit) |
| Enable or disable git integration. | |
| void | useOtp (bool useOtp) |
| Enable or disable OTP support. | |
| void | useGrepSearch (bool useGrepSearch) |
| Enable or disable grep content search. | |
| void | useQrencode (bool useQrencode) |
| Enable or disable QR code display. | |
| void | setPwgenPath (const QString &path) |
| Set the path to the pwgen executable. | |
| void | usePwgen (bool usePwgen) |
| Enable or disable pwgen-based password generation. | |
| void | setPasswordConfiguration (const PasswordConfiguration &config) |
| Apply a password configuration to the dialog controls. | |
| auto | getPasswordConfiguration () -> PasswordConfiguration |
| Read the current password configuration from the dialog controls. | |
Static Public Member Functions | |
| static auto | isFingerprintList (const QString &setting) -> bool |
| Whether a signing-key setting holds only full key fingerprints (40 or 64 hexadecimal characters each, space separated); empty passes. | |
Protected Member Functions | |
| void | changeEvent (QEvent *event) override |
| Forget the signing keys gpg did not know while the dialog is in the background, and check them again once it is back in front. | |
Private Slots | |
| void | on_accepted () |
| On OK: warn about a dubious SSH_AUTH_SOCK override, save the settings and the profiles, let the active profile follow a rename, and create and initialise the stores of profiles added in this session. | |
| void | on_autodetectButton_clicked () |
| Fill the pass, gpg (gpg2 first), git and pwgen paths from PATH, keeping a field as it is when nothing is found, and choose the pass backend when pass was found. | |
| void | on_radioButtonNative_clicked () |
| Native (gpg/git) backend chosen: enable its group box, disable pass's. | |
| void | on_radioButtonPass_clicked () |
| pass backend chosen: enable its group box, disable the native one. | |
| void | on_toolButtonGit_clicked () |
| Pick the git executable in a file dialog; a cancelled dialog turns Git off and disables its checkbox, as a missing git does. | |
| void | on_toolButtonGpg_clicked () |
| Pick the gpg executable in a file dialog; cancel keeps the field. | |
| void | on_pushButtonGenerateKey_clicked () |
| Open KeygenDialog for the gpg shown in the dialog. | |
| void | on_toolButtonPwgen_clicked () |
| Pick the pwgen executable; a choice enables "use pwgen", a cancelled dialog unticks and disables it. | |
| void | on_toolButtonPass_clicked () |
| Pick the pass executable in a file dialog; cancel keeps the field. | |
| void | on_toolButtonStore_clicked () |
| Pick the password store folder for the pass backend's store path. | |
| void | on_comboBoxClipboard_activated (int index) |
| Enable the controls that only mean something with a clipboard (selection, hiding, autoclear) unless "No clipboard" is chosen. | |
| void | on_passwordCharTemplateSelector_activated (int index) |
| Show the chosen character set's characters in the line edit, editable only for the custom set. | |
| void | on_checkBoxSelection_clicked () |
| Re-apply the clipboard gating for the current clipboard mode. | |
| void | on_addButton_clicked () |
| Append a "New profile" row pointing at the global store path, select it and put the cursor in the name field. | |
| void | on_deleteButton_clicked () |
| Remove the selected profile row (a message when none is); the list's currentRowChanged re-points the form at a neighbour. | |
| void | on_profilePathBrowse_clicked () |
| Pick the selected profile's store folder and store it in its entry. | |
| void | on_checkBoxUseTrayIcon_clicked () |
| Hide-on-close and start-minimised are only offered with a tray icon. | |
| void | on_checkBoxUseGit_clicked () |
| Enable the Git-dependent boxes (add .gpg-id, auto pull/push, and in native mode the parent-repository switch) with "use Git". | |
| void | on_checkBoxUsePwgen_clicked () |
| Enable pwgen's flags or the character-set controls, whichever the "use pwgen" box selects; nothing in pass mode, where pass generates. | |
| void | onProfileSelected (int row) |
| The profile list's current row changed: show that profile. | |
| void | onProfileNameEdited (const QString &name) |
| The name field was typed in: store it in the entry and the list item, then validate (duplicates, empty). | |
| void | onProfilePathEdited (const QString &path) |
| The path field was typed in: store it in the entry, validate and refresh the status line. | |
| void | onProfileSigningKeyEdited (const QString &key) |
| The signing-key field was typed in: store it in the entry and validate (fingerprints only, shared keys). | |
| void | onProfileGitToggled () |
| One of the profile's Git boxes was clicked: all three flags become the profile's own (no longer following the globals), and push and pull are enabled only with Git. | |
Private Member Functions | |
| void | updateSecretFieldsEnabled () |
| void | loadProfileForm (int row) |
Show row row's profile in the form (or clear and disable it for -1), with m_loadingForm set so the fields' edited-signals do not write back. The Git boxes show the profile's own flags, else the global ones. | |
| auto | currentEntry () -> ProfileEntry * |
| The entry the form is editing. | |
| void | updateProfileStatus () |
| Refresh the status line under the form: the profile's name and cleaned path, marked "New" while the folder does not exist, or a reminder to fill in the required fields. | |
| void | setGitPath (const QString &path) |
Show path as the git executable; an empty path disables and turns off "use Git". | |
| void | setProfiles (Profiles profiles, const QString ¤tProfile) |
Fill the profile list and m_entries from profiles, dropping the empty-named leftover older versions wrote, select currentProfile and validate. | |
| void | usePass (bool usePass) |
| Tick the pass or the native radio button and enable the matching group box. | |
| void | applySettings (const AppSettings &settings) |
| Load the dialog's value widgets from an AppSettings struct. | |
| auto | readSettings () -> AppSettings |
| Build an AppSettings struct from the dialog's widgets. | |
| void | setGroupBoxState () |
| Enable the group box of the chosen backend and, in pass mode, disable the password-generation controls pass takes care of; in native mode hand them back to on_checkBoxUsePwgen_clicked(). | |
| auto | selectExecutable () -> QString |
| Ask for an existing file in a read-only file dialog. | |
| auto | selectFolder () -> QString |
| Ask for a directory in a directories-only file dialog. | |
| void | criticalMessage (const QString &title, const QString &text) |
| QMessageBox::critical with a single OK button. Once a workaround for crashes in Qt 5.4.1 before QApplication::exec(); no caller today. | |
| auto | isQrencodeAvailable (const QString &configuredPath) -> bool |
Whether qrencode can run: configuredPath when it is an executable file, else a qrencode on Util's PATH, which is then saved as the qrencode executable. Always false on Windows. | |
| void | validate () |
| Check every profile (problemsOf(), sharingTheKey()), mark the rows and the form, enable OK only when no profile has a problem, and refresh the pass Git warning. | |
| void | updatePassGitWarning () |
| auto | problemsOf (const ProfileEntry &entry, const QHash< QString, int > &names) const -> ProfileProblems |
What is wrong with entry's name, store path and signing keys. | |
| void | showProblems (int row, const ProfileProblems &problems) |
Mark row row of the profile list, and the form fields when it is the row being edited, with problems. | |
| auto | signingStores () const -> SigningStores |
| Resolve every profile's store and fingerprints once. | |
| auto | signerKeys (const QString &signingKey, const QProcessEnvironment &env) const -> QSet< QString > |
| One profile's signing keys as signers: each key as written, plus the primary fingerprint gpg gives for a complete key ID or (sub)key fingerprint. | |
| auto | sharingTheKey (int row, const SigningStores &resolved) const -> QStringList |
The other profiles, for other stores, whose signing keys share a fingerprint with row row's. | |
| void | initializeNewProfiles (const Profiles &existingProfiles) |
| For every saved profile whose store was not a profile's store when the dialog opened: offer to create the folder and, when it has no .gpg-id, ask for recipients and initialise it. | |
| auto | ensureProfileFolder (const QString &path) -> bool |
| Offer to create a new profile's store folder when it is missing. | |
| void | initialiseProfileStore (const QString &name, const Profile &profile, const QString &path) |
| Ask for a new profile's recipients and initialise its store with them, keeping the active backend's settings and queue on the active store (#1774). | |
| void | warnAboutSshAuthSockOverride () |
| void | followActiveProfile (const Profiles &profiles) |
| Point the active profile at its new name after a rename (or at none after a deletion), and let its own Git flags replace the global ones, as switching to it does. | |
Private Attributes | |
| QString | m_nameTip |
| QString | m_pathTip |
| QString | m_keyTip |
| QLabel * | m_sharedKeyWarning = nullptr |
| Below the signing key: the profiles that share it, if any. | |
| QLabel * | m_passGitWarning = nullptr |
| In the pass box: the stores pass would commit outside of, if any. | |
| QHash< QString, QString > | m_primaryOf |
| bool | m_recheckSigners = false |
| std::optional< AppSettings > | m_gpgSettings |
| QList< ProfileEntry > | m_entries |
| The profiles as shown; index == row in profileList. | |
| int | m_currentEntry = -1 |
| Row whose fields the form shows, -1 for none. | |
| bool | m_loadingForm = false |
| QScopedPointer< Ui::ConfigDialog > | ui |
| The widgets from configdialog.ui. | |
| QString | m_customPasswordChars |
The ConfigDialog handles the configuration interface.
Presents controls for profiles, generation tools (pwgen/pass), GPG/git/OTP/qrencode integration, template handling, tray icon and autoclear options, and exposes methods to read and update those settings.
Definition at line 39 of file configdialog.h.
|
explicit |
Construct a ConfigDialog associated with the given main window.
| parent | Parent widget, usually the main window. |
Definition at line 45 of file configdialog.cpp.
|
private |
Load the dialog's value widgets from an AppSettings struct.
Mirrors the legacy per-getter constructor loads. Sets values only; the constructor still handles environment-dependent gating (tray/OTP/qrencode availability, clipboard combo population, primary-selection support) and the profile table. Password-generation and pwgen-path widgets are intentionally not loaded here, matching the previous behaviour.
| settings | Values to display. |
Definition at line 181 of file configdialog.cpp.
|
overrideprotected |
Forget the signing keys gpg did not know while the dialog is in the background, and check them again once it is back in front.
| event | The change; only activation changes matter here. |
Definition at line 454 of file configdialog.cpp.
|
private |
QMessageBox::critical with a single OK button. Once a workaround for crashes in Qt 5.4.1 before QApplication::exec(); no caller today.
| title | The box's title. |
| text | The message. |
Definition at line 925 of file configdialog.cpp.
|
private |
The entry the form is editing.
Definition at line 780 of file configdialog.cpp.
|
private |
Offer to create a new profile's store folder when it is missing.
| path | The folder, cleaned. |
Definition at line 822 of file configdialog.cpp.
|
private |
Point the active profile at its new name after a rename (or at none after a deletion), and let its own Git flags replace the global ones, as switching to it does.
| profiles | The profiles as saved. |
Definition at line 575 of file configdialog.cpp.
| auto ConfigDialog::getPasswordConfiguration | ( | ) | -> PasswordConfiguration |
Read the current password configuration from the dialog controls.
Definition at line 1051 of file configdialog.cpp.
| auto ConfigDialog::getProfiles | ( | ) | -> Profiles |
Return all configured profiles.
Definition at line 814 of file configdialog.cpp.
|
private |
Ask for a new profile's recipients and initialise its store with them, keeping the active backend's settings and queue on the active store (#1774).
| name | The profile's name, for titles and messages. |
| profile | The profile. |
| path | Its store folder, cleaned. |
Definition at line 841 of file configdialog.cpp.
|
private |
For every saved profile whose store was not a profile's store when the dialog opened: offer to create the folder and, when it has no .gpg-id, ask for recipients and initialise it.
| existingProfiles | The profiles as they were when the dialog opened. |
Definition at line 875 of file configdialog.cpp.
|
static |
Whether a signing-key setting holds only full key fingerprints (40 or 64 hexadecimal characters each, space separated); empty passes.
| setting | The profile's signing key field. |
Definition at line 333 of file configdialog.cpp.
|
private |
Whether qrencode can run: configuredPath when it is an executable file, else a qrencode on Util's PATH, which is then saved as the qrencode executable. Always false on Windows.
| configuredPath | The saved qrencode executable, possibly empty. |
Definition at line 931 of file configdialog.cpp.
|
private |
Show row row's profile in the form (or clear and disable it for -1), with m_loadingForm set so the fields' edited-signals do not write back. The Git boxes show the profile's own flags, else the global ones.
| row | Row in m_entries, or -1 for none. |
Definition at line 789 of file configdialog.cpp.
|
privateslot |
On OK: warn about a dubious SSH_AUTH_SOCK override, save the settings and the profiles, let the active profile follow a rename, and create and initialise the stores of profiles added in this session.
Definition at line 595 of file configdialog.cpp.
|
privateslot |
Append a "New profile" row pointing at the global store path, select it and put the cursor in the name field.
Definition at line 892 of file configdialog.cpp.
|
privateslot |
Fill the pass, gpg (gpg2 first), git and pwgen paths from PATH, keeping a field as it is when nothing is found, and choose the pass backend when pass was found.
Definition at line 608 of file configdialog.cpp.
|
privateslot |
Re-apply the clipboard gating for the current clipboard mode.
Definition at line 754 of file configdialog.cpp.
|
privateslot |
Enable the Git-dependent boxes (add .gpg-id, auto pull/push, and in native mode the parent-repository switch) with "use Git".
Definition at line 987 of file configdialog.cpp.
|
privateslot |
Enable pwgen's flags or the character-set controls, whichever the "use pwgen" box selects; nothing in pass mode, where pass generates.
Definition at line 1017 of file configdialog.cpp.
|
privateslot |
Hide-on-close and start-minimised are only offered with a tray icon.
Definition at line 964 of file configdialog.cpp.
|
privateslot |
Enable the controls that only mean something with a clipboard (selection, hiding, autoclear) unless "No clipboard" is chosen.
| index | The combo box row; 0 is "No clipboard". |
Definition at line 721 of file configdialog.cpp.
|
privateslot |
Remove the selected profile row (a message when none is); the list's currentRowChanged re-points the form at a neighbour.
Definition at line 912 of file configdialog.cpp.
|
privateslot |
Show the chosen character set's characters in the line edit, editable only for the custom set.
| index | A PasswordConfiguration::CharacterSet value. |
Definition at line 1067 of file configdialog.cpp.
|
privateslot |
Pick the selected profile's store folder and store it in its entry.
Definition at line 904 of file configdialog.cpp.
|
privateslot |
Open KeygenDialog for the gpg shown in the dialog.
Definition at line 701 of file configdialog.cpp.
|
privateslot |
Native (gpg/git) backend chosen: enable its group box, disable pass's.
Definition at line 631 of file configdialog.cpp.
|
privateslot |
pass backend chosen: enable its group box, disable the native one.
Definition at line 633 of file configdialog.cpp.
|
privateslot |
Pick the git executable in a file dialog; a cancelled dialog turns Git off and disables its checkbox, as a missing git does.
Definition at line 682 of file configdialog.cpp.
|
privateslot |
Pick the gpg executable in a file dialog; cancel keeps the field.
Definition at line 694 of file configdialog.cpp.
|
privateslot |
Pick the pass executable in a file dialog; cancel keeps the field.
Definition at line 706 of file configdialog.cpp.
|
privateslot |
Pick the pwgen executable; a choice enables "use pwgen", a cancelled dialog unticks and disables it.
Definition at line 997 of file configdialog.cpp.
|
privateslot |
Pick the password store folder for the pass backend's store path.
Definition at line 713 of file configdialog.cpp.
|
privateslot |
One of the profile's Git boxes was clicked: all three flags become the profile's own (no longer following the globals), and push and pull are enabled only with Git.
Definition at line 1112 of file configdialog.cpp.
|
privateslot |
The name field was typed in: store it in the entry and the list item, then validate (duplicates, empty).
| name | The text as typed. |
Definition at line 1079 of file configdialog.cpp.
|
privateslot |
The path field was typed in: store it in the entry, validate and refresh the status line.
| path | The text as typed. |
Definition at line 1092 of file configdialog.cpp.
|
privateslot |
The profile list's current row changed: show that profile.
| row | The new row, -1 for none. |
Definition at line 1077 of file configdialog.cpp.
|
privateslot |
The signing-key field was typed in: store it in the entry and validate (fingerprints only, shared keys).
| key | The text as typed. |
Definition at line 1102 of file configdialog.cpp.
|
private |
What is wrong with entry's name, store path and signing keys.
| entry | The profile to check. |
| names | How many profiles carry each name, for duplicates. |
Definition at line 345 of file configdialog.cpp.
|
private |
Build an AppSettings struct from the dialog's widgets.
Starts from the currently persisted settings and overwrites only the fields this dialog owns, so unrelated keys (window geometry, profiles, etc.) are preserved on save.
Definition at line 244 of file configdialog.cpp.
|
private |
Ask for an existing file in a read-only file dialog.
Definition at line 659 of file configdialog.cpp.
|
private |
Ask for a directory in a directories-only file dialog.
Definition at line 670 of file configdialog.cpp.
|
private |
Show path as the git executable; an empty path disables and turns off "use Git".
| path | The git executable, or empty for none. |
Definition at line 319 of file configdialog.cpp.
|
private |
Enable the group box of the chosen backend and, in pass mode, disable the password-generation controls pass takes care of; in native mode hand them back to on_checkBoxUsePwgen_clicked().
Definition at line 635 of file configdialog.cpp.
| void ConfigDialog::setPasswordConfiguration | ( | const PasswordConfiguration & | config | ) |
Apply a password configuration to the dialog controls.
| config | Configuration to display. |
Definition at line 1038 of file configdialog.cpp.
|
private |
Fill the profile list and m_entries from profiles, dropping the empty-named leftover older versions wrote, select currentProfile and validate.
| profiles | The saved profiles. |
| currentProfile | The active profile's name, to select its row. |
Definition at line 758 of file configdialog.cpp.
| void ConfigDialog::setPwgenPath | ( | const QString & | path | ) |
Set the path to the pwgen executable.
| path | Path to pwgen. |
Definition at line 1008 of file configdialog.cpp.
|
nodiscardprivate |
The other profiles, for other stores, whose signing keys share a fingerprint with row row's.
| row | The profile's row. |
| resolved | What signingStores() gave for this validation. |
Definition at line 475 of file configdialog.cpp.
|
private |
Mark row row of the profile list, and the form fields when it is the row being edited, with problems.
| row | Row in the profile list. |
| problems | What problemsOf() found for it. |
Definition at line 367 of file configdialog.cpp.
|
nodiscardprivate |
One profile's signing keys as signers: each key as written, plus the primary fingerprint gpg gives for a complete key ID or (sub)key fingerprint.
| signingKey | The profile's signing-key setting. |
| env | The environment gpg looks keys up in (its GPG home). |
Definition at line 409 of file configdialog.cpp.
|
nodiscardprivate |
Resolve every profile's store and fingerprints once.
Definition at line 385 of file configdialog.cpp.
|
private |
Shows m_passGitWarning for the stores Util::repositoryPassClimbsTo() names, while the pass backend is chosen.
Definition at line 521 of file configdialog.cpp.
|
private |
Refresh the status line under the form: the profile's name and cleaned path, marked "New" while the folder does not exist, or a reminder to fill in the required fields.
Definition at line 1124 of file configdialog.cpp.
|
private |
The secret-fields and every-field checkboxes only while passwords are hidden; the secret words and "Default" only while secret fields are hidden and every field is not.
Definition at line 734 of file configdialog.cpp.
| void ConfigDialog::useGit | ( | bool | useGit | ) |
Enable or disable git integration.
| useGit | true to enable git. |
Definition at line 970 of file configdialog.cpp.
| void ConfigDialog::useGrepSearch | ( | bool | useGrepSearch | ) |
Enable or disable grep content search.
| useGrepSearch | true to enable grep search. |
Definition at line 979 of file configdialog.cpp.
| void ConfigDialog::useOtp | ( | bool | useOtp | ) |
Enable or disable OTP support.
| useOtp | true to enable OTP. |
Definition at line 975 of file configdialog.cpp.
|
private |
Tick the pass or the native radio button and enable the matching group box.
| usePass | true for the pass backend. |
Definition at line 327 of file configdialog.cpp.
| void ConfigDialog::usePwgen | ( | bool | usePwgen | ) |
Enable or disable pwgen-based password generation.
| usePwgen | true to use pwgen. |
Definition at line 1030 of file configdialog.cpp.
| void ConfigDialog::useQrencode | ( | bool | useQrencode | ) |
Enable or disable QR code display.
| useQrencode | true to enable qrencode. |
Definition at line 983 of file configdialog.cpp.
| void ConfigDialog::useSelection | ( | bool | useSelection | ) |
Enable or disable clipboard selection mode.
| useSelection | true to enable selection mode. |
Definition at line 749 of file configdialog.cpp.
| void ConfigDialog::useTrayIcon | ( | bool | useSystray | ) |
Show or hide the system tray icon.
| useSystray | true to enable the tray icon. |
Definition at line 951 of file configdialog.cpp.
|
private |
Check every profile (problemsOf(), sharingTheKey()), mark the rows and the form, enable OK only when no profile has a problem, and refresh the pass Git warning.
Definition at line 496 of file configdialog.cpp.
|
private |
Warn, without refusing, when the SSH_AUTH_SOCK override does not look like a socket; the value is saved as entered either way.
Definition at line 549 of file configdialog.cpp.
|
private |
Row whose fields the form shows, -1 for none.
Definition at line 300 of file configdialog.h.
|
private |
User-defined custom charset, retained while a builtin set is selected so it is not lost when the line edit shows the builtin's characters instead.
Definition at line 493 of file configdialog.h.
|
private |
The profiles as shown; index == row in profileList.
Definition at line 298 of file configdialog.h.
|
mutableprivate |
The settings naming the GPG home those lookups run in, read on first use.
Definition at line 296 of file configdialog.h.
|
private |
Designer tooltip of the signing-key field, put back when validate() has no complaint about it.
Definition at line 283 of file configdialog.h.
|
private |
True while loadProfileForm() sets the fields, so their edited-signals do not write back.
Definition at line 303 of file configdialog.h.
|
private |
Designer tooltip of the profile-name field, put back when validate() has no complaint about it.
Definition at line 277 of file configdialog.h.
|
private |
In the pass box: the stores pass would commit outside of, if any.
Definition at line 287 of file configdialog.h.
|
private |
Designer tooltip of the store-path field, put back when validate() has no complaint about it.
Definition at line 280 of file configdialog.h.
|
mutableprivate |
Primary fingerprint per gpg and signing-key token (empty: gpg does not know it), so each key is looked up once, not on every keystroke.
Definition at line 290 of file configdialog.h.
|
private |
An unknown key was forgotten in the background: validate() again on return.
Definition at line 293 of file configdialog.h.
|
private |
Below the signing key: the profiles that share it, if any.
Definition at line 285 of file configdialog.h.
|
private |
The widgets from configdialog.ui.
Definition at line 325 of file configdialog.h.