8#ifndef SRC_CONFIGDIALOG_H_
9#define SRC_CONFIGDIALOG_H_
18#include <QProcessEnvironment>
264 [[nodiscard]]
auto none() const ->
bool {
265 return name.isEmpty() &&
path.isEmpty() &&
key.isEmpty();
271 [[nodiscard]]
auto first() const -> QString {
325 QScopedPointer<Ui::ConfigDialog>
ui;
444 [[nodiscard]] auto
signerKeys(const QString &signingKey,
445 const QProcessEnvironment &env) const
479 const QString &path);
AppSettings, the value object holding every flat QtPass setting.
void setPasswordConfiguration(const PasswordConfiguration &config)
Apply a password configuration to the dialog controls.
void on_deleteButton_clicked()
Remove the selected profile row (a message when none is); the list's currentRowChanged re-points the ...
std::optional< AppSettings > m_gpgSettings
void on_passwordCharTemplateSelector_activated(int index)
Show the chosen character set's characters in the line edit, editable only for the custom set.
static auto isFingerprintList(const QString &setting) -> bool
Whether a signing-key setting holds only full key fingerprints (40 or 64 hexadecimal characters each,...
void on_toolButtonGit_clicked()
Pick the git executable in a file dialog; a cancelled dialog turns Git off and disables its checkbox,...
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 validate()
Check every profile (problemsOf(), sharingTheKey()), mark the rows and the form, enable OK only when ...
void updatePassGitWarning()
auto ensureProfileFolder(const QString &path) -> bool
Offer to create a new profile's store folder when it is missing.
void on_radioButtonNative_clicked()
Native (gpg/git) backend chosen: enable its group box, disable pass's.
QList< ProfileEntry > m_entries
The profiles as shown; index == row in profileList.
void useOtp(bool useOtp)
Enable or disable OTP support.
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 fi...
void on_pushButtonGenerateKey_clicked()
Open KeygenDialog for the gpg shown in the dialog.
void setPwgenPath(const QString &path)
Set the path to the pwgen executable.
void on_toolButtonStore_clicked()
Pick the password store folder for the pass backend's store path.
void on_checkBoxUseTrayIcon_clicked()
Hide-on-close and start-minimised are only offered with a tray icon.
QHash< QString, QString > m_primaryOf
void useGit(bool useGit)
Enable or disable git integration.
void on_radioButtonPass_clicked()
pass backend chosen: enable its group box, disable the native one.
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,...
int m_currentEntry
Row whose fields the form shows, -1 for none.
void on_profilePathBrowse_clicked()
Pick the selected profile's store folder and store it in its entry.
QLabel * m_sharedKeyWarning
Below the signing key: the profiles that share it, if any.
QScopedPointer< Ui::ConfigDialog > ui
The widgets from configdialog.ui.
void on_checkBoxUsePwgen_clicked()
Enable pwgen's flags or the character-set controls, whichever the "use pwgen" box selects; nothing in...
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 fo...
void setProfiles(Profiles profiles, const QString ¤tProfile)
Fill the profile list and m_entries from profiles, dropping the empty-named leftover older versions w...
void useQrencode(bool useQrencode)
Enable or disable QR code display.
void on_autodetectButton_clicked()
Fill the pass, gpg (gpg2 first), git and pwgen paths from PATH, keeping a field as it is when nothing...
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 on_comboBoxClipboard_activated(int index)
Enable the controls that only mean something with a clipboard (selection, hiding, autoclear) unless "...
void onProfilePathEdited(const QString &path)
The path field was typed in: store it in the entry, validate and refresh the status line.
void usePass(bool usePass)
Tick the pass or the native radio button and enable the matching group box.
void useGrepSearch(bool useGrepSearch)
Enable or disable grep content search.
QLabel * m_passGitWarning
In the pass box: the stores pass would commit outside of, if any.
void initializeNewProfiles(const Profiles &existingProfiles)
For every saved profile whose store was not a profile's store when the dialog opened: offer to create...
ConfigDialog(QWidget *parent)
Construct a ConfigDialog associated with the given main window.
void onProfileSelected(int row)
The profile list's current row changed: show that profile.
auto signingStores() const -> SigningStores
Resolve every profile's store and fingerprints once.
auto selectExecutable() -> QString
Ask for an existing file in a read-only file dialog.
QString m_customPasswordChars
void setGitPath(const QString &path)
Show path as the git executable; an empty path disables and turns off "use Git".
void on_toolButtonPass_clicked()
Pick the pass executable in a file dialog; cancel keeps the field.
void setGroupBoxState()
Enable the group box of the chosen backend and, in pass mode, disable the password-generation control...
void onProfileGitToggled()
One of the profile's Git boxes was clicked: all three flags become the profile's own (no longer follo...
void on_checkBoxUseGit_clicked()
Enable the Git-dependent boxes (add .gpg-id, auto pull/push, and in native mode the parent-repository...
auto getPasswordConfiguration() -> PasswordConfiguration
Read the current password configuration from the dialog controls.
auto currentEntry() -> ProfileEntry *
The entry the form is editing.
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 s...
void criticalMessage(const QString &title, const QString &text)
QMessageBox::critical with a single OK button. Once a workaround for crashes in Qt 5....
void useTrayIcon(bool useSystray)
Show or hide the system tray icon.
void onProfileSigningKeyEdited(const QString &key)
The signing-key field was typed in: store it in the entry and validate (fingerprints only,...
void followActiveProfile(const Profiles &profiles)
Point the active profile at its new name after a rename (or at none after a deletion),...
void on_toolButtonGpg_clicked()
Pick the gpg executable in a file dialog; cancel keeps the field.
void warnAboutSshAuthSockOverride()
void applySettings(const AppSettings &settings)
Load the dialog's value widgets from an AppSettings struct.
auto getProfiles() -> Profiles
Return all configured profiles.
void on_accepted()
On OK: warn about a dubious SSH_AUTH_SOCK override, save the settings and the profiles,...
void on_checkBoxSelection_clicked()
Re-apply the clipboard gating for the current clipboard mode.
void on_toolButtonPwgen_clicked()
Pick the pwgen executable; a choice enables "use pwgen", a cancelled dialog unticks and disables it.
void usePwgen(bool usePwgen)
Enable or disable pwgen-based password generation.
void changeEvent(QEvent *event) override
Forget the signing keys gpg did not know while the dialog is in the background, and check them again ...
void updateProfileStatus()
Refresh the status line under the form: the profile's name and cleaned path, marked "New" while the f...
auto isQrencodeAvailable(const QString &configuredPath) -> bool
Whether qrencode can run: configuredPath when it is an executable file, else a qrencode on Util's PAT...
auto readSettings() -> AppSettings
Build an AppSettings struct from the dialog's widgets.
void onProfileNameEdited(const QString &name)
The name field was typed in: store it in the entry and the list item, then validate (duplicates,...
void on_addButton_clicked()
Append a "New profile" row pointing at the global store path, select it and put the cursor in the nam...
auto selectFolder() -> QString
Ask for a directory in a directories-only file dialog.
void useSelection(bool useSelection)
Enable or disable clipboard selection mode.
The Enums namespace: clipboard behaviour and the identifiers of the subprocess kinds QtPass queues.
Value object for the password generator: chosen character set, its alphabets and the length.
One named password store (Profile) and the name-to-profile map (Profiles) the settings trade in.
QMap< QString, Profile > Profiles
All profiles by name. QMap so iteration order is the name order.
Plain value-object holding all flat QtPass configuration.
One row of the profile list while the dialog is open. A QList rather than the Profiles map so a profi...
QString name
The name as typed; may be empty or a duplicate.
What is wrong with one profile's fields; empty strings where nothing is.
QString name
Empty or duplicate name; empty when fine.
auto none() const -> bool
Whether all three fields are fine.
auto first() const -> QString
The first complaint, for a tooltip on the profile's row.
QString path
Missing store path; empty when fine.
QStringList stores
Canonical (or cleaned) store path.
QList< QSet< QString > > keys
Fingerprints of the signing key.
Holds the password generator settings: which character set is selected, the alphabet of every set,...
One named password store: where it is, how its .gpg-id is signed and, optionally, its own Git switche...