|
QtPass 2.0.0
Developer documentation
|
Singleton that stores QtPass settings, handles persistence and defaults. More...
#include <qtpasssettings.h>
Public Member Functions | |
| QtPassSettings ()=delete | |
| Deleted: QtPassSettings is used through its static functions and never instantiated. Public, so that a call names the deletion rather than the access. | |
Static Public Member Functions | |
| static auto | getInstance () -> QtPassSettings * |
| Get the singleton instance. | |
| static auto | load () -> AppSettings |
| Load all flat settings into an AppSettings value object. | |
| static auto | loadEffective () -> AppSettings |
| load() with the active profile's own Git flags applied: what the backends and the Git actions run with. | |
| static void | takeProfileOfStore (AppSettings &settings, const Profiles &profiles) |
Make settings use the profile whose store it opens. | |
| static void | save (const AppSettings &settings) |
| Persist an AppSettings value object to the singleton store. | |
| static auto | getVersion (const QString &defaultValue=QVariant().toString()) -> QString |
| Get saved application version. | |
| static void | setVersion (const QString &version) |
| Save application version. | |
| static auto | getGeometry (const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray |
| Get saved window geometry. | |
| static void | setGeometry (const QByteArray &geometry) |
| Save window geometry. | |
| static auto | getSavestate (const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray |
| Get saved window state. | |
| static void | setSavestate (const QByteArray &saveState) |
| Save window state. | |
| static auto | getDialogGeometry (const QString &key, const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray |
| Get saved dialog geometry. | |
| static void | setDialogGeometry (const QString &key, const QByteArray &geometry) |
| Save dialog geometry. | |
| static void | setUsePass (const bool &usePass) |
| Save use pass setting. | |
| static auto | getAutoclearSeconds (const int &defaultValue=QVariant().toInt()) -> int |
| Get autoclear delay in seconds. | |
| static auto | getPassStore (const QString &defaultValue=QVariant().toString()) -> QString |
| Get password store directory path. | |
| static void | setPassStore (const QString &passStore) |
| Save password store path. | |
| static void | initExecutables () |
| Initialize executable paths by auto-detecting them. | |
| static auto | getPassExecutable (const QString &defaultValue=QVariant().toString()) -> QString |
| Get pass executable path. | |
| static auto | getProfile (const QString &defaultValue=QVariant().toString()) -> QString |
| Get active profile name. | |
| static auto | isUseGit (const bool &defaultValue=QVariant().toBool()) -> bool |
| Check whether Git integration is enabled. | |
| static auto | isUseGrepSearch (const bool &defaultValue=false) -> bool |
| Check whether content search is enabled. | |
| static auto | isUseOtp (const bool &defaultValue=true) -> bool |
| Check whether OTP support is enabled. | |
| static void | setQrencodeExecutable (const QString &qrencodeExecutable) |
| Save qrencode executable path. | |
| static auto | getPasswordConfiguration () -> PasswordConfiguration |
| Get complete password generation configuration. | |
| static auto | isHideOnClose (const bool &defaultValue=QVariant().toBool()) -> bool |
| Check whether closing the window hides the application. | |
| static auto | isAlwaysOnTop (const bool &defaultValue=QVariant().toBool()) -> bool |
| Check whether main window should stay always on top. | |
| static auto | isAutoPush (const bool &defaultValue=QVariant().toBool()) -> bool |
| Check whether automatic push is enabled. | |
| static auto | isShowProcessOutput (const bool &defaultValue=false) -> bool |
| Get showProcessOutput setting. | |
| static auto | getProfiles () -> Profiles |
| Get all configured profiles. | |
| static void | setProfiles (const Profiles &profiles) |
| Save all configured profiles. | |
| static auto | getPass () -> Pass * |
| Get currently active pass backend instance. | |
| static auto | getRealPass () -> RealPass * |
| Get real pass backend instance. | |
| static auto | getImitatePass () -> ImitatePass * |
| Get imitate pass backend instance. | |
| static auto | backendsIdle () -> bool |
| Whether no backend, the active one or one kept from before a switch, runs or waits for anything (PassBackendFactory::isIdle()). | |
Private Member Functions | |
| QtPassSettings (const QString &organization, const QSettings::Format format) | |
| Settings in an explicit file: the portable qtpass.ini next to the executable, which getInstance() prefers when it exists. | |
| QtPassSettings (const QString &organization, const QString &application) | |
| Per-user settings in QSettings::defaultFormat(). | |
Static Private Member Functions | |
| static auto | activeProfileFlag (std::optional< bool > Profile::*flag) -> std::optional< bool > |
| The active profile's own value of a Git flag. | |
Static Private Attributes | |
| static bool | initialized = false |
| Whether getInstance() has chosen the store and built m_instance. | |
| static QtPassSettings * | m_instance = nullptr |
Singleton that stores QtPass settings, handles persistence and defaults.
QtPassSettings manages all application configuration including:
Uses QSettings for persistence with a singleton pattern. All getters accept a default value returned when setting is not yet saved.
Definition at line 44 of file qtpasssettings.h.
|
explicitdelete |
Deleted: QtPassSettings is used through its static functions and never instantiated. Public, so that a call names the deletion rather than the access.
|
inlineprivate |
Settings in an explicit file: the portable qtpass.ini next to the executable, which getInstance() prefers when it exists.
| organization | The file's path (QSettings' file-name constructor). |
| format | The file's format; IniFormat for the portable file. |
Definition at line 60 of file qtpasssettings.h.
|
inlineprivate |
Per-user settings in QSettings::defaultFormat().
QSettings(organization, application) ignores setDefaultFormat() and always uses NativeFormat; going through the explicit-format constructor keeps the production default (NativeFormat) while letting the test suites redirect settings to an ini file in a temporary directory.
| organization | The organisation the settings are filed under ("IJHack"). |
| application | The application name ("QtPass"). |
Definition at line 73 of file qtpasssettings.h.
|
staticprivate |
The active profile's own value of a Git flag.
| flag | Profile::useGit, autoPush or autoPull. |
Definition at line 57 of file qtpasssettings.cpp.
|
static |
Whether no backend, the active one or one kept from before a switch, runs or waits for anything (PassBackendFactory::isIdle()).
Definition at line 398 of file qtpasssettings.cpp.
|
static |
Get autoclear delay in seconds.
| defaultValue | Integer returned if not saved. |
Definition at line 278 of file qtpasssettings.cpp.
|
static |
Get saved dialog geometry.
| key | Dialog identifier (e.g., "usersDialog"). |
| defaultValue | Byte array returned if not saved. |
Definition at line 259 of file qtpasssettings.cpp.
|
static |
Get saved window geometry.
| defaultValue | Byte array returned if no geometry saved. |
Definition at line 240 of file qtpasssettings.cpp.
|
static |
Get imitate pass backend instance.
Definition at line 394 of file qtpasssettings.cpp.
|
static |
Get the singleton instance.
Definition at line 31 of file qtpasssettings.cpp.
|
static |
Get currently active pass backend instance.
Definition at line 227 of file qtpasssettings.cpp.
|
static |
Get pass executable path.
| defaultValue | String returned if not saved. |
Definition at line 323 of file qtpasssettings.cpp.
|
static |
Get password store directory path.
| defaultValue | String returned if not saved. |
Definition at line 284 of file qtpasssettings.cpp.
|
static |
Get complete password generation configuration.
Definition at line 165 of file qtpasssettings.cpp.
|
static |
Get active profile name.
| defaultValue | String returned if not saved. |
Definition at line 329 of file qtpasssettings.cpp.
|
static |
Get all configured profiles.
Definition at line 169 of file qtpasssettings.cpp.
|
static |
Get real pass backend instance.
Definition at line 391 of file qtpasssettings.cpp.
|
static |
Get saved window state.
| defaultValue | Byte array returned if no state saved. |
Definition at line 249 of file qtpasssettings.cpp.
|
static |
Get saved application version.
| defaultValue | String returned if no version saved. |
Definition at line 231 of file qtpasssettings.cpp.
|
static |
Initialize executable paths by auto-detecting them.
Definition at line 308 of file qtpasssettings.cpp.
|
static |
Check whether main window should stay always on top.
| defaultValue | Value returned if not saved. |
Definition at line 371 of file qtpasssettings.cpp.
|
static |
Check whether automatic push is enabled.
| defaultValue | Value returned if not saved. |
Definition at line 377 of file qtpasssettings.cpp.
|
static |
Check whether closing the window hides the application.
| defaultValue | Value returned if not saved. |
Definition at line 366 of file qtpasssettings.cpp.
|
static |
Get showProcessOutput setting.
| defaultValue | Default value if not set. |
Definition at line 386 of file qtpasssettings.cpp.
|
static |
Check whether Git integration is enabled.
| defaultValue | Value returned if not saved. |
Definition at line 335 of file qtpasssettings.cpp.
|
static |
Check whether content search is enabled.
| defaultValue | Value returned if not saved (defaults to false). |
Definition at line 351 of file qtpasssettings.cpp.
|
static |
Check whether OTP support is enabled.
| defaultValue | Value returned if not saved (defaults to true). |
Definition at line 357 of file qtpasssettings.cpp.
|
static |
Load all flat settings into an AppSettings value object.
Convenience facade over SettingsSerializer using the singleton store. Note: nested/keyed settings (profiles, per-dialog geometry) are not part of AppSettings and still use their dedicated accessors.
Definition at line 47 of file qtpasssettings.cpp.
|
static |
load() with the active profile's own Git flags applied: what the backends and the Git actions run with.
load() keeps the Git page's values, which every profile without flags of its own falls back to. Never save() this: the profile's flags would replace the Git page's for every other profile.
Definition at line 147 of file qtpasssettings.cpp.
|
static |
Persist an AppSettings value object to the singleton store.
Writes via SettingsSerializer and invalidates the cached Pass backend so a changed "use pass" mode takes effect on the next getPass().
| settings | Values to save. |
Definition at line 159 of file qtpasssettings.cpp.
|
static |
Save dialog geometry.
| key | Dialog identifier. |
| geometry | Dialog geometry to save. |
Definition at line 266 of file qtpasssettings.cpp.
|
static |
Save window geometry.
| geometry | Window geometry to save. |
Definition at line 245 of file qtpasssettings.cpp.
|
static |
Save password store path.
| passStore | Path to password store. |
Definition at line 305 of file qtpasssettings.cpp.
|
static |
Save all configured profiles.
| profiles | Profile map keyed by profile name. |
Definition at line 201 of file qtpasssettings.cpp.
|
static |
Save qrencode executable path.
| qrencodeExecutable | Path to qrencode executable. |
Definition at line 361 of file qtpasssettings.cpp.
|
static |
Save window state.
| saveState | Window state to save. |
Definition at line 255 of file qtpasssettings.cpp.
|
static |
Save use pass setting.
| usePass | true to use pass, false for GPG. |
Definition at line 272 of file qtpasssettings.cpp.
|
static |
Save application version.
| version | Version string to save. |
Definition at line 236 of file qtpasssettings.cpp.
|
static |
Make settings use the profile whose store it opens.
A store folder typed in the first-run wizard or in Settings kept the profile, and so the signing key, that was active before: a signed profile's store typed under an unsigned profile was opened with every .gpg-id check off. When settings.passStore is a profile's store, that profile becomes active with its signing key (of several on one folder: the active one, else one with a signing key, else the first by name). A folder inside or above a signed profile's store is not looked at: a signed list names the folder it was written for, so a store opened inside another with that store's key would refuse its lists.
| settings | The settings to adjust; passStore is read. |
| profiles | The profiles to look in. |
Definition at line 116 of file qtpasssettings.cpp.
|
staticprivate |
Whether getInstance() has chosen the store and built m_instance.
Definition at line 80 of file qtpasssettings.h.
|
staticprivate |
The one instance, built on the first getInstance() and kept for the life of the process.
Definition at line 83 of file qtpasssettings.h.