QtPass 1.5.1
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
qtpasssettings.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
3#ifndef SRC_QTPASSSETTINGS_H_
4#define SRC_QTPASSSETTINGS_H_
5
6#include "enums.h"
7#include "imitatepass.h"
9#include "realpass.h"
10#include "settingsconstants.h"
11
12#include <QByteArray>
13#include <QHash>
14#include <QPoint>
15#include <QSettings>
16#include <QSize>
17#include <QVariant>
18
23class QtPassSettings : public QSettings {
24private:
25 explicit QtPassSettings();
26
27 QtPassSettings(const QString &organization, const QSettings::Format format)
28 : QSettings(organization, format) {}
29 QtPassSettings(const QString &organization, const QString &application)
30 : QSettings(organization, application) {}
31
32 virtual ~QtPassSettings() {}
33
34 static bool initialized;
35 static QtPassSettings *m_instance;
36
37 static Pass *pass;
38 static QScopedPointer<RealPass> realPass;
39 static QScopedPointer<ImitatePass> imitatePass;
40
41public:
42 static auto getInstance() -> QtPassSettings *;
43
44 static auto getVersion(const QString &defaultValue = QVariant().toString())
45 -> QString;
46 static void setVersion(const QString &version);
47
48 static auto
49 getGeometry(const QByteArray &defaultValue = QVariant().toByteArray())
50 -> QByteArray;
51 static void setGeometry(const QByteArray &geometry);
52
53 static auto
54 getSavestate(const QByteArray &defaultValue = QVariant().toByteArray())
55 -> QByteArray;
56 static void setSavestate(const QByteArray &saveState);
57
58 static auto getPos(const QPoint &defaultValue = QVariant().toPoint())
59 -> QPoint;
60 static void setPos(const QPoint &pos);
61
62 static auto getSize(const QSize &defaultValue = QVariant().toSize()) -> QSize;
63 static void setSize(const QSize &size);
64
65 static auto isMaximized(const bool &defaultValue = QVariant().toBool())
66 -> bool;
67 static void setMaximized(const bool &maximized);
68
69 static auto isUsePass(const bool &defaultValue = QVariant().toBool()) -> bool;
70 static void setUsePass(const bool &usePass);
71
72 static auto getClipBoardTypeRaw(
73 const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER) -> int;
74 static auto getClipBoardType(
75 const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER)
77 static void setClipBoardType(const int &clipBoardType);
78
79 static auto isUseSelection(const bool &defaultValue = QVariant().toBool())
80 -> bool;
81 static void setUseSelection(const bool &useSelection);
82
83 static auto isUseAutoclear(const bool &defaultValue = QVariant().toBool())
84 -> bool;
85 static void setUseAutoclear(const bool &useAutoclear);
86
87 static auto getAutoclearSeconds(const int &defaultValue = QVariant().toInt())
88 -> int;
89 static void setAutoclearSeconds(const int &autoClearSeconds);
90
91 static auto
92 isUseAutoclearPanel(const bool &defaultValue = QVariant().toBool()) -> bool;
93 static void setUseAutoclearPanel(const bool &useAutoclearPanel);
94
95 static auto
96 getAutoclearPanelSeconds(const int &defaultValue = QVariant().toInt()) -> int;
97 static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds);
98
99 static auto isHidePassword(const bool &defaultValue = QVariant().toBool())
100 -> bool;
101 static void setHidePassword(const bool &hidePassword);
102
103 static auto isHideContent(const bool &defaultValue = QVariant().toBool())
104 -> bool;
105 static void setHideContent(const bool &hideContent);
106
107 static auto isUseMonospace(const bool &defaultValue = QVariant().toBool())
108 -> bool;
109 static void setUseMonospace(const bool &useMonospace);
110
111 static auto isDisplayAsIs(const bool &defaultValue = QVariant().toBool())
112 -> bool;
113 static void setDisplayAsIs(const bool &displayAsIs);
114
115 static auto isNoLineWrapping(const bool &defaultValue = QVariant().toBool())
116 -> bool;
117 static void setNoLineWrapping(const bool &noLineWrapping);
118
119 static auto isAddGPGId(const bool &defaultValue = QVariant().toBool())
120 -> bool;
121 static void setAddGPGId(const bool &addGPGId);
122
123 static auto getPassStore(const QString &defaultValue = QVariant().toString())
124 -> QString;
125 static void setPassStore(const QString &passStore);
126
127 static auto
128 getPassSigningKey(const QString &defaultValue = QVariant().toString())
129 -> QString;
130 static void setPassSigningKey(const QString &passSigningKey);
131
132 static void initExecutables();
133 static auto
134 getPassExecutable(const QString &defaultValue = QVariant().toString())
135 -> QString;
136 static void setPassExecutable(const QString &passExecutable);
137
138 static auto
139 getGitExecutable(const QString &defaultValue = QVariant().toString())
140 -> QString;
141 static void setGitExecutable(const QString &gitExecutable);
142
143 static auto
144 getGpgExecutable(const QString &defaultValue = QVariant().toString())
145 -> QString;
146 static void setGpgExecutable(const QString &gpgExecutable);
147
148 static auto
149 getPwgenExecutable(const QString &defaultValue = QVariant().toString())
150 -> QString;
151 static void setPwgenExecutable(const QString &pwgenExecutable);
152
153 static auto getGpgHome(const QString &defaultValue = QVariant().toString())
154 -> QString;
155
156 static auto isUseWebDav(const bool &defaultValue = QVariant().toBool())
157 -> bool;
158 static void setUseWebDav(const bool &useWebDav);
159
160 static auto getWebDavUrl(const QString &defaultValue = QVariant().toString())
161 -> QString;
162 static void setWebDavUrl(const QString &webDavUrl);
163
164 static auto getWebDavUser(const QString &defaultValue = QVariant().toString())
165 -> QString;
166 static void setWebDavUser(const QString &webDavUser);
167
168 static auto
169 getWebDavPassword(const QString &defaultValue = QVariant().toString())
170 -> QString;
171 static void setWebDavPassword(const QString &webDavPassword);
172
173 static auto getProfile(const QString &defaultValue = QVariant().toString())
174 -> QString;
175 static void setProfile(const QString &profile);
176
177 static auto isUseGit(const bool &defaultValue = QVariant().toBool()) -> bool;
178 static void setUseGit(const bool &useGit);
179
180 static auto isUseOtp(const bool &defaultValue = QVariant().toBool()) -> bool;
181 static void setUseOtp(const bool &useOtp);
182
183 static auto isUseQrencode(const bool &defaultValue = QVariant().toBool())
184 -> bool;
185 static void setUseQrencode(const bool &useQrencode);
186
187 static auto
188 getQrencodeExecutable(const QString &defaultValue = QVariant().toString())
189 -> QString;
190 static void setQrencodeExecutable(const QString &qrencodeExecutable);
191
192 static auto isUsePwgen(const bool &defaultValue = QVariant().toBool())
193 -> bool;
194 static void setUsePwgen(const bool &usePwgen);
195
196 static auto isAvoidCapitals(const bool &defaultValue = QVariant().toBool())
197 -> bool;
198 static void setAvoidCapitals(const bool &avoidCapitals);
199
200 static auto isAvoidNumbers(const bool &defaultValue = QVariant().toBool())
201 -> bool;
202 static void setAvoidNumbers(const bool &avoidNumbers);
203
204 static auto isLessRandom(const bool &defaultValue = QVariant().toBool())
205 -> bool;
206 static void setLessRandom(const bool &lessRandom);
207
208 static auto isUseSymbols(const bool &defaultValue = QVariant().toBool())
209 -> bool;
210 static void setUseSymbols(const bool &useSymbols);
211
213 static void setPasswordConfiguration(const PasswordConfiguration &config);
214 static void setPasswordLength(const int &passwordLength);
215 static void setPasswordCharsselection(const int &passwordCharsselection);
216 static void setPasswordChars(const QString &passwordChars);
217
218 static auto isUseTrayIcon(const bool &defaultValue = QVariant().toBool())
219 -> bool;
220 static void setUseTrayIcon(const bool &useTrayIcon);
221
222 static auto isHideOnClose(const bool &defaultValue = QVariant().toBool())
223 -> bool;
224 static void setHideOnClose(const bool &hideOnClose);
225
226 static auto isStartMinimized(const bool &defaultValue = QVariant().toBool())
227 -> bool;
228 static void setStartMinimized(const bool &startMinimized);
229
230 static auto isAlwaysOnTop(const bool &defaultValue = QVariant().toBool())
231 -> bool;
232 static void setAlwaysOnTop(const bool &alwaysOnTop);
233
234 static auto isAutoPull(const bool &defaultValue = QVariant().toBool())
235 -> bool;
236 static void setAutoPull(const bool &autoPull);
237
238 static auto isAutoPush(const bool &defaultValue = QVariant().toBool())
239 -> bool;
240 static void setAutoPush(const bool &autoPush);
241
242 static auto
243 getPassTemplate(const QString &defaultValue = QVariant().toString())
244 -> QString;
245 static void setPassTemplate(const QString &passTemplate);
246
247 static auto isUseTemplate(const bool &defaultValue = QVariant().toBool())
248 -> bool;
249 static void setUseTemplate(const bool &useTemplate);
250
251 static auto
252 isTemplateAllFields(const bool &defaultValue = QVariant().toBool()) -> bool;
253 static void setTemplateAllFields(const bool &templateAllFields);
254
255 static auto getProfiles() -> QHash<QString, QHash<QString, QString>>;
256 static void
257 setProfiles(const QHash<QString, QHash<QString, QString>> &profiles);
258
259 static auto getPass() -> Pass *;
260 static auto getRealPass() -> RealPass *;
261 static auto getImitatePass() -> ImitatePass *;
262};
263
264#endif // SRC_QTPASSSETTINGS_H_
Imitates pass features when pass is not enabled or available.
Definition imitatepass.h:13
Acts as an abstraction for pass or pass imitation.
Definition pass.h:20
Singleton that stores qtpass' settings, saves and loads config.
static auto isUseSelection(const bool &defaultValue=QVariant().toBool()) -> bool
static void setMaximized(const bool &maximized)
static void setStartMinimized(const bool &startMinimized)
static void setUseWebDav(const bool &useWebDav)
static auto isUseAutoclear(const bool &defaultValue=QVariant().toBool()) -> bool
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
static void setPassExecutable(const QString &passExecutable)
static auto getWebDavPassword(const QString &defaultValue=QVariant().toString()) -> QString
static auto isStartMinimized(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getClipBoardTypeRaw(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER) -> int
static void setHidePassword(const bool &hidePassword)
static auto isUseOtp(const bool &defaultValue=QVariant().toBool()) -> bool
static void setPwgenExecutable(const QString &pwgenExecutable)
static auto getPwgenExecutable(const QString &defaultValue=QVariant().toString()) -> QString
static void setProfile(const QString &profile)
static void setUseTrayIcon(const bool &useTrayIcon)
static void setWebDavPassword(const QString &webDavPassword)
static auto getInstance() -> QtPassSettings *
static auto isNoLineWrapping(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getWebDavUser(const QString &defaultValue=QVariant().toString()) -> QString
static void setPassStore(const QString &passStore)
static auto isHideContent(const bool &defaultValue=QVariant().toBool()) -> bool
static void setPasswordConfiguration(const PasswordConfiguration &config)
static auto getSize(const QSize &defaultValue=QVariant().toSize()) -> QSize
static void setHideOnClose(const bool &hideOnClose)
static auto getPass() -> Pass *
static auto getPasswordConfiguration() -> PasswordConfiguration
static auto getGpgHome(const QString &defaultValue=QVariant().toString()) -> QString
static auto isUseQrencode(const bool &defaultValue=QVariant().toBool()) -> bool
static void setPasswordLength(const int &passwordLength)
static auto isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool()) -> bool
static auto isAutoPull(const bool &defaultValue=QVariant().toBool()) -> bool
static void setGitExecutable(const QString &gitExecutable)
static void setPasswordChars(const QString &passwordChars)
static auto isUseGit(const bool &defaultValue=QVariant().toBool()) -> bool
static void setUseOtp(const bool &useOtp)
static void setProfiles(const QHash< QString, QHash< QString, QString > > &profiles)
static void setUsePwgen(const bool &usePwgen)
static auto isTemplateAllFields(const bool &defaultValue=QVariant().toBool()) -> bool
static void setPassSigningKey(const QString &passSigningKey)
static auto isUsePass(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getPassStore(const QString &defaultValue=QVariant().toString()) -> QString
static auto getVersion(const QString &defaultValue=QVariant().toString()) -> QString
static void setPasswordCharsselection(const int &passwordCharsselection)
static auto isUseTemplate(const bool &defaultValue=QVariant().toBool()) -> bool
static auto isUseTrayIcon(const bool &defaultValue=QVariant().toBool()) -> bool
static void initExecutables()
static void setUseTemplate(const bool &useTemplate)
static auto isAvoidCapitals(const bool &defaultValue=QVariant().toBool()) -> bool
static auto isAddGPGId(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getGpgExecutable(const QString &defaultValue=QVariant().toString()) -> QString
static void setAutoPull(const bool &autoPull)
static auto getPassSigningKey(const QString &defaultValue=QVariant().toString()) -> QString
static void setPassTemplate(const QString &passTemplate)
static auto isUseSymbols(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getQrencodeExecutable(const QString &defaultValue=QVariant().toString()) -> QString
static void setGpgExecutable(const QString &gpgExecutable)
static void setPos(const QPoint &pos)
static void setVersion(const QString &version)
static void setUseAutoclear(const bool &useAutoclear)
static auto getRealPass() -> RealPass *
static auto isLessRandom(const bool &defaultValue=QVariant().toBool()) -> bool
static void setAlwaysOnTop(const bool &alwaysOnTop)
static auto getPassTemplate(const QString &defaultValue=QVariant().toString()) -> QString
static void setWebDavUser(const QString &webDavUser)
static void setDisplayAsIs(const bool &displayAsIs)
static auto getClipBoardType(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER) -> Enums::clipBoardType
static auto isMaximized(const bool &defaultValue=QVariant().toBool()) -> bool
static void setUseMonospace(const bool &useMonospace)
static void setAvoidCapitals(const bool &avoidCapitals)
static void setQrencodeExecutable(const QString &qrencodeExecutable)
static void setWebDavUrl(const QString &webDavUrl)
static auto getProfile(const QString &defaultValue=QVariant().toString()) -> QString
static auto getWebDavUrl(const QString &defaultValue=QVariant().toString()) -> QString
static auto isUseMonospace(const bool &defaultValue=QVariant().toBool()) -> bool
static void setAddGPGId(const bool &addGPGId)
static void setUsePass(const bool &usePass)
static auto isUseWebDav(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt()) -> int
static auto isUsePwgen(const bool &defaultValue=QVariant().toBool()) -> bool
static void setSavestate(const QByteArray &saveState)
static auto isAlwaysOnTop(const bool &defaultValue=QVariant().toBool()) -> bool
static auto isAvoidNumbers(const bool &defaultValue=QVariant().toBool()) -> bool
static auto isHidePassword(const bool &defaultValue=QVariant().toBool()) -> bool
static auto getPassExecutable(const QString &defaultValue=QVariant().toString()) -> QString
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
static void setAutoclearSeconds(const int &autoClearSeconds)
static void setNoLineWrapping(const bool &noLineWrapping)
static void setUseQrencode(const bool &useQrencode)
static auto getPos(const QPoint &defaultValue=QVariant().toPoint()) -> QPoint
static void setAvoidNumbers(const bool &avoidNumbers)
static auto getImitatePass() -> ImitatePass *
static auto isHideOnClose(const bool &defaultValue=QVariant().toBool()) -> bool
static void setAutoPush(const bool &autoPush)
static void setClipBoardType(const int &clipBoardType)
static auto getProfiles() -> QHash< QString, QHash< QString, QString > >
static void setSize(const QSize &size)
static void setLessRandom(const bool &lessRandom)
static auto getAutoclearSeconds(const int &defaultValue=QVariant().toInt()) -> int
static void setHideContent(const bool &hideContent)
static auto isAutoPush(const bool &defaultValue=QVariant().toBool()) -> bool
static void setGeometry(const QByteArray &geometry)
static void setUseSelection(const bool &useSelection)
static auto getGitExecutable(const QString &defaultValue=QVariant().toString()) -> QString
static void setTemplateAllFields(const bool &templateAllFields)
static auto getGeometry(const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
static void setUseSymbols(const bool &useSymbols)
static auto isDisplayAsIs(const bool &defaultValue=QVariant().toBool()) -> bool
static void setUseGit(const bool &useGit)
static auto getSavestate(const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
Wrapper for executing pass to handle the password-store.
Definition realpass.h:12
clipBoardType
Definition enums.h:12
@ CLIPBOARD_NEVER
Definition enums.h:13
Holds the Password configuration settings.