QtPass  1.3.2
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 #include "settingsconstants.h"
9 
10 #include <QByteArray>
11 #include <QHash>
12 #include <QPoint>
13 #include <QSettings>
14 #include <QSize>
15 #include <QVariant>
16 
21 class QtPassSettings : public QSettings {
22 private:
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 
39 public:
40  static QtPassSettings *getInstance();
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 isAddGPGId(const bool &defaultValue = QVariant().toBool());
96  static void setAddGPGId(const bool &addGPGId);
97 
98  static QString
99  getPassStore(const QString &defaultValue = QVariant().toString());
100  static void setPassStore(const QString &passStore);
101 
102  static void initExecutables();
103  static QString
104  getPassExecutable(const QString &defaultValue = QVariant().toString());
105  static void setPassExecutable(const QString &passExecutable);
106 
107  static QString
108  getGitExecutable(const QString &defaultValue = QVariant().toString());
109  static void setGitExecutable(const QString &gitExecutable);
110 
111  static QString
112  getGpgExecutable(const QString &defaultValue = QVariant().toString());
113  static void setGpgExecutable(const QString &gpgExecutable);
114 
115  static QString
116  getPwgenExecutable(const QString &defaultValue = QVariant().toString());
117  static void setPwgenExecutable(const QString &pwgenExecutable);
118 
119  static QString
120  getGpgHome(const QString &defaultValue = QVariant().toString());
121 
122  static bool isUseWebDav(const bool &defaultValue = QVariant().toBool());
123  static void setUseWebDav(const bool &useWebDav);
124 
125  static QString
126  getWebDavUrl(const QString &defaultValue = QVariant().toString());
127  static void setWebDavUrl(const QString &webDavUrl);
128 
129  static QString
130  getWebDavUser(const QString &defaultValue = QVariant().toString());
131  static void setWebDavUser(const QString &webDavUser);
132 
133  static QString
134  getWebDavPassword(const QString &defaultValue = QVariant().toString());
135  static void setWebDavPassword(const QString &webDavPassword);
136 
137  static QString
138  getProfile(const QString &defaultValue = QVariant().toString());
139  static void setProfile(const QString &profile);
140 
141  static bool isUseGit(const bool &defaultValue = QVariant().toBool());
142  static void setUseGit(const bool &useGit);
143 
144  static bool isUseOtp(const bool &defaultValue = QVariant().toBool());
145  static void setUseOtp(const bool &useOtp);
146 
147  static bool isUseQrencode(const bool &defaultValue = QVariant().toBool());
148  static void setUseQrencode(const bool &useQrencode);
149 
150  static bool isUsePwgen(const bool &defaultValue = QVariant().toBool());
151  static void setUsePwgen(const bool &usePwgen);
152 
153  static bool isAvoidCapitals(const bool &defaultValue = QVariant().toBool());
154  static void setAvoidCapitals(const bool &avoidCapitals);
155 
156  static bool isAvoidNumbers(const bool &defaultValue = QVariant().toBool());
157  static void setAvoidNumbers(const bool &avoidNumbers);
158 
159  static bool isLessRandom(const bool &defaultValue = QVariant().toBool());
160  static void setLessRandom(const bool &lessRandom);
161 
162  static bool isUseSymbols(const bool &defaultValue = QVariant().toBool());
163  static void setUseSymbols(const bool &useSymbols);
164 
166  static void setPasswordConfiguration(const PasswordConfiguration &config);
167  static void setPasswordLength(const int &passwordLength);
168  static void setPasswordCharsselection(const int &passwordCharsselection);
169  static void setPasswordChars(const QString &passwordChars);
170 
171  static bool isUseTrayIcon(const bool &defaultValue = QVariant().toBool());
172  static void setUseTrayIcon(const bool &useTrayIcon);
173 
174  static bool isHideOnClose(const bool &defaultValue = QVariant().toBool());
175  static void setHideOnClose(const bool &hideOnClose);
176 
177  static bool isStartMinimized(const bool &defaultValue = QVariant().toBool());
178  static void setStartMinimized(const bool &startMinimized);
179 
180  static bool isAlwaysOnTop(const bool &defaultValue = QVariant().toBool());
181  static void setAlwaysOnTop(const bool &alwaysOnTop);
182 
183  static bool isAutoPull(const bool &defaultValue = QVariant().toBool());
184  static void setAutoPull(const bool &autoPull);
185 
186  static bool isAutoPush(const bool &defaultValue = QVariant().toBool());
187  static void setAutoPush(const bool &autoPush);
188 
189  static QString
190  getPassTemplate(const QString &defaultValue = QVariant().toString());
191  static void setPassTemplate(const QString &passTemplate);
192 
193  static bool isUseTemplate(const bool &defaultValue = QVariant().toBool());
194  static void setUseTemplate(const bool &useTemplate);
195 
196  static bool
197  isTemplateAllFields(const bool &defaultValue = QVariant().toBool());
198  static void setTemplateAllFields(const bool &templateAllFields);
199 
200  static QHash<QString, QString> getProfiles();
201  static void setProfiles(const QHash<QString, QString> &profiles);
202 
203  static Pass *getPass();
204  static RealPass *getRealPass();
205  static ImitatePass *getImitatePass();
206 };
207 
208 #endif // QTPASSSETTINGS_H
QtPassSettings::getGitExecutable
static QString getGitExecutable(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:305
QtPassSettings::getClipBoardTypeRaw
static int getClipBoardTypeRaw(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
Definition: qtpasssettings.cpp:163
QtPassSettings::setUseSymbols
static void setUseSymbols(const bool &useSymbols)
Definition: qtpasssettings.cpp:449
QtPassSettings::setStartMinimized
static void setStartMinimized(const bool &startMinimized)
Definition: qtpasssettings.cpp:488
QtPassSettings::setAutoclearSeconds
static void setAutoclearSeconds(const int &autoClearSeconds)
Definition: qtpasssettings.cpp:201
QtPassSettings::isLessRandom
static bool isLessRandom(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:435
QtPassSettings::setUsePass
static void setUsePass(const bool &usePass)
Definition: qtpasssettings.cpp:154
QtPassSettings::getPwgenExecutable
static QString getPwgenExecutable(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:323
QtPassSettings::getSize
static QSize getSize(const QSize &defaultValue=QVariant().toSize())
Definition: qtpasssettings.cpp:133
QtPassSettings
Singleton that stores qtpass' settings, saves and loads config.
Definition: qtpasssettings.h:21
QtPassSettings::isHideOnClose
static bool isHideOnClose(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:474
QtPassSettings::getPos
static QPoint getPos(const QPoint &defaultValue=QVariant().toPoint())
Definition: qtpasssettings.cpp:126
QtPassSettings::getVersion
static QString getVersion(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:99
QtPassSettings::getPassTemplate
static QString getPassTemplate(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:519
QtPassSettings::isUseTrayIcon
static bool isUseTrayIcon(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:465
QtPassSettings::getGpgExecutable
static QString getGpgExecutable(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:314
QtPassSettings::getPassExecutable
static QString getPassExecutable(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:296
QtPassSettings::getPasswordConfiguration
static PasswordConfiguration getPasswordConfiguration()
Definition: qtpasssettings.cpp:35
QtPassSettings::isMaximized
static bool isMaximized(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:140
QtPassSettings::initExecutables
static void initExecutables()
Definition: qtpasssettings.cpp:279
QtPassSettings::isUsePwgen
static bool isUsePwgen(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:408
QtPassSettings::getImitatePass
static ImitatePass * getImitatePass()
Definition: qtpasssettings.cpp:552
QtPassSettings::setUsePwgen
static void setUsePwgen(const bool &usePwgen)
Definition: qtpasssettings.cpp:413
imitatepass.h
QtPassSettings::isUseAutoclearPanel
static bool isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:206
QtPassSettings::getInstance
static QtPassSettings * getInstance()
Definition: qtpasssettings.cpp:19
QtPassSettings::setSavestate
static void setSavestate(const QByteArray &saveState)
Definition: qtpasssettings.cpp:122
QtPassSettings::setWebDavUrl
static void setWebDavUrl(const QString &webDavUrl)
Definition: qtpasssettings.cpp:352
QtPassSettings::setUseTrayIcon
static void setUseTrayIcon(const bool &useTrayIcon)
Definition: qtpasssettings.cpp:470
settingsconstants.h
QtPassSettings::setAvoidCapitals
static void setAvoidCapitals(const bool &avoidCapitals)
Definition: qtpasssettings.cpp:422
QtPassSettings::isAddGPGId
static bool isAddGPGId(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:245
QtPassSettings::setVersion
static void setVersion(const QString &version)
Definition: qtpasssettings.cpp:104
QtPassSettings::isTemplateAllFields
static bool isTemplateAllFields(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:537
QtPassSettings::setPasswordCharsselection
static void setPasswordCharsselection(const int &passwordCharsselection)
Definition: qtpasssettings.cpp:456
QtPassSettings::isAutoPush
static bool isAutoPush(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:510
QtPassSettings::getWebDavPassword
static QString getWebDavPassword(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:365
QtPassSettings::setHideOnClose
static void setHideOnClose(const bool &hideOnClose)
Definition: qtpasssettings.cpp:479
QtPassSettings::setUseSelection
static void setUseSelection(const bool &useSelection)
Definition: qtpasssettings.cpp:183
QtPassSettings::setTemplateAllFields
static void setTemplateAllFields(const bool &templateAllFields)
Definition: qtpasssettings.cpp:542
QtPassSettings::isUsePass
static bool isUsePass(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:149
QtPassSettings::setUseAutoclearPanel
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
Definition: qtpasssettings.cpp:211
QtPassSettings::setMaximized
static void setMaximized(const bool &maximized)
Definition: qtpasssettings.cpp:145
QtPassSettings::setProfiles
static void setProfiles(const QHash< QString, QString > &profiles)
Definition: qtpasssettings.cpp:75
QtPassSettings::getPass
static Pass * getPass()
Definition: qtpasssettings.cpp:87
QtPassSettings::isStartMinimized
static bool isStartMinimized(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:483
QtPassSettings::isHideContent
static bool isHideContent(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:236
QtPassSettings::setClipBoardType
static void setClipBoardType(const int &clipBoardType)
Definition: qtpasssettings.cpp:174
QtPassSettings::getWebDavUrl
static QString getWebDavUrl(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:347
QtPassSettings::setHidePassword
static void setHidePassword(const bool &hidePassword)
Definition: qtpasssettings.cpp:232
QtPassSettings::getProfile
static QString getProfile(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:374
QtPassSettings::setAddGPGId
static void setAddGPGId(const bool &addGPGId)
Definition: qtpasssettings.cpp:250
QtPassSettings::setWebDavPassword
static void setWebDavPassword(const QString &webDavPassword)
Definition: qtpasssettings.cpp:370
QtPassSettings::isUseTemplate
static bool isUseTemplate(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:528
QtPassSettings::getGpgHome
static QString getGpgHome(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:332
QtPassSettings::setAutoPush
static void setAutoPush(const bool &autoPush)
Definition: qtpasssettings.cpp:515
QtPassSettings::getGeometry
static QByteArray getGeometry(const QByteArray &defaultValue=QVariant().toByteArray())
Definition: qtpasssettings.cpp:108
realpass.h
QtPassSettings::isUseGit
static bool isUseGit(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:383
QtPassSettings::setUseTemplate
static void setUseTemplate(const bool &useTemplate)
Definition: qtpasssettings.cpp:533
QtPassSettings::isAutoPull
static bool isAutoPull(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:501
QtPassSettings::setAlwaysOnTop
static void setAlwaysOnTop(const bool &alwaysOnTop)
Definition: qtpasssettings.cpp:497
QtPassSettings::setPwgenExecutable
static void setPwgenExecutable(const QString &pwgenExecutable)
Definition: qtpasssettings.cpp:328
QtPassSettings::isUseQrencode
static bool isUseQrencode(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:398
QtPassSettings::isAvoidCapitals
static bool isAvoidCapitals(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:417
QtPassSettings::setGeometry
static void setGeometry(const QByteArray &geometry)
Definition: qtpasssettings.cpp:113
QtPassSettings::getClipBoardType
static Enums::clipBoardType getClipBoardType(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
Definition: qtpasssettings.cpp:171
QtPassSettings::setPos
static void setPos(const QPoint &pos)
Definition: qtpasssettings.cpp:129
QtPassSettings::isAvoidNumbers
static bool isAvoidNumbers(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:426
QtPassSettings::setSize
static void setSize(const QSize &size)
Definition: qtpasssettings.cpp:136
QtPassSettings::setPasswordConfiguration
static void setPasswordConfiguration(const PasswordConfiguration &config)
Definition: qtpasssettings.cpp:52
QtPassSettings::getAutoclearPanelSeconds
static int getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt())
Definition: qtpasssettings.cpp:216
QtPassSettings::setPassExecutable
static void setPassExecutable(const QString &passExecutable)
Definition: qtpasssettings.cpp:301
QtPassSettings::setUseWebDav
static void setUseWebDav(const bool &useWebDav)
Definition: qtpasssettings.cpp:343
QtPassSettings::setHideContent
static void setHideContent(const bool &hideContent)
Definition: qtpasssettings.cpp:241
QtPassSettings::setGitExecutable
static void setGitExecutable(const QString &gitExecutable)
Definition: qtpasssettings.cpp:310
QtPassSettings::setAutoPull
static void setAutoPull(const bool &autoPull)
Definition: qtpasssettings.cpp:506
enums.h
QtPassSettings::isUseSymbols
static bool isUseSymbols(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:444
QtPassSettings::setPassStore
static void setPassStore(const QString &passStore)
Definition: qtpasssettings.cpp:275
QtPassSettings::isUseSelection
static bool isUseSelection(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:178
QtPassSettings::setUseOtp
static void setUseOtp(const bool &useOtp)
Definition: qtpasssettings.cpp:394
QtPassSettings::setPassTemplate
static void setPassTemplate(const QString &passTemplate)
Definition: qtpasssettings.cpp:524
QtPassSettings::isUseAutoclear
static bool isUseAutoclear(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:187
PasswordConfiguration
Holds the Password configuration settings.
Definition: passwordconfiguration.h:10
QtPassSettings::getSavestate
static QByteArray getSavestate(const QByteArray &defaultValue=QVariant().toByteArray())
Definition: qtpasssettings.cpp:117
QtPassSettings::setProfile
static void setProfile(const QString &profile)
Definition: qtpasssettings.cpp:379
Enums::clipBoardType
clipBoardType
Definition: enums.h:10
Enums::CLIPBOARD_NEVER
@ CLIPBOARD_NEVER
Definition: enums.h:11
QtPassSettings::getProfiles
static QHash< QString, QString > getProfiles()
Definition: qtpasssettings.cpp:61
QtPassSettings::getAutoclearSeconds
static int getAutoclearSeconds(const int &defaultValue=QVariant().toInt())
Definition: qtpasssettings.cpp:196
RealPass
Wrapper for executing pass to handle the password-store.
Definition: realpass.h:10
QtPassSettings::setLessRandom
static void setLessRandom(const bool &lessRandom)
Definition: qtpasssettings.cpp:440
QtPassSettings::setUseQrencode
static void setUseQrencode(const bool &useQrencode)
Definition: qtpasssettings.cpp:404
QtPassSettings::setUseGit
static void setUseGit(const bool &useGit)
Definition: qtpasssettings.cpp:386
Pass
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:25
QtPassSettings::setWebDavUser
static void setWebDavUser(const QString &webDavUser)
Definition: qtpasssettings.cpp:361
QtPassSettings::isUseOtp
static bool isUseOtp(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:390
QtPassSettings::setUseAutoclear
static void setUseAutoclear(const bool &useAutoclear)
Definition: qtpasssettings.cpp:192
QtPassSettings::setPasswordChars
static void setPasswordChars(const QString &passwordChars)
Definition: qtpasssettings.cpp:461
QtPassSettings::getPassStore
static QString getPassStore(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:254
QtPassSettings::setAvoidNumbers
static void setAvoidNumbers(const bool &avoidNumbers)
Definition: qtpasssettings.cpp:431
QtPassSettings::setPasswordLength
static void setPasswordLength(const int &passwordLength)
Definition: qtpasssettings.cpp:453
QtPassSettings::isUseWebDav
static bool isUseWebDav(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:338
QtPassSettings::isHidePassword
static bool isHidePassword(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:227
ImitatePass
Imitates pass features when pass is not enabled or available.
Definition: imitatepass.h:11
QtPassSettings::isAlwaysOnTop
static bool isAlwaysOnTop(const bool &defaultValue=QVariant().toBool())
Definition: qtpasssettings.cpp:492
QtPassSettings::getRealPass
static RealPass * getRealPass()
Definition: qtpasssettings.cpp:547
QtPassSettings::setGpgExecutable
static void setGpgExecutable(const QString &gpgExecutable)
Definition: qtpasssettings.cpp:319
passwordconfiguration.h
QtPassSettings::getWebDavUser
static QString getWebDavUser(const QString &defaultValue=QVariant().toString())
Definition: qtpasssettings.cpp:356
QtPassSettings::setAutoclearPanelSeconds
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
Definition: qtpasssettings.cpp:221