QtPass  1.2.0
Multi-platform GUI for pass, the standard unix password manager.
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"
6 #include "pass.h"
7 #include "realpass.h"
8 #include <QByteArray>
9 #include <QCoreApplication>
10 #include <QDir>
11 #include <QFile>
12 #include <QHash>
13 #include <QObject>
14 #include <QPoint>
15 #include <QSettings>
16 #include <QSize>
17 #include <QVariant>
18 
24 
25 public:
26  static QString
27  getVersion(const QString &defaultValue = QVariant().toString());
28  static void setVersion(const QString &version);
29 
30  static QByteArray
31  getGeometry(const QByteArray &defaultValue = QVariant().toByteArray());
32  static void setGeometry(const QByteArray &geometry);
33 
34  static QByteArray
35  getSavestate(const QByteArray &defaultValue = QVariant().toByteArray());
36  static void setSavestate(const QByteArray &saveState);
37 
38  static QPoint getPos(const QPoint &defaultValue = QVariant().toPoint());
39  static void setPos(const QPoint &pos);
40 
41  static QSize getSize(const QSize &defaultValue = QVariant().toSize());
42  static void setSize(const QSize &size);
43 
44  static int getSplitterLeft(const int &defaultValue = QVariant().toInt());
45  static void setSplitterLeft(const int &splitterLeft);
46 
47  static int getSplitterRight(const int &defaultValue = QVariant().toInt());
48  static void setSplitterRight(const int &splitterRight);
49 
50  static bool isMaximized(const bool &defaultValue = QVariant().toBool());
51  static void setMaximized(const bool &maximized);
52 
53  static bool isUsePass(const bool &defaultValue = QVariant().toBool());
54  static void setUsePass(const bool &usePass);
55 
57  const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER);
59 
60  static bool isUseSelection(const bool &defaultValue = QVariant().toBool());
61  static void setUseSelection(const bool &useSelection);
62 
63  static bool isUseAutoclear(const bool &defaultValue = QVariant().toBool());
64  static void setUseAutoclear(const bool &useAutoclear);
65 
66  static int getAutoclearSeconds(const int &defaultValue = QVariant().toInt());
67  static void setAutoclearSeconds(const int &autoClearSeconds);
68 
69  static bool
70  isUseAutoclearPanel(const bool &defaultValue = QVariant().toBool());
71  static void setUseAutoclearPanel(const bool &useAutoclearPanel);
72 
73  static int
74  getAutoclearPanelSeconds(const int &defaultValue = QVariant().toInt());
75  static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds);
76 
77  static bool isHidePassword(const bool &defaultValue = QVariant().toBool());
78  static void setHidePassword(const bool &hidePassword);
79 
80  static bool isHideContent(const bool &defaultValue = QVariant().toBool());
81  static void setHideContent(const bool &hideContent);
82 
83  static bool isAddGPGId(const bool &defaultValue = QVariant().toBool());
84  static void setAddGPGId(const bool &addGPGId);
85 
86  static QString
87  getPassStore(const QString &defaultValue = QVariant().toString());
88  static void setPassStore(const QString &passStore);
89 
90  static QString
91  getPassExecutable(const QString &defaultValue = QVariant().toString());
92  static void setPassExecutable(const QString &passExecutable);
93 
94  static QString
95  getGitExecutable(const QString &defaultValue = QVariant().toString());
96  static void setGitExecutable(const QString &gitExecutable);
97 
98  static QString
99  getGpgExecutable(const QString &defaultValue = QVariant().toString());
100  static void setGpgExecutable(const QString &gpgExecutable);
101 
102  static QString
103  getPwgenExecutable(const QString &defaultValue = QVariant().toString());
104  static void setPwgenExecutable(const QString &pwgenExecutable);
105 
106  static QString
107  getGpgHome(const QString &defaultValue = QVariant().toString());
108  static void setGpgHome(const QString &gpgHome);
109 
110  static bool isUseWebDav(const bool &defaultValue = QVariant().toBool());
111  static void setUseWebDav(const bool &useWebDav);
112 
113  static QString
114  getWebDavUrl(const QString &defaultValue = QVariant().toString());
115  static void setWebDavUrl(const QString &webDavUrl);
116 
117  static QString
118  getWebDavUser(const QString &defaultValue = QVariant().toString());
119  static void setWebDavUser(const QString &webDavUser);
120 
121  static QString
122  getWebDavPassword(const QString &defaultValue = QVariant().toString());
123  static void setWebDavPassword(const QString &webDavPassword);
124 
125  static QString
126  getProfile(const QString &defaultValue = QVariant().toString());
127  static void setProfile(const QString &profile);
128 
129  static bool isUseGit(const bool &defaultValue = QVariant().toBool());
130  static void setUseGit(const bool &useGit);
131 
132  static bool isUsePwgen(const bool &defaultValue = QVariant().toBool());
133  static void setUsePwgen(const bool &usePwgen);
134 
135  static bool isAvoidCapitals(const bool &defaultValue = QVariant().toBool());
136  static void setAvoidCapitals(const bool &avoidCapitals);
137 
138  static bool isAvoidNumbers(const bool &defaultValue = QVariant().toBool());
139  static void setAvoidNumbers(const bool &avoidNumbers);
140 
141  static bool isLessRandom(const bool &defaultValue = QVariant().toBool());
142  static void setLessRandom(const bool &lessRandom);
143 
144  static bool isUseSymbols(const bool &defaultValue = QVariant().toBool());
145  static void setUseSymbols(const bool &useSymbols);
146 
147  static int getPasswordLength(const int &defaultValue = QVariant().toInt());
148  static void setPasswordLength(const int &passwordLength);
149 
150  static int
151  getPasswordCharsselection(const int &defaultValue = QVariant().toInt());
152  static void setPasswordCharsselection(const int &passwordCharsselection);
153 
154  static QString
155  getPasswordChars(const QString &defaultValue = QVariant().toString());
156  static void setPasswordChars(const QString &passwordChars);
157 
158  static bool isUseTrayIcon(const bool &defaultValue = QVariant().toBool());
159  static void setUseTrayIcon(const bool &useTrayIcon);
160 
161  static bool isHideOnClose(const bool &defaultValue = QVariant().toBool());
162  static void setHideOnClose(const bool &hideOnClose);
163 
164  static bool isStartMinimized(const bool &defaultValue = QVariant().toBool());
165  static void setStartMinimized(const bool &startMinimized);
166 
167  static bool isAlwaysOnTop(const bool &defaultValue = QVariant().toBool());
168  static void setAlwaysOnTop(const bool &alwaysOnTop);
169 
170  static bool isAutoPull(const bool &defaultValue = QVariant().toBool());
171  static void setAutoPull(const bool &autoPull);
172 
173  static bool isAutoPush(const bool &defaultValue = QVariant().toBool());
174  static void setAutoPush(const bool &autoPush);
175 
176  static QString
177  getPassTemplate(const QString &defaultValue = QVariant().toString());
178  static void setPassTemplate(const QString &passTemplate);
179 
180  static bool isUseTemplate(const bool &defaultValue = QVariant().toBool());
181  static void setUseTemplate(const bool &useTemplate);
182 
183  static bool
184  isTemplateAllFields(const bool &defaultValue = QVariant().toBool());
185  static void setTemplateAllFields(const bool &templateAllFields);
186 
187  static QHash<QString, QString> getProfiles();
188  static void setProfiles(const QHash<QString, QString> &profiles);
189 
190  static Pass *getPass();
191  static RealPass *getRealPass();
192  static ImitatePass *getImitatePass();
193 
194 signals:
195 
196 public slots:
197 
198 private:
199  // constructor
200  explicit QtPassSettings();
201 
202  static bool initialized;
203  // member
204  static QScopedPointer<QSettings> settings;
205 
206  static QHash<QString, QString> stringSettings;
207  static QHash<QString, QByteArray> byteArraySettings;
208  static QHash<QString, QPoint> pointSettings;
209  static QHash<QString, QSize> sizeSettings;
210  static QHash<QString, int> intSettings;
211  static QHash<QString, bool> boolSettings;
212 
213  static Pass *pass;
214  static RealPass realPass;
215  static ImitatePass imitatePass;
216 
217  // functions
218  static QSettings &getSettings();
219 
220  static QString getStringValue(const QString &key,
221  const QString &defaultValue);
222  static int getIntValue(const QString &key, const int &defaultValue);
223  static bool getBoolValue(const QString &key, const bool &defaultValue);
224  static QByteArray getByteArrayValue(const QString &key,
225  const QByteArray &defaultValue);
226  static QPoint getPointValue(const QString &key, const QPoint &defaultValue);
227  static QSize getSizeValue(const QString &key, const QSize &defaultValue);
228 
229  static void setStringValue(const QString &key, const QString &stringValue);
230  static void setIntValue(const QString &key, const int &intValue);
231  static void setBoolValue(const QString &key, const bool &boolValue);
232  static void setByteArrayValue(const QString &key,
233  const QByteArray &byteArrayValue);
234  static void setPointValue(const QString &key, const QPoint &pointValue);
235  static void setSizeValue(const QString &key, const QSize &sizeValue);
236 
237  static QStringList getChildKeysFromCurrentGroup();
238  static void beginSettingsGroup(const QString &groupName);
239  static void endSettingsGroup();
240 
241  static void beginMainwindowGroup();
242  static void beginProfilesGroup();
243 
244  static QVariant getSetting(const QString &key,
245  const QVariant &defaultValue = QVariant());
246  static void setSetting(const QString &key, const QVariant &value);
247 };
248 
249 #endif // QTPASSSETTINGS_H
static void setPwgenExecutable(const QString &pwgenExecutable)
static void setAutoclearSeconds(const int &autoClearSeconds)
static int getAutoclearSeconds(const int &defaultValue=QVariant().toInt())
static void setUsePwgen(const bool &usePwgen)
static bool isStartMinimized(const bool &defaultValue=QVariant().toBool())
static bool isMaximized(const bool &defaultValue=QVariant().toBool())
static void setUsePass(const bool &usePass)
static bool isLessRandom(const bool &defaultValue=QVariant().toBool())
static void setPassExecutable(const QString &passExecutable)
static void setSplitterLeft(const int &splitterLeft)
static QString getGpgHome(const QString &defaultValue=QVariant().toString())
static bool isAlwaysOnTop(const bool &defaultValue=QVariant().toBool())
static QPoint getPos(const QPoint &defaultValue=QVariant().toPoint())
static void setWebDavPassword(const QString &webDavPassword)
static void setPasswordChars(const QString &passwordChars)
static void setAutoPush(const bool &autoPush)
static void setGitExecutable(const QString &gitExecutable)
static void setAlwaysOnTop(const bool &alwaysOnTop)
static bool isUseSelection(const bool &defaultValue=QVariant().toBool())
static void setPassTemplate(const QString &passTemplate)
static QString getPasswordChars(const QString &defaultValue=QVariant().toString())
static void setUseGit(const bool &useGit)
static void setClipBoardType(const Enums::clipBoardType &clipBoardType)
static void setPos(const QPoint &pos)
static bool isAvoidNumbers(const bool &defaultValue=QVariant().toBool())
static ImitatePass * getImitatePass()
static void setHideContent(const bool &hideContent)
static bool isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool())
static void setUseWebDav(const bool &useWebDav)
static bool isUseWebDav(const bool &defaultValue=QVariant().toBool())
static void setSize(const QSize &size)
static void setLessRandom(const bool &lessRandom)
static void setAutoPull(const bool &autoPull)
static void setSplitterRight(const int &splitterRight)
static bool isAddGPGId(const bool &defaultValue=QVariant().toBool())
static bool isUseAutoclear(const bool &defaultValue=QVariant().toBool())
Wrapper for executing pass to handle the password-store.
Definition: realpass.h:10
static bool isHideOnClose(const bool &defaultValue=QVariant().toBool())
static void setProfiles(const QHash< QString, QString > &profiles)
static bool isUseGit(const bool &defaultValue=QVariant().toBool())
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
static QString getPassStore(const QString &defaultValue=QVariant().toString())
static void setProfile(const QString &profile)
static void setMaximized(const bool &maximized)
static QString getGitExecutable(const QString &defaultValue=QVariant().toString())
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
clipBoardType
Definition: enums.h:10
static bool isUseTrayIcon(const bool &defaultValue=QVariant().toBool())
static void setAvoidNumbers(const bool &avoidNumbers)
static QString getPassExecutable(const QString &defaultValue=QVariant().toString())
static QString getVersion(const QString &defaultValue=QVariant().toString())
static void setHideOnClose(const bool &hideOnClose)
static bool isAvoidCapitals(const bool &defaultValue=QVariant().toBool())
static QByteArray getSavestate(const QByteArray &defaultValue=QVariant().toByteArray())
static QSize getSize(const QSize &defaultValue=QVariant().toSize())
static Pass * getPass()
static void setGpgExecutable(const QString &gpgExecutable)
static QString getWebDavUser(const QString &defaultValue=QVariant().toString())
Imitates pass features when pass is not enabled or available.
Definition: imitatepass.h:11
static void setStartMinimized(const bool &startMinimized)
static bool isUsePwgen(const bool &defaultValue=QVariant().toBool())
static void setSavestate(const QByteArray &saveState)
static void setUseAutoclear(const bool &useAutoclear)
static QString getPassTemplate(const QString &defaultValue=QVariant().toString())
static Enums::clipBoardType getClipBoardType(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
static QString getWebDavUrl(const QString &defaultValue=QVariant().toString())
static QString getPwgenExecutable(const QString &defaultValue=QVariant().toString())
static bool isUseSymbols(const bool &defaultValue=QVariant().toBool())
static void setUseTemplate(const bool &useTemplate)
static QByteArray getGeometry(const QByteArray &defaultValue=QVariant().toByteArray())
static void setPasswordCharsselection(const int &passwordCharsselection)
static int getSplitterRight(const int &defaultValue=QVariant().toInt())
static int getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt())
static void setAddGPGId(const bool &addGPGId)
static QString getGpgExecutable(const QString &defaultValue=QVariant().toString())
static void setWebDavUrl(const QString &webDavUrl)
static bool isUseTemplate(const bool &defaultValue=QVariant().toBool())
static QString getWebDavPassword(const QString &defaultValue=QVariant().toString())
static bool isTemplateAllFields(const bool &defaultValue=QVariant().toBool())
static void setUseSymbols(const bool &useSymbols)
Singleton that stores qtpass&#39; settings, saves and loads config.
static void setTemplateAllFields(const bool &templateAllFields)
static QHash< QString, QString > getProfiles()
static void setUseTrayIcon(const bool &useTrayIcon)
static void setGeometry(const QByteArray &geometry)
static int getSplitterLeft(const int &defaultValue=QVariant().toInt())
static RealPass * getRealPass()
static bool isHidePassword(const bool &defaultValue=QVariant().toBool())
static bool isHideContent(const bool &defaultValue=QVariant().toBool())
static QString getProfile(const QString &defaultValue=QVariant().toString())
static void setWebDavUser(const QString &webDavUser)
static void setVersion(const QString &version)
static void setHidePassword(const bool &hidePassword)
static void setPassStore(const QString &passStore)
static void setUseSelection(const bool &useSelection)
static void setPasswordLength(const int &passwordLength)
static void setGpgHome(const QString &gpgHome)
static int getPasswordCharsselection(const int &defaultValue=QVariant().toInt())
static int getPasswordLength(const int &defaultValue=QVariant().toInt())
static bool isAutoPull(const bool &defaultValue=QVariant().toBool())
static bool isUsePass(const bool &defaultValue=QVariant().toBool())
static bool isAutoPush(const bool &defaultValue=QVariant().toBool())
static void setAvoidCapitals(const bool &avoidCapitals)