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