3#ifndef SRC_QTPASSSETTINGS_H_
4#define SRC_QTPASSSETTINGS_H_
15#include <QScopedPointer>
35class QtPassSettings :
public QSettings {
41 explicit QtPassSettings();
43 QtPassSettings(
const QString &organization,
const QSettings::Format format)
44 : QSettings(organization, format) {}
45 QtPassSettings(
const QString &organization,
const QString &application)
46 : QSettings(organization, application) {}
48 ~QtPassSettings()
override =
default;
50 static bool initialized;
51 static QtPassSettings *m_instance;
54 static QScopedPointer<RealPass> realPass;
55 static QScopedPointer<ImitatePass> imitatePass;
70 static auto getVersion(
const QString &defaultValue = QVariant().toString())
76 static void setVersion(
const QString &version);
84 getGeometry(
const QByteArray &defaultValue = QVariant().toByteArray())
90 static void setGeometry(
const QByteArray &geometry);
98 getSavestate(
const QByteArray &defaultValue = QVariant().toByteArray())
111 static auto getPos(
const QPoint &defaultValue = QVariant().toPoint())
117 static void setPos(
const QPoint &pos);
124 static auto getSize(
const QSize &defaultValue = QVariant().toSize()) -> QSize;
129 static void setSize(
const QSize &size);
136 static auto isMaximized(
const bool &defaultValue = QVariant().toBool())
153 const QByteArray &defaultValue = QVariant().toByteArray())
169 const QPoint &defaultValue = QVariant().toPoint())
176 static void setDialogPos(
const QString &key,
const QPoint &pos);
185 const QSize &defaultValue = QVariant().toSize())
192 static void setDialogSize(
const QString &key,
const QSize &size);
201 const bool &defaultValue = QVariant().toBool())
216 static auto isUsePass(
const bool &defaultValue = QVariant().toBool()) -> bool;
250 static auto isUseSelection(
const bool &defaultValue = QVariant().toBool())
263 static auto isUseAutoclear(
const bool &defaultValue = QVariant().toBool())
315 static auto isHidePassword(
const bool &defaultValue = QVariant().toBool())
328 static auto isHideContent(
const bool &defaultValue = QVariant().toBool())
341 static auto isUseMonospace(
const bool &defaultValue = QVariant().toBool())
354 static auto isDisplayAsIs(
const bool &defaultValue = QVariant().toBool())
367 static auto isNoLineWrapping(
const bool &defaultValue = QVariant().toBool())
380 static auto isAddGPGId(
const bool &defaultValue = QVariant().toBool())
394 static auto getPassStore(
const QString &defaultValue = QVariant().toString())
482 static auto getGpgHome(
const QString &defaultValue = QVariant().toString())
490 static auto isUseWebDav(
const bool &defaultValue = QVariant().toBool())
503 static auto getWebDavUrl(
const QString &defaultValue = QVariant().toString())
516 static auto getWebDavUser(
const QString &defaultValue = QVariant().toString())
543 static auto getProfile(
const QString &defaultValue = QVariant().toString())
549 static void setProfile(
const QString &profile);
556 static auto isUseGit(
const bool &defaultValue = QVariant().toBool()) -> bool;
561 static void setUseGit(
const bool &useGit);
568 static auto isUseOtp(
const bool &defaultValue = QVariant().toBool()) -> bool;
573 static void setUseOtp(
const bool &useOtp);
580 static auto isUseQrencode(
const bool &defaultValue = QVariant().toBool())
607 static auto isUsePwgen(
const bool &defaultValue = QVariant().toBool())
620 static auto isAvoidCapitals(
const bool &defaultValue = QVariant().toBool())
633 static auto isAvoidNumbers(
const bool &defaultValue = QVariant().toBool())
646 static auto isLessRandom(
const bool &defaultValue = QVariant().toBool())
659 static auto isUseSymbols(
const bool &defaultValue = QVariant().toBool())
698 static auto isUseTrayIcon(
const bool &defaultValue = QVariant().toBool())
711 static auto isHideOnClose(
const bool &defaultValue = QVariant().toBool())
724 static auto isStartMinimized(
const bool &defaultValue = QVariant().toBool())
737 static auto isAlwaysOnTop(
const bool &defaultValue = QVariant().toBool())
750 static auto isAutoPull(
const bool &defaultValue = QVariant().toBool())
763 static auto isAutoPush(
const bool &defaultValue = QVariant().toBool())
790 static auto isUseTemplate(
const bool &defaultValue = QVariant().toBool())
815 static auto getProfiles() -> QHash<QString, QHash<QString, QString>>;
821 setProfiles(
const QHash<QString, QHash<QString, QString>> &profiles);
Implementation that imitates 'pass' when the real tool is unavailable.
Abstract base class for password store operations.
static auto isUseSelection(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use selection (X11) for clipboard.
static void setMaximized(const bool &maximized)
Save maximized state.
static void setStartMinimized(const bool &startMinimized)
Save start-minimized flag.
static void setUseWebDav(const bool &useWebDav)
Save WebDAV integration flag.
static auto isUseAutoclear(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use autoclear for clipboard.
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
Save panel autoclear seconds.
static void setPassExecutable(const QString &passExecutable)
Save pass executable path.
static auto getWebDavPassword(const QString &defaultValue=QVariant().toString()) -> QString
Get WebDAV password.
static auto isStartMinimized(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether application should start minimized.
static void setHidePassword(const bool &hidePassword)
Save hide password setting.
static auto isUseOtp(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether OTP support is enabled.
static void setPwgenExecutable(const QString &pwgenExecutable)
Save pwgen executable path.
static auto getPwgenExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pwgen executable path.
static void setProfile(const QString &profile)
Save active profile name.
static void setUseTrayIcon(const bool &useTrayIcon)
Save tray icon support flag.
static void setWebDavPassword(const QString &webDavPassword)
Save WebDAV password.
static auto getInstance() -> QtPassSettings *
Get the singleton instance.
static auto isNoLineWrapping(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to disable line wrapping.
static auto getWebDavUser(const QString &defaultValue=QVariant().toString()) -> QString
Get WebDAV username.
static void setPassStore(const QString &passStore)
Save password store path.
static auto getDialogPos(const QString &key, const QPoint &defaultValue=QVariant().toPoint()) -> QPoint
Get saved dialog position.
static auto isHideContent(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to hide content (password + username).
static void setPasswordConfiguration(const PasswordConfiguration &config)
Save complete password generation configuration.
static auto getSize(const QSize &defaultValue=QVariant().toSize()) -> QSize
Get saved window size.
static void setHideOnClose(const bool &hideOnClose)
Save hide-on-close flag.
static auto getPass() -> Pass *
Get currently active pass backend instance.
static auto getPasswordConfiguration() -> PasswordConfiguration
Get complete password generation configuration.
static auto getGpgHome(const QString &defaultValue=QVariant().toString()) -> QString
Get GPG home directory.
static auto isUseQrencode(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether qrencode support is enabled.
static void setPasswordLength(const int &passwordLength)
Save password length setting.
static auto isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use panel autoclear.
static auto isAutoPull(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether automatic pull is enabled.
static void setGitExecutable(const QString &gitExecutable)
Save git executable path.
static void setPasswordChars(const QString &passwordChars)
Save custom password characters.
static auto isUseGit(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether Git integration is enabled.
static void setUseOtp(const bool &useOtp)
Save OTP support flag.
static void setProfiles(const QHash< QString, QHash< QString, QString > > &profiles)
Save all configured profiles.
static auto getClipBoardType(const Enums::clipBoardType &defaultValue=Enums::CLIPBOARD_NEVER) -> Enums::clipBoardType
Get clipboard type as enum.
static void setUsePwgen(const bool &usePwgen)
Save pwgen support flag.
static auto isTemplateAllFields(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether template applies to all fields.
static void setPassSigningKey(const QString &passSigningKey)
Save GPG signing key.
static auto isUsePass(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use pass (true) or GPG (false).
static auto getPassStore(const QString &defaultValue=QVariant().toString()) -> QString
Get password store directory path.
static auto getVersion(const QString &defaultValue=QVariant().toString()) -> QString
Get saved application version.
static auto isUseTemplate(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether template usage is enabled.
static auto isUseTrayIcon(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether tray icon support is enabled.
static void initExecutables()
Initialize executable paths by auto-detecting them.
static void setUseTemplate(const bool &useTemplate)
Save template usage flag.
static void setDialogPos(const QString &key, const QPoint &pos)
Save dialog position.
static auto isAvoidCapitals(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether uppercase characters should be avoided.
static auto isAddGPGId(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to auto-add GPG ID when receiving files.
static void setPasswordCharsselection(const int &passwordCharsSelection)
Save password character selection mode.
static auto getGpgExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get GPG executable path.
static void setAutoPull(const bool &autoPull)
Save automatic pull flag.
static auto getPassSigningKey(const QString &defaultValue=QVariant().toString()) -> QString
Get GPG signing key for pass.
static void setPassTemplate(const QString &passTemplate)
Save pass entry template.
static auto isUseSymbols(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether symbol characters are enabled.
static auto getQrencodeExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get qrencode executable path.
static auto getDialogSize(const QString &key, const QSize &defaultValue=QVariant().toSize()) -> QSize
Get saved dialog size.
static void setGpgExecutable(const QString &gpgExecutable)
Save GPG executable path.
static void setPos(const QPoint &pos)
Save window position.
static void setVersion(const QString &version)
Save application version.
static void setUseAutoclear(const bool &useAutoclear)
Save use autoclear setting.
static auto getRealPass() -> RealPass *
Get real pass backend instance.
static auto isLessRandom(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether less random password generation is enabled.
static void setAlwaysOnTop(const bool &alwaysOnTop)
Save always-on-top flag.
static auto getPassTemplate(const QString &defaultValue=QVariant().toString()) -> QString
Get pass entry template.
static void setWebDavUser(const QString &webDavUser)
Save WebDAV username.
static void setDisplayAsIs(const bool &displayAsIs)
Save display as-is setting.
static auto isMaximized(const bool &defaultValue=QVariant().toBool()) -> bool
Get maximized state.
static void setUseMonospace(const bool &useMonospace)
Save use monospace setting.
static void setDialogSize(const QString &key, const QSize &size)
Save dialog size.
static void setAvoidCapitals(const bool &avoidCapitals)
Save uppercase avoidance flag.
static void setDialogMaximized(const QString &key, const bool &maximized)
Save dialog maximized state.
static void setQrencodeExecutable(const QString &qrencodeExecutable)
Save qrencode executable path.
static void setWebDavUrl(const QString &webDavUrl)
Save WebDAV URL.
static auto getProfile(const QString &defaultValue=QVariant().toString()) -> QString
Get active profile name.
static auto getWebDavUrl(const QString &defaultValue=QVariant().toString()) -> QString
Get WebDAV URL.
static auto isUseMonospace(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use monospace font.
static void setAddGPGId(const bool &addGPGId)
Save add GPG ID setting.
static void setUsePass(const bool &usePass)
Save use pass setting.
static auto isUseWebDav(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether WebDAV integration is enabled.
static auto isDialogMaximized(const QString &key, const bool &defaultValue=QVariant().toBool()) -> bool
Get dialog maximized state.
static auto getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt()) -> int
Get panel autoclear delay in seconds.
static auto isUsePwgen(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether pwgen support is enabled.
static void setSavestate(const QByteArray &saveState)
Save window state.
static auto isAlwaysOnTop(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether main window should stay always on top.
static auto isAvoidNumbers(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether numeric characters should be avoided.
static auto isHidePassword(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to hide password in UI.
static void setDialogGeometry(const QString &key, const QByteArray &geometry)
Save dialog geometry.
static auto getPassExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pass executable path.
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
Save use autoclear panel setting.
static void setAutoclearSeconds(const int &autoClearSeconds)
Save autoclear seconds.
static void setNoLineWrapping(const bool &noLineWrapping)
Save no line wrapping setting.
static void setUseQrencode(const bool &useQrencode)
Save qrencode support flag.
static auto getPos(const QPoint &defaultValue=QVariant().toPoint()) -> QPoint
Get saved window position.
static void setAvoidNumbers(const bool &avoidNumbers)
Save numeric avoidance flag.
static auto getDialogGeometry(const QString &key, const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
Get saved dialog geometry.
static auto getImitatePass() -> ImitatePass *
Get imitate pass backend instance.
static auto isHideOnClose(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether closing the window hides the application.
static void setAutoPush(const bool &autoPush)
Save automatic push flag.
static void setClipBoardType(const int &clipBoardType)
Save clipboard type.
static auto getProfiles() -> QHash< QString, QHash< QString, QString > >
Get all configured profiles.
static void setSize(const QSize &size)
Save window size.
static void setLessRandom(const bool &lessRandom)
Save less-random generation flag.
static auto getAutoclearSeconds(const int &defaultValue=QVariant().toInt()) -> int
Get autoclear delay in seconds.
static void setHideContent(const bool &hideContent)
Save hide content setting.
static auto isAutoPush(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether automatic push is enabled.
static void setGeometry(const QByteArray &geometry)
Save window geometry.
static void setUseSelection(const bool &useSelection)
Save use selection setting.
static auto getClipBoardTypeRaw(const Enums::clipBoardType &defaultValue=Enums::CLIPBOARD_NEVER) -> int
Get clipboard type preference.
static auto getGitExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get git executable path.
static void setTemplateAllFields(const bool &templateAllFields)
Save template-all-fields flag.
static auto getGeometry(const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
Get saved window geometry.
static void setUseSymbols(const bool &useSymbols)
Save symbol usage flag.
static auto isDisplayAsIs(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to display password as-is (no modification).
static void setUseGit(const bool &useGit)
Save Git integration flag.
static auto getSavestate(const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
Get saved window state.
Implementation of Pass that wraps the 'pass' command-line tool.
clipBoardType
Defines when to copy passwords to clipboard.
Holds the Password configuration settings.