• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IJHack / QtPass / 23657125318

27 Mar 2026 04:40PM UTC coverage: 18.29% (-0.09%) from 18.381%
23657125318

push

github

web-flow
Merge pull request #781 from IJHack/fix/780-validate-custom-charset

Fix weak passwords from test settings persisting (#780)

6 of 7 new or added lines in 2 files covered. (85.71%)

8 existing lines in 3 files now uncovered.

911 of 4981 relevant lines covered (18.29%)

7.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.88
/src/qtpasssettings.cpp
1
// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
#include "qtpasssettings.h"
4
#include "pass.h"
5

6
#include "util.h"
7

8
#include <QCoreApplication>
9
#include <QDebug>
10

11
bool QtPassSettings::initialized = false;
12

13
Pass *QtPassSettings::pass;
14
// Go via pointer to avoid dynamic initialization,
15
// due to "random" initialization order realtive to other
16
// globals, especially around QObject emtadata dynamic initialization
17
// can lead to crashes depending on compiler, linker etc.
18
QScopedPointer<RealPass> QtPassSettings::realPass;
19
QScopedPointer<ImitatePass> QtPassSettings::imitatePass;
20

21
QtPassSettings *QtPassSettings::m_instance = nullptr;
22
auto QtPassSettings::getInstance() -> QtPassSettings * {
1,253✔
23
  if (!QtPassSettings::initialized) {
1,253✔
24
    QString portable_ini = QCoreApplication::applicationDirPath() +
4✔
25
                           QDir::separator() + "qtpass.ini";
4✔
26
    if (QFile(portable_ini).exists()) {
4✔
27
      m_instance = new QtPassSettings(portable_ini, QSettings::IniFormat);
×
28
    } else {
29
      m_instance = new QtPassSettings("IJHack", "QtPass");
8✔
30
    }
31

32
    initialized = true;
4✔
33
  }
34

35
  return m_instance;
1,253✔
36
}
37

38
auto QtPassSettings::getPasswordConfiguration() -> PasswordConfiguration {
7✔
39
  PasswordConfiguration config;
7✔
40

41
  config.length =
7✔
42
      getInstance()->value(SettingsConstants::passwordLength, 16).toInt();
7✔
43
  if (config.length <= 0) {
7✔
NEW
44
    config.length = 16;
×
45
  }
46
  config.selected = static_cast<PasswordConfiguration::characterSet>(
7✔
47
      getInstance()
7✔
48
          ->value(SettingsConstants::passwordCharsselection, 0)
14✔
49
          .toInt());
7✔
50
  config.Characters[PasswordConfiguration::CUSTOM] =
51
      getInstance()
7✔
52
          ->value(SettingsConstants::passwordChars, QString())
14✔
53
          .toString();
7✔
54

55
  return config;
7✔
56
}
×
57

58
void QtPassSettings::setPasswordConfiguration(
1✔
59
    const PasswordConfiguration &config) {
60
  getInstance()->setValue(SettingsConstants::passwordLength, config.length);
1✔
61
  getInstance()->setValue(SettingsConstants::passwordCharsselection,
2✔
62
                          config.selected);
1✔
63
  getInstance()->setValue(SettingsConstants::passwordChars,
2✔
64
                          config.Characters[PasswordConfiguration::CUSTOM]);
1✔
65
}
1✔
66

67
auto QtPassSettings::getProfiles() -> QHash<QString, QHash<QString, QString>> {
3✔
68
  getInstance()->beginGroup(SettingsConstants::profile);
3✔
69
  QHash<QString, QHash<QString, QString>> profiles;
3✔
70

71
  // migration from version <= v1.3.2: profiles datastructure
72
  QStringList childKeys = getInstance()->childKeys();
3✔
73
  if (!childKeys.empty()) {
3✔
74
    foreach (QString key, childKeys) {
×
75
      QHash<QString, QString> profile;
×
76
      profile.insert("path", getInstance()->value(key).toString());
×
77
      profile.insert("signingKey", "");
×
78
      profiles.insert(key, profile);
79
    }
×
80
  }
81
  // /migration from version <= v1.3.2
82

83
  QStringList childGroups = getInstance()->childGroups();
3✔
84
  foreach (QString group, childGroups) {
6✔
85
    QHash<QString, QString> profile;
3✔
86
    profile.insert("path", getInstance()->value(group + "/path").toString());
6✔
87
    profile.insert("signingKey",
6✔
88
                   getInstance()->value(group + "/signingKey").toString());
9✔
89
    // profiles.insert(group, getInstance()->value(group).toString());
90
    profiles.insert(group, profile);
91
  }
3✔
92

93
  getInstance()->endGroup();
3✔
94

95
  return profiles;
3✔
96
}
×
97

98
void QtPassSettings::setProfiles(
2✔
99
    const QHash<QString, QHash<QString, QString>> &profiles) {
100
  getInstance()->remove(SettingsConstants::profile);
2✔
101
  getInstance()->beginGroup(SettingsConstants::profile);
2✔
102

103
  QHash<QString, QHash<QString, QString>>::const_iterator i = profiles.begin();
2✔
104
  for (; i != profiles.end(); ++i) {
2✔
105
    getInstance()->setValue(i.key() + "/path", i.value().value("path"));
6✔
106
    getInstance()->setValue(i.key() + "/signingKey",
9✔
107
                            i.value().value("signingKey"));
6✔
108
  }
109

110
  getInstance()->endGroup();
2✔
111
}
2✔
112

113
auto QtPassSettings::getPass() -> Pass * {
11✔
114
  if (!pass) {
11✔
115
    if (isUsePass()) {
1✔
116
      QtPassSettings::pass = getRealPass();
×
117
    } else {
118
      QtPassSettings::pass = getImitatePass();
1✔
119
    }
120
    pass->init();
1✔
121
  }
122
  return pass;
11✔
123
}
124

125
auto QtPassSettings::getVersion(const QString &defaultValue) -> QString {
1✔
126
  return getInstance()
1✔
127
      ->value(SettingsConstants::version, defaultValue)
2✔
128
      .toString();
2✔
129
}
130
void QtPassSettings::setVersion(const QString &version) {
1✔
131
  getInstance()->setValue(SettingsConstants::version, version);
2✔
132
}
1✔
133

134
auto QtPassSettings::getGeometry(const QByteArray &defaultValue) -> QByteArray {
1✔
135
  return getInstance()
1✔
136
      ->value(SettingsConstants::geometry, defaultValue)
2✔
137
      .toByteArray();
2✔
138
}
139
void QtPassSettings::setGeometry(const QByteArray &geometry) {
1✔
140
  getInstance()->setValue(SettingsConstants::geometry, geometry);
1✔
141
}
1✔
142

143
auto QtPassSettings::getSavestate(const QByteArray &defaultValue)
1✔
144
    -> QByteArray {
145
  return getInstance()
1✔
146
      ->value(SettingsConstants::savestate, defaultValue)
2✔
147
      .toByteArray();
2✔
148
}
149
void QtPassSettings::setSavestate(const QByteArray &saveState) {
1✔
150
  getInstance()->setValue(SettingsConstants::savestate, saveState);
1✔
151
}
1✔
152

153
auto QtPassSettings::getPos(const QPoint &defaultValue) -> QPoint {
1✔
154
  return getInstance()->value(SettingsConstants::pos, defaultValue).toPoint();
1✔
155
}
156
void QtPassSettings::setPos(const QPoint &pos) {
1✔
157
  getInstance()->setValue(SettingsConstants::pos, pos);
1✔
158
}
1✔
159

160
auto QtPassSettings::getSize(const QSize &defaultValue) -> QSize {
1✔
161
  return getInstance()->value(SettingsConstants::size, defaultValue).toSize();
1✔
162
}
163
void QtPassSettings::setSize(const QSize &size) {
1✔
164
  getInstance()->setValue(SettingsConstants::size, size);
1✔
165
}
1✔
166

167
auto QtPassSettings::isMaximized(const bool &defaultValue) -> bool {
2✔
168
  return getInstance()
2✔
169
      ->value(SettingsConstants::maximized, defaultValue)
4✔
170
      .toBool();
4✔
171
}
172
void QtPassSettings::setMaximized(const bool &maximized) {
2✔
173
  getInstance()->setValue(SettingsConstants::maximized, maximized);
2✔
174
}
2✔
175

176
auto QtPassSettings::isUsePass(const bool &defaultValue) -> bool {
3✔
177
  return getInstance()
3✔
178
      ->value(SettingsConstants::usePass, defaultValue)
6✔
179
      .toBool();
6✔
180
}
181
void QtPassSettings::setUsePass(const bool &usePass) {
2✔
182
  if (usePass) {
2✔
183
    QtPassSettings::pass = getRealPass();
1✔
184
  } else {
185
    QtPassSettings::pass = getImitatePass();
1✔
186
  }
187
  getInstance()->setValue(SettingsConstants::usePass, usePass);
2✔
188
}
2✔
189

190
auto QtPassSettings::getClipBoardTypeRaw(
×
191
    const Enums::clipBoardType &defaultvalue) -> int {
192
  return getInstance()
×
193
      ->value(SettingsConstants::clipBoardType, static_cast<int>(defaultvalue))
×
194
      .toInt();
×
195
}
196

197
auto QtPassSettings::getClipBoardType(const Enums::clipBoardType &defaultvalue)
×
198
    -> Enums::clipBoardType {
199
  return static_cast<Enums::clipBoardType>(getClipBoardTypeRaw(defaultvalue));
×
200
}
201
void QtPassSettings::setClipBoardType(const int &clipBoardType) {
1✔
202
  getInstance()->setValue(SettingsConstants::clipBoardType, clipBoardType);
1✔
203
}
1✔
204

205
auto QtPassSettings::isUseSelection(const bool &defaultValue) -> bool {
2✔
206
  return getInstance()
2✔
207
      ->value(SettingsConstants::useSelection, defaultValue)
4✔
208
      .toBool();
4✔
209
}
210
void QtPassSettings::setUseSelection(const bool &useSelection) {
2✔
211
  getInstance()->setValue(SettingsConstants::useSelection, useSelection);
2✔
212
}
2✔
213

214
auto QtPassSettings::isUseAutoclear(const bool &defaultValue) -> bool {
2✔
215
  return getInstance()
2✔
216
      ->value(SettingsConstants::useAutoclear, defaultValue)
4✔
217
      .toBool();
4✔
218
}
219
void QtPassSettings::setUseAutoclear(const bool &useAutoclear) {
2✔
220
  getInstance()->setValue(SettingsConstants::useAutoclear, useAutoclear);
2✔
221
}
2✔
222

223
auto QtPassSettings::getAutoclearSeconds(const int &defaultValue) -> int {
1✔
224
  return getInstance()
1✔
225
      ->value(SettingsConstants::autoclearSeconds, defaultValue)
2✔
226
      .toInt();
2✔
227
}
228
void QtPassSettings::setAutoclearSeconds(const int &autoClearSeconds) {
2✔
229
  getInstance()->setValue(SettingsConstants::autoclearSeconds,
2✔
230
                          autoClearSeconds);
231
}
2✔
232

233
auto QtPassSettings::isUseAutoclearPanel(const bool &defaultValue) -> bool {
2✔
234
  return getInstance()
2✔
235
      ->value(SettingsConstants::useAutoclearPanel, defaultValue)
4✔
236
      .toBool();
4✔
237
}
238
void QtPassSettings::setUseAutoclearPanel(const bool &useAutoclearPanel) {
2✔
239
  getInstance()->setValue(SettingsConstants::useAutoclearPanel,
4✔
240
                          useAutoclearPanel);
2✔
241
}
2✔
242

243
auto QtPassSettings::getAutoclearPanelSeconds(const int &defaultValue) -> int {
1✔
244
  return getInstance()
1✔
245
      ->value(SettingsConstants::autoclearPanelSeconds, defaultValue)
2✔
246
      .toInt();
2✔
247
}
248
void QtPassSettings::setAutoclearPanelSeconds(
2✔
249
    const int &autoClearPanelSeconds) {
250
  getInstance()->setValue(SettingsConstants::autoclearPanelSeconds,
2✔
251
                          autoClearPanelSeconds);
252
}
2✔
253

254
auto QtPassSettings::isHidePassword(const bool &defaultValue) -> bool {
2✔
255
  return getInstance()
2✔
256
      ->value(SettingsConstants::hidePassword, defaultValue)
4✔
257
      .toBool();
4✔
258
}
259
void QtPassSettings::setHidePassword(const bool &hidePassword) {
2✔
260
  getInstance()->setValue(SettingsConstants::hidePassword, hidePassword);
2✔
261
}
2✔
262

263
auto QtPassSettings::isHideContent(const bool &defaultValue) -> bool {
2✔
264
  return getInstance()
2✔
265
      ->value(SettingsConstants::hideContent, defaultValue)
4✔
266
      .toBool();
4✔
267
}
268
void QtPassSettings::setHideContent(const bool &hideContent) {
2✔
269
  getInstance()->setValue(SettingsConstants::hideContent, hideContent);
2✔
270
}
2✔
271

272
auto QtPassSettings::isUseMonospace(const bool &defaultValue) -> bool {
2✔
273
  return getInstance()
2✔
274
      ->value(SettingsConstants::useMonospace, defaultValue)
4✔
275
      .toBool();
4✔
276
}
277
void QtPassSettings::setUseMonospace(const bool &useMonospace) {
2✔
278
  getInstance()->setValue(SettingsConstants::useMonospace, useMonospace);
2✔
279
}
2✔
280

281
auto QtPassSettings::isDisplayAsIs(const bool &defaultValue) -> bool {
2✔
282
  return getInstance()
2✔
283
      ->value(SettingsConstants::displayAsIs, defaultValue)
4✔
284
      .toBool();
4✔
285
}
286
void QtPassSettings::setDisplayAsIs(const bool &displayAsIs) {
2✔
287
  getInstance()->setValue(SettingsConstants::displayAsIs, displayAsIs);
2✔
288
}
2✔
289

290
auto QtPassSettings::isNoLineWrapping(const bool &defaultValue) -> bool {
2✔
291
  return getInstance()
2✔
292
      ->value(SettingsConstants::noLineWrapping, defaultValue)
4✔
293
      .toBool();
4✔
294
}
295
void QtPassSettings::setNoLineWrapping(const bool &noLineWrapping) {
2✔
296
  getInstance()->setValue(SettingsConstants::noLineWrapping, noLineWrapping);
2✔
297
}
2✔
298

299
auto QtPassSettings::isAddGPGId(const bool &defaultValue) -> bool {
2✔
300
  return getInstance()
2✔
301
      ->value(SettingsConstants::addGPGId, defaultValue)
4✔
302
      .toBool();
4✔
303
}
304
void QtPassSettings::setAddGPGId(const bool &addGPGId) {
2✔
305
  getInstance()->setValue(SettingsConstants::addGPGId, addGPGId);
2✔
306
}
2✔
307

308
auto QtPassSettings::getPassStore(const QString &defaultValue) -> QString {
20✔
309
  QString returnValue = getInstance()
20✔
310
                            ->value(SettingsConstants::passStore, defaultValue)
40✔
311
                            .toString();
20✔
312

313
  // Normalize the path string
314
  returnValue = QDir(returnValue).absolutePath();
40✔
315

316
  // ensure directory exists if never used pass or misconfigured.
317
  // otherwise process->setWorkingDirectory(passStore); will fail on execution.
318
  if (!QDir(returnValue).exists()) {
20✔
319
    if (!QDir().mkdir(returnValue)) {
2✔
320
      qWarning() << "Failed to create password store directory:" << returnValue;
×
321
    }
322
  }
323

324
  // ensure path ends in /
325
  if (!returnValue.endsWith("/") && !returnValue.endsWith(QDir::separator())) {
40✔
326
    returnValue += QDir::separator();
20✔
327
  }
328

329
  return returnValue;
20✔
330
}
331
void QtPassSettings::setPassStore(const QString &passStore) {
8✔
332
  getInstance()->setValue(SettingsConstants::passStore, passStore);
8✔
333
}
8✔
334

335
auto QtPassSettings::getPassSigningKey(const QString &defaultValue) -> QString {
1✔
336
  return getInstance()
1✔
337
      ->value(SettingsConstants::passSigningKey, defaultValue)
2✔
338
      .toString();
2✔
339
}
340
void QtPassSettings::setPassSigningKey(const QString &passSigningKey) {
1✔
341
  getInstance()->setValue(SettingsConstants::passSigningKey, passSigningKey);
1✔
342
}
1✔
343

344
void QtPassSettings::initExecutables() {
×
345
  QString passExecutable =
346
      QtPassSettings::getPassExecutable(Util::findBinaryInPath("pass"));
×
347
  QtPassSettings::setPassExecutable(passExecutable);
×
348

349
  QString gitExecutable =
350
      QtPassSettings::getGitExecutable(Util::findBinaryInPath("git"));
×
351
  QtPassSettings::setGitExecutable(gitExecutable);
×
352

353
  QString gpgExecutable =
354
      QtPassSettings::getGpgExecutable(Util::findBinaryInPath("gpg2"));
×
355
  QtPassSettings::setGpgExecutable(gpgExecutable);
×
356

357
  QString pwgenExecutable =
358
      QtPassSettings::getPwgenExecutable(Util::findBinaryInPath("pwgen"));
×
359
  QtPassSettings::setPwgenExecutable(pwgenExecutable);
×
360
}
×
361
auto QtPassSettings::getPassExecutable(const QString &defaultValue) -> QString {
1✔
362
  return getInstance()
1✔
363
      ->value(SettingsConstants::passExecutable, defaultValue)
2✔
364
      .toString();
2✔
365
}
366
void QtPassSettings::setPassExecutable(const QString &passExecutable) {
1✔
367
  getInstance()->setValue(SettingsConstants::passExecutable, passExecutable);
1✔
368
}
1✔
369

370
auto QtPassSettings::getGitExecutable(const QString &defaultValue) -> QString {
1✔
371
  return getInstance()
1✔
372
      ->value(SettingsConstants::gitExecutable, defaultValue)
2✔
373
      .toString();
2✔
374
}
375
void QtPassSettings::setGitExecutable(const QString &gitExecutable) {
1✔
376
  getInstance()->setValue(SettingsConstants::gitExecutable, gitExecutable);
1✔
377
}
1✔
378

379
auto QtPassSettings::getGpgExecutable(const QString &defaultValue) -> QString {
1✔
380
  return getInstance()
1✔
381
      ->value(SettingsConstants::gpgExecutable, defaultValue)
2✔
382
      .toString();
2✔
383
}
384
void QtPassSettings::setGpgExecutable(const QString &gpgExecutable) {
1✔
385
  getInstance()->setValue(SettingsConstants::gpgExecutable, gpgExecutable);
1✔
386
}
1✔
387

388
auto QtPassSettings::getPwgenExecutable(const QString &defaultValue)
1✔
389
    -> QString {
390
  return getInstance()
1✔
391
      ->value(SettingsConstants::pwgenExecutable, defaultValue)
2✔
392
      .toString();
2✔
393
}
394
void QtPassSettings::setPwgenExecutable(const QString &pwgenExecutable) {
1✔
395
  getInstance()->setValue(SettingsConstants::pwgenExecutable, pwgenExecutable);
1✔
396
}
1✔
397

398
auto QtPassSettings::getGpgHome(const QString &defaultValue) -> QString {
1✔
399
  return getInstance()
1✔
400
      ->value(SettingsConstants::gpgHome, defaultValue)
2✔
401
      .toString();
2✔
402
}
403

404
auto QtPassSettings::isUseWebDav(const bool &defaultValue) -> bool {
2✔
405
  return getInstance()
2✔
406
      ->value(SettingsConstants::useWebDav, defaultValue)
4✔
407
      .toBool();
4✔
408
}
409
void QtPassSettings::setUseWebDav(const bool &useWebDav) {
2✔
410
  getInstance()->setValue(SettingsConstants::useWebDav, useWebDav);
2✔
411
}
2✔
412

413
auto QtPassSettings::getWebDavUrl(const QString &defaultValue) -> QString {
1✔
414
  return getInstance()
1✔
415
      ->value(SettingsConstants::webDavUrl, defaultValue)
2✔
416
      .toString();
2✔
417
}
418
void QtPassSettings::setWebDavUrl(const QString &webDavUrl) {
1✔
419
  getInstance()->setValue(SettingsConstants::webDavUrl, webDavUrl);
1✔
420
}
1✔
421

422
auto QtPassSettings::getWebDavUser(const QString &defaultValue) -> QString {
1✔
423
  return getInstance()
1✔
424
      ->value(SettingsConstants::webDavUser, defaultValue)
2✔
425
      .toString();
2✔
426
}
427
void QtPassSettings::setWebDavUser(const QString &webDavUser) {
1✔
428
  getInstance()->setValue(SettingsConstants::webDavUser, webDavUser);
1✔
429
}
1✔
430

431
auto QtPassSettings::getWebDavPassword(const QString &defaultValue) -> QString {
1✔
432
  return getInstance()
1✔
433
      ->value(SettingsConstants::webDavPassword, defaultValue)
2✔
434
      .toString();
2✔
435
}
436
void QtPassSettings::setWebDavPassword(const QString &webDavPassword) {
1✔
437
  getInstance()->setValue(SettingsConstants::webDavPassword, webDavPassword);
1✔
438
}
1✔
439

440
auto QtPassSettings::getProfile(const QString &defaultValue) -> QString {
2✔
441
  return getInstance()
2✔
442
      ->value(SettingsConstants::profile, defaultValue)
4✔
443
      .toString();
4✔
444
}
445
void QtPassSettings::setProfile(const QString &profile) {
1✔
446
  getInstance()->setValue(SettingsConstants::profile, profile);
1✔
447
}
1✔
448

449
auto QtPassSettings::isUseGit(const bool &defaultValue) -> bool {
2✔
450
  return getInstance()->value(SettingsConstants::useGit, defaultValue).toBool();
2✔
451
}
452
void QtPassSettings::setUseGit(const bool &useGit) {
2✔
453
  getInstance()->setValue(SettingsConstants::useGit, useGit);
2✔
454
}
2✔
455

456
auto QtPassSettings::isUseOtp(const bool &defaultValue) -> bool {
2✔
457
  return getInstance()->value(SettingsConstants::useOtp, defaultValue).toBool();
2✔
458
}
459

460
void QtPassSettings::setUseOtp(const bool &useOtp) {
2✔
461
  getInstance()->setValue(SettingsConstants::useOtp, useOtp);
2✔
462
}
2✔
463

464
auto QtPassSettings::isUseQrencode(const bool &defaultValue) -> bool {
2✔
465
  return getInstance()
2✔
466
      ->value(SettingsConstants::useQrencode, defaultValue)
4✔
467
      .toBool();
4✔
468
}
469

470
void QtPassSettings::setUseQrencode(const bool &useQrencode) {
2✔
471
  getInstance()->setValue(SettingsConstants::useQrencode, useQrencode);
2✔
472
}
2✔
473

474
auto QtPassSettings::getQrencodeExecutable(const QString &defaultValue)
1✔
475
    -> QString {
476
  return getInstance()
1✔
477
      ->value(SettingsConstants::qrencodeExecutable, defaultValue)
2✔
478
      .toString();
2✔
479
}
480
void QtPassSettings::setQrencodeExecutable(const QString &qrencodeExecutable) {
1✔
481
  getInstance()->setValue(SettingsConstants::qrencodeExecutable,
1✔
482
                          qrencodeExecutable);
483
}
1✔
484

485
auto QtPassSettings::isUsePwgen(const bool &defaultValue) -> bool {
1,006✔
486
  return getInstance()
1,006✔
487
      ->value(SettingsConstants::usePwgen, defaultValue)
2,012✔
488
      .toBool();
2,012✔
489
}
490
void QtPassSettings::setUsePwgen(const bool &usePwgen) {
2✔
491
  getInstance()->setValue(SettingsConstants::usePwgen, usePwgen);
2✔
492
}
2✔
493

494
auto QtPassSettings::isAvoidCapitals(const bool &defaultValue) -> bool {
2✔
495
  return getInstance()
2✔
496
      ->value(SettingsConstants::avoidCapitals, defaultValue)
4✔
497
      .toBool();
4✔
498
}
499
void QtPassSettings::setAvoidCapitals(const bool &avoidCapitals) {
2✔
500
  getInstance()->setValue(SettingsConstants::avoidCapitals, avoidCapitals);
2✔
501
}
2✔
502

503
auto QtPassSettings::isAvoidNumbers(const bool &defaultValue) -> bool {
2✔
504
  return getInstance()
2✔
505
      ->value(SettingsConstants::avoidNumbers, defaultValue)
4✔
506
      .toBool();
4✔
507
}
508
void QtPassSettings::setAvoidNumbers(const bool &avoidNumbers) {
2✔
509
  getInstance()->setValue(SettingsConstants::avoidNumbers, avoidNumbers);
2✔
510
}
2✔
511

512
auto QtPassSettings::isLessRandom(const bool &defaultValue) -> bool {
2✔
513
  return getInstance()
2✔
514
      ->value(SettingsConstants::lessRandom, defaultValue)
4✔
515
      .toBool();
4✔
516
}
517
void QtPassSettings::setLessRandom(const bool &lessRandom) {
2✔
518
  getInstance()->setValue(SettingsConstants::lessRandom, lessRandom);
2✔
519
}
2✔
520

521
auto QtPassSettings::isUseSymbols(const bool &defaultValue) -> bool {
2✔
522
  return getInstance()
2✔
523
      ->value(SettingsConstants::useSymbols, defaultValue)
4✔
524
      .toBool();
4✔
525
}
526
void QtPassSettings::setUseSymbols(const bool &useSymbols) {
2✔
527
  getInstance()->setValue(SettingsConstants::useSymbols, useSymbols);
2✔
528
}
2✔
529

530
void QtPassSettings::setPasswordLength(const int &passwordLength) {
2✔
531
  getInstance()->setValue(SettingsConstants::passwordLength, passwordLength);
2✔
532
}
2✔
533
void QtPassSettings::setPasswordCharsselection(
6✔
534
    const int &passwordCharsselection) {
535
  getInstance()->setValue(SettingsConstants::passwordCharsselection,
6✔
536
                          passwordCharsselection);
537
}
6✔
538
void QtPassSettings::setPasswordChars(const QString &passwordChars) {
5✔
539
  getInstance()->setValue(SettingsConstants::passwordChars, passwordChars);
5✔
540
}
5✔
541

542
auto QtPassSettings::isUseTrayIcon(const bool &defaultValue) -> bool {
2✔
543
  return getInstance()
2✔
544
      ->value(SettingsConstants::useTrayIcon, defaultValue)
4✔
545
      .toBool();
4✔
546
}
547
void QtPassSettings::setUseTrayIcon(const bool &useTrayIcon) {
2✔
548
  getInstance()->setValue(SettingsConstants::useTrayIcon, useTrayIcon);
2✔
549
}
2✔
550

551
auto QtPassSettings::isHideOnClose(const bool &defaultValue) -> bool {
2✔
552
  return getInstance()
2✔
553
      ->value(SettingsConstants::hideOnClose, defaultValue)
4✔
554
      .toBool();
4✔
555
}
556
void QtPassSettings::setHideOnClose(const bool &hideOnClose) {
2✔
557
  getInstance()->setValue(SettingsConstants::hideOnClose, hideOnClose);
2✔
558
}
2✔
559

560
auto QtPassSettings::isStartMinimized(const bool &defaultValue) -> bool {
2✔
561
  return getInstance()
2✔
562
      ->value(SettingsConstants::startMinimized, defaultValue)
4✔
563
      .toBool();
4✔
564
}
565
void QtPassSettings::setStartMinimized(const bool &startMinimized) {
2✔
566
  getInstance()->setValue(SettingsConstants::startMinimized, startMinimized);
2✔
567
}
2✔
568

569
auto QtPassSettings::isAlwaysOnTop(const bool &defaultValue) -> bool {
2✔
570
  return getInstance()
2✔
571
      ->value(SettingsConstants::alwaysOnTop, defaultValue)
4✔
572
      .toBool();
4✔
573
}
574
void QtPassSettings::setAlwaysOnTop(const bool &alwaysOnTop) {
2✔
575
  getInstance()->setValue(SettingsConstants::alwaysOnTop, alwaysOnTop);
2✔
576
}
2✔
577

578
auto QtPassSettings::isAutoPull(const bool &defaultValue) -> bool {
2✔
579
  return getInstance()
2✔
580
      ->value(SettingsConstants::autoPull, defaultValue)
4✔
581
      .toBool();
4✔
582
}
583
void QtPassSettings::setAutoPull(const bool &autoPull) {
2✔
584
  getInstance()->setValue(SettingsConstants::autoPull, autoPull);
2✔
585
}
2✔
586

587
auto QtPassSettings::isAutoPush(const bool &defaultValue) -> bool {
2✔
588
  return getInstance()
2✔
589
      ->value(SettingsConstants::autoPush, defaultValue)
4✔
590
      .toBool();
4✔
591
}
592
void QtPassSettings::setAutoPush(const bool &autoPush) {
2✔
593
  getInstance()->setValue(SettingsConstants::autoPush, autoPush);
2✔
594
}
2✔
595

596
auto QtPassSettings::getPassTemplate(const QString &defaultValue) -> QString {
1✔
597
  return getInstance()
1✔
598
      ->value(SettingsConstants::passTemplate, defaultValue)
2✔
599
      .toString();
2✔
600
}
601
void QtPassSettings::setPassTemplate(const QString &passTemplate) {
1✔
602
  getInstance()->setValue(SettingsConstants::passTemplate, passTemplate);
1✔
603
}
1✔
604

605
auto QtPassSettings::isUseTemplate(const bool &defaultValue) -> bool {
2✔
606
  return getInstance()
2✔
607
      ->value(SettingsConstants::useTemplate, defaultValue)
4✔
608
      .toBool();
4✔
609
}
610
void QtPassSettings::setUseTemplate(const bool &useTemplate) {
2✔
611
  getInstance()->setValue(SettingsConstants::useTemplate, useTemplate);
2✔
612
}
2✔
613

614
auto QtPassSettings::isTemplateAllFields(const bool &defaultValue) -> bool {
2✔
615
  return getInstance()
2✔
616
      ->value(SettingsConstants::templateAllFields, defaultValue)
4✔
617
      .toBool();
4✔
618
}
619
void QtPassSettings::setTemplateAllFields(const bool &templateAllFields) {
2✔
620
  getInstance()->setValue(SettingsConstants::templateAllFields,
4✔
621
                          templateAllFields);
2✔
622
}
2✔
623

624
auto QtPassSettings::getRealPass() -> RealPass * {
1✔
625
  if (realPass.isNull()) {
1✔
626
    realPass.reset(new RealPass());
1✔
627
  }
628
  return realPass.data();
1✔
629
}
630
auto QtPassSettings::getImitatePass() -> ImitatePass * {
2✔
631
  if (imitatePass.isNull()) {
2✔
632
    imitatePass.reset(new ImitatePass());
2✔
633
  }
634
  return imitatePass.data();
2✔
635
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc