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