summaryrefslogtreecommitdiffstats
path: root/src/qtpasssettings.h
blob: d63f37fd57d7b53357710bcfcc67a64ff1ecea7e (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
#ifndef QTPASSSETTINGS_H
#define QTPASSSETTINGS_H

#include "enums.h"
#include "imitatepass.h"
#include "passwordconfiguration.h"
#include "realpass.h"
#include "settingsconstants.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 QSettings {
private:
  explicit QtPassSettings();

  QtPassSettings(const QString &organization, const QSettings::Format format)
      : QSettings(organization, format) {}
  QtPassSettings(const QString &organization, const QString &application)
      : QSettings(organization, application) {}

  virtual ~QtPassSettings() {}

  static bool initialized;
  static QtPassSettings *m_instance;

  static Pass *pass;
  static QScopedPointer<RealPass> realPass;
  static QScopedPointer<ImitatePass> imitatePass;

public:
  static QtPassSettings *getInstance();

  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 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 int getClipBoardTypeRaw(
      const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER);
  static Enums::clipBoardType getClipBoardType(
      const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER);
  static void setClipBoardType(const int &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 isUseMonospace(const bool &defaultValue = QVariant().toBool());
  static void setUseMonospace(const bool &useMonospace);

  static bool isDisplayAsIs(const bool &defaultValue = QVariant().toBool());
  static void setDisplayAsIs(const bool &displayAsIs);

  static bool isNoLineWrapping(const bool &defaultValue = QVariant().toBool());
  static void setNoLineWrapping(const bool &noLineWrapping);

  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 QString
  getPassSigningKey(const QString &defaultValue = QVariant().toString());
  static void setPassSigningKey(const QString &passSigningKey);

  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 isUseOtp(const bool &defaultValue = QVariant().toBool());
  static void setUseOtp(const bool &useOtp);

  static bool isUseQrencode(const bool &defaultValue = QVariant().toBool());
  static void setUseQrencode(const bool &useQrencode);

  static QString
  getQrencodeExecutable(const QString &defaultValue = QVariant().toString());
  static void setQrencodeExecutable(const QString &qrencodeExecutable);

  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