summaryrefslogtreecommitdiffstats
path: root/src/qtpasssettings.h
blob: 196071c2727a5cf93e728025768225ef06052003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#ifndef QTPASSSETTINGS_H
#define QTPASSSETTINGS_H

#include "enums.h"
#include "imitatepass.h"
#include "passwordconfiguration.h"
#include "realpass.h"

#include <QByteArray>
#include <QHash>
#include <QPoint>
#include <QSettings>
#include <QSize>
#include <QVariant>

/*!
    \class QtPassSettings
    \brief Singleton that stores qtpass' settings, saves and loads config
*/
class QtPassSettings {

public:
  static QString
  getVersion(const QString &defaultValue = QVariant().toString());
  static void setVersion(const QString &version);

  static QByteArray
  getGeometry(const QByteArray &defaultValue = QVariant().toByteArray());
  static void setGeometry(const QByteArray &geometry);

  static QByteArray
  getSavestate(const QByteArray &defaultValue = QVariant().toByteArray());
  static void setSavestate(const QByteArray &saveState);

  static QPoint getPos(const QPoint &defaultValue = QVariant().toPoint());
  static void setPos(const QPoint &pos);

  static QSize getSize(const QSize &defaultValue = QVariant().toSize());
  static void setSize(const QSize &size);

  static int getSplitterLeft(const int &defaultValue = QVariant().toInt());
  static void setSplitterLeft(const int &splitterLeft);

  static int getSplitterRight(const int &defaultValue = QVariant().toInt());
  static void setSplitterRight(const int &splitterRight);

  static bool isMaximized(const bool &defaultValue = QVariant().toBool());
  static void setMaximized(const bool &maximized);

  static bool isUsePass(const bool &defaultValue = QVariant().toBool());
  static void setUsePass(const bool &usePass);

  static Enums::clipBoardType getClipBoardType(
      const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER);
  static void setClipBoardType(const Enums::clipBoardType &clipBoardType);

  static bool isUseSelection(const bool &defaultValue = QVariant().toBool());
  static void setUseSelection(const bool &useSelection);

  static bool isUseAutoclear(const bool &defaultValue = QVariant().toBool());
  static void setUseAutoclear(const bool &useAutoclear);

  static int getAutoclearSeconds(const int &defaultValue = QVariant().toInt());
  static void setAutoclearSeconds(const int &autoClearSeconds);

  static bool
  isUseAutoclearPanel(const bool &defaultValue = QVariant().toBool());
  static void setUseAutoclearPanel(const bool &useAutoclearPanel);

  static int
  getAutoclearPanelSeconds(const int &defaultValue = QVariant().toInt());
  static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds);

  static bool isHidePassword(const bool &defaultValue = QVariant().toBool());
  static void setHidePassword(const bool &hidePassword);

  static bool isHideContent(const bool &defaultValue = QVariant().toBool());
  static void setHideContent(const bool &hideContent);

  static bool isAddGPGId(const bool &defaultValue = QVariant().toBool());
  static void setAddGPGId(const bool &addGPGId);

  static QString
  getPassStore(const QString &defaultValue = QVariant().toString());
  static void setPassStore(const QString &passStore);

  static void initExecutables();

  static QString
  getPassExecutable(const QString &defaultValue = QVariant().toString());
  static void setPassExecutable(const QString &passExecutable);

  static QString
  getGitExecutable(const QString &defaultValue = QVariant().toString());
  static void setGitExecutable(const QString &gitExecutable);

  static QString
  getGpgExecutable(const QString &defaultValue = QVariant().toString());
  static void setGpgExecutable(const QString &gpgExecutable);

  static QString
  getPwgenExecutable(const QString &defaultValue = QVariant().toString());
  static void setPwgenExecutable(const QString &pwgenExecutable);

  static QString
  getGpgHome(const QString &defaultValue = QVariant().toString());

  static bool isUseWebDav(const bool &defaultValue = QVariant().toBool());
  static void setUseWebDav(const bool &useWebDav);

  static QString
  getWebDavUrl(const QString &defaultValue = QVariant().toString());
  static void setWebDavUrl(const QString &webDavUrl);

  static QString
  getWebDavUser(const QString &defaultValue = QVariant().toString());
  static void setWebDavUser(const QString &webDavUser);

  static QString
  getWebDavPassword(const QString &defaultValue = QVariant().toString());
  static void setWebDavPassword(const QString &webDavPassword);

  static QString
  getProfile(const QString &defaultValue = QVariant().toString());
  static void setProfile(const QString &profile);

  static bool isUseGit(const bool &defaultValue = QVariant().toBool());
  static void setUseGit(const bool &useGit);

  static bool isUsePwgen(const bool &defaultValue = QVariant().toBool());
  static void setUsePwgen(const bool &usePwgen);

  static bool isAvoidCapitals(const bool &defaultValue = QVariant().toBool());
  static void setAvoidCapitals(const bool &avoidCapitals);

  static bool isAvoidNumbers(const bool &defaultValue = QVariant().toBool());
  static void setAvoidNumbers(const bool &avoidNumbers);

  static bool isLessRandom(const bool &defaultValue = QVariant().toBool());
  static void setLessRandom(const bool &lessRandom);

  static bool isUseSymbols(const bool &defaultValue = QVariant().toBool());
  static void setUseSymbols(const bool &useSymbols);

  static PasswordConfiguration getPasswordConfiguration();
  static void setPasswordConfiguration(const PasswordConfiguration &config);
  static void setPasswordLength(const int &passwordLength);
  static void setPasswordCharsselection(const int &passwordCharsselection);
  static void setPasswordChars(const QString &passwordChars);

  static bool isUseTrayIcon(const bool &defaultValue = QVariant().toBool());
  static void setUseTrayIcon(const bool &useTrayIcon);

  static bool isHideOnClose(const bool &defaultValue = QVariant().toBool());
  static void setHideOnClose(const bool &hideOnClose);

  static bool isStartMinimized(const bool &defaultValue = QVariant().toBool());
  static void setStartMinimized(const bool &startMinimized);

  static bool isAlwaysOnTop(const bool &defaultValue = QVariant().toBool());
  static void setAlwaysOnTop(const bool &alwaysOnTop);

  static bool isAutoPull(const bool &defaultValue = QVariant().toBool());
  static void setAutoPull(const bool &autoPull);

  static bool isAutoPush(const bool &defaultValue = QVariant().toBool());
  static void setAutoPush(const bool &autoPush);

  static QString
  getPassTemplate(const QString &defaultValue = QVariant().toString());
  static void setPassTemplate(const QString &passTemplate);

  static bool isUseTemplate(const bool &defaultValue = QVariant().toBool());
  static void setUseTemplate(const bool &useTemplate);

  static bool
  isTemplateAllFields(const bool &defaultValue = QVariant().toBool());
  static void setTemplateAllFields(const bool &templateAllFields);

  static QHash<QString, QString> getProfiles();
  static void setProfiles(const QHash<QString, QString> &profiles);

  static Pass *getPass();
  static RealPass *getRealPass();
  static ImitatePass *getImitatePass();

signals:

public slots:

private:
  // constructor
  explicit QtPassSettings();

  static bool initialized;
  // member
  static QScopedPointer<QSettings> settings;

  static QHash<QString, QString> stringSettings;
  static QHash<QString, QByteArray> byteArraySettings;
  static QHash<QString, QPoint> pointSettings;
  static QHash<QString, QSize> sizeSettings;
  static QHash<QString, int> intSettings;