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

IJHack / QtPass / 27719366434

17 Jun 2026 08:58PM UTC coverage: 55.213% (-0.8%) from 56.049%
27719366434

Pull #1563

github

web-flow
Merge ba04044e0 into 10f188c2d
Pull Request #1563: refactor(#1511): delete 37 dead setter/getter wrappers

3702 of 6705 relevant lines covered (55.21%)

28.36 hits per line

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

85.9
/src/qtpasssettings.cpp
1
// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3

4
/**
5
 * @class QtPassSettings
6
 * @brief Singleton settings manager implementation.
7
 *
8
 * Implementation of QtPassSettings singleton. Handles persistence using
9
 * QSettings with support for portable mode (qtpass.ini next to executable).
10
 *
11
 * @see qtpasssettings.h
12
 */
13

14
#include "qtpasssettings.h"
15
#include "pass.h"
16
#include "passbackendfactory.h"
17
#include "settingsserializer.h"
18

19
#include "util.h"
20

21
#include <QCoreApplication>
22
#include <QCursor>
23
#include <QDebug>
24
#include <QGuiApplication>
25
#include <QScreen>
26
#include <utility>
27

28
bool QtPassSettings::initialized = false;
29

30
QtPassSettings *QtPassSettings::m_instance = nullptr;
31
/**
32
 * @brief Returns the singleton instance of QtPassSettings, creating it on first
33
 * access.
34
 * @example
35
 * QtPassSettings *settings = QtPassSettings::getInstance();
36
 * std::cout << settings << std::endl; // Expected output sample: a valid
37
 * QtPassSettings pointer
38
 *
39
 * @return QtPassSettings* - Pointer to the shared QtPassSettings instance.
40
 */
41
auto QtPassSettings::getInstance() -> QtPassSettings * {
1,252✔
42
  if (!QtPassSettings::initialized) {
1,252✔
43
    QString portable_ini = QCoreApplication::applicationDirPath() +
8✔
44
                           QDir::separator() + "qtpass.ini";
8✔
45
    if (QFile(portable_ini).exists()) {
8✔
46
      m_instance = new QtPassSettings(portable_ini, QSettings::IniFormat);
×
47
    } else {
48
      m_instance = new QtPassSettings("IJHack", "QtPass");
16✔
49
    }
50

51
    initialized = true;
8✔
52
  }
53

54
  return m_instance;
1,252✔
55
}
56

57
auto QtPassSettings::load() -> AppSettings {
345✔
58
  AppSettings s = SettingsSerializer::load(*getInstance());
345✔
59
  if (!s.passStore.isEmpty()) {
345✔
60
    s.passStore = QDir::cleanPath(QDir(s.passStore).absolutePath());
684✔
61
    if (!s.passStore.endsWith('/'))
342✔
62
      s.passStore += '/';
342✔
63
  }
64
  return s;
345✔
65
}
×
66

67
void QtPassSettings::save(const AppSettings &settings) {
128✔
68
  SettingsSerializer::save(*getInstance(), settings);
128✔
69
  // A settings save may have changed the "use pass" mode; drop the cached
70
  // backend so the correct one is rebuilt on next use (matches the previous
71
  // setUsePass() side effect).
72
  PassBackendFactory::invalidate();
128✔
73
}
128✔
74

75
/**
76
 * @brief Retrieves the current password configuration from application
77
 * settings.
78
 * @example
79
 * PasswordConfiguration result = QtPassSettings::getPasswordConfiguration();
80
 * std::cout << result.length << std::endl; // Expected output sample
81
 *
82
 * @return PasswordConfiguration - The password configuration populated from
83
 * stored settings, including length, selected character set, and custom
84
 * characters.
85
 */
86
auto QtPassSettings::getPasswordConfiguration() -> PasswordConfiguration {
7✔
87
  PasswordConfiguration config;
7✔
88

89
  config.length =
7✔
90
      getInstance()->value(SettingsConstants::passwordLength, 16).toInt();
7✔
91
  if (config.length <= 0) {
7✔
92
    config.length = 16;
×
93
  }
94
  config.selected = static_cast<PasswordConfiguration::characterSet>(
7✔
95
      getInstance()
7✔
96
          ->value(SettingsConstants::passwordCharsSelection, 0)
14✔
97
          .toInt());
7✔
98
  config.Characters[PasswordConfiguration::CUSTOM] =
99
      getInstance()
7✔
100
          ->value(SettingsConstants::passwordChars, QString())
14✔
101
          .toString();
7✔
102

103
  return config;
7✔
104
}
×
105

106
/**
107
 * @brief Retrieves the stored profiles configuration as a nested hash map.
108
 * @details Reads profile data from the settings group, including legacy profile
109
 *          formats from versions <= v1.3.2, and returns each profile name
110
 * mapped to its properties such as path and signing key.
111
 * @example
112
 * QHash<QString, QHash<QString, QString>> profiles =
113
 * QtPassSettings::getProfiles(); std::cout << profiles.size() << std::endl; //
114
 * Expected output: number of profiles
115
 *
116
 * @return QHash<QString, QHash<QString, QString>> - A hash map of profile names
117
 *         mapped to their key/value properties.
118
 */
119
auto QtPassSettings::getProfiles() -> QHash<QString, QHash<QString, QString>> {
28✔
120
  getInstance()->beginGroup(SettingsConstants::profile);
28✔
121
  QHash<QString, QHash<QString, QString>> profiles;
28✔
122

123
  // migration from version <= v1.3.2: profiles datastructure
124
  QStringList childKeys = getInstance()->childKeys();
28✔
125
  if (!childKeys.empty()) {
28✔
126
    for (const auto &key : std::as_const(childKeys)) {
×
127
      QHash<QString, QString> profile;
×
128
      profile.insert("path", getInstance()->value(key).toString());
×
129
      profile.insert("signingKey", "");
×
130
      profile.insert("useGit", "");
×
131
      profile.insert("autoPush", "");
×
132
      profile.insert("autoPull", "");
×
133
      profiles.insert(key, profile);
134
    }
×
135
  }
136
  // /migration from version <= v1.3.2
137

138
  QStringList childGroups = getInstance()->childGroups();
28✔
139
  for (const auto &group : std::as_const(childGroups)) {
56✔
140
    QHash<QString, QString> profile;
28✔
141
    profile.insert("path", getInstance()->value(group + "/path").toString());
56✔
142
    profile.insert("signingKey",
56✔
143
                   getInstance()->value(group + "/signingKey").toString());
56✔
144
    profile.insert("useGit",
56✔
145
                   getInstance()->value(group + "/useGit").toString());
56✔
146
    profile.insert("autoPush",
56✔
147
                   getInstance()->value(group + "/autoPush").toString());
56✔
148
    profile.insert("autoPull",
56✔
149
                   getInstance()->value(group + "/autoPull").toString());
84✔
150
    profiles.insert(group, profile);
151
  }
28✔
152

153
  getInstance()->endGroup();
28✔
154

155
  return profiles;
28✔
156
}
×
157

158
/**
159
 * @brief Stores the profile settings in the application's configuration.
160
 * @example
161
 * QtPassSettings::setProfiles(profiles);
162
 *
163
 * @param profiles - A hash of profile names mapped to their key-value settings,
164
 * such as "path" and "signingKey".
165
 * @return void - This method does not return a value.
166
 */
167
void QtPassSettings::setProfiles(
3✔
168
    const QHash<QString, QHash<QString, QString>> &profiles) {
169
  getInstance()->remove(SettingsConstants::profile);
3✔
170
  getInstance()->beginGroup(SettingsConstants::profile);
3✔
171

172
  QHash<QString, QHash<QString, QString>>::const_iterator i = profiles.begin();
3✔
173
  for (; i != profiles.end(); ++i) {
3✔
174
    getInstance()->setValue(i.key() + "/path", i.value().value("path"));
6✔
175
    getInstance()->setValue(i.key() + "/signingKey",
9✔
176
                            i.value().value("signingKey"));
3✔
177
    getInstance()->setValue(i.key() + "/useGit", i.value().value("useGit"));
6✔
178
    getInstance()->setValue(i.key() + "/autoPush", i.value().value("autoPush"));
6✔
179
    getInstance()->setValue(i.key() + "/autoPull", i.value().value("autoPull"));
9✔
180
  }
181

182
  getInstance()->endGroup();
3✔
183
}
3✔
184

185
auto QtPassSettings::getPass() -> Pass * {
53✔
186
  return PassBackendFactory::getPass();
53✔
187
}
188

189
auto QtPassSettings::getVersion(const QString &defaultValue) -> QString {
13✔
190
  return getInstance()
13✔
191
      ->value(SettingsConstants::version, defaultValue)
26✔
192
      .toString();
26✔
193
}
194
void QtPassSettings::setVersion(const QString &version) {
13✔
195
  getInstance()->setValue(SettingsConstants::version, version);
13✔
196
}
13✔
197

198
auto QtPassSettings::getGeometry(const QByteArray &defaultValue) -> QByteArray {
13✔
199
  return getInstance()
13✔
200
      ->value(SettingsConstants::geometry, defaultValue)
26✔
201
      .toByteArray();
26✔
202
}
203
void QtPassSettings::setGeometry(const QByteArray &geometry) {
1✔
204
  getInstance()->setValue(SettingsConstants::geometry, geometry);
1✔
205
}
1✔
206

207
auto QtPassSettings::getSavestate(const QByteArray &defaultValue)
13✔
208
    -> QByteArray {
209
  return getInstance()
13✔
210
      ->value(SettingsConstants::savestate, defaultValue)
26✔
211
      .toByteArray();
26✔
212
}
213
void QtPassSettings::setSavestate(const QByteArray &saveState) {
1✔
214
  getInstance()->setValue(SettingsConstants::savestate, saveState);
1✔
215
}
1✔
216

217
auto QtPassSettings::getPos(const QPoint &defaultValue) -> QPoint {
13✔
218
  QPoint pos =
219
      getInstance()->value(SettingsConstants::pos, defaultValue).toPoint();
13✔
220
  if (pos == QPoint(0, 0)) {
221
    QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
12✔
222
    if (!screen)
12✔
223
      screen = QGuiApplication::primaryScreen();
×
224
    if (screen)
×
225
      pos = screen->geometry().center();
12✔
226
  }
227
  return pos;
13✔
228
}
229
void QtPassSettings::setPos(const QPoint &pos) {
1✔
230
  if (pos == QPoint(0, 0))
231
    return;
×
232
  getInstance()->setValue(SettingsConstants::pos, pos);
1✔
233
}
234

235
auto QtPassSettings::getSize(const QSize &defaultValue) -> QSize {
13✔
236
  return getInstance()->value(SettingsConstants::size, defaultValue).toSize();
13✔
237
}
238
void QtPassSettings::setSize(const QSize &size) {
1✔
239
  getInstance()->setValue(SettingsConstants::size, size);
1✔
240
}
1✔
241

242
void QtPassSettings::setMaximized(const bool &maximized) {
×
243
  getInstance()->setValue(SettingsConstants::maximized, maximized);
×
244
}
×
245

246
auto QtPassSettings::getDialogGeometry(const QString &key,
24✔
247
                                       const QByteArray &defaultValue)
248
    -> QByteArray {
249
  return getInstance()
24✔
250
      ->value(SettingsConstants::dialogGeometry + "/" + key, defaultValue)
72✔
251
      .toByteArray();
48✔
252
}
253
void QtPassSettings::setDialogGeometry(const QString &key,
1✔
254
                                       const QByteArray &geometry) {
255
  getInstance()->setValue(SettingsConstants::dialogGeometry + "/" + key,
2✔
256
                          geometry);
257
}
1✔
258

259
auto QtPassSettings::getDialogPos(const QString &key,
1✔
260
                                  const QPoint &defaultValue) -> QPoint {
261
  return getInstance()
1✔
262
      ->value(SettingsConstants::dialogPos + "/" + key, defaultValue)
3✔
263
      .toPoint();
2✔
264
}
265
void QtPassSettings::setDialogPos(const QString &key, const QPoint &pos) {
1✔
266
  getInstance()->setValue(SettingsConstants::dialogPos + "/" + key, pos);
2✔
267
}
1✔
268

269
auto QtPassSettings::getDialogSize(const QString &key,
1✔
270
                                   const QSize &defaultValue) -> QSize {
271
  return getInstance()
1✔
272
      ->value(SettingsConstants::dialogSize + "/" + key, defaultValue)
3✔
273
      .toSize();
2✔
274
}
275
void QtPassSettings::setDialogSize(const QString &key, const QSize &size) {
1✔
276
  getInstance()->setValue(SettingsConstants::dialogSize + "/" + key, size);
2✔
277
}
1✔
278

279
auto QtPassSettings::isDialogMaximized(const QString &key,
25✔
280
                                       const bool &defaultValue) -> bool {
281
  return getInstance()
25✔
282
      ->value(SettingsConstants::dialogMaximized + "/" + key, defaultValue)
75✔
283
      .toBool();
50✔
284
}
285
void QtPassSettings::setDialogMaximized(const QString &key,
2✔
286
                                        const bool &maximized) {
287
  getInstance()->setValue(SettingsConstants::dialogMaximized + "/" + key,
6✔
288
                          maximized);
2✔
289
}
2✔
290

291
void QtPassSettings::setUsePass(const bool &usePass) {
16✔
292
  getInstance()->setValue(SettingsConstants::usePass, usePass);
16✔
293
  // Backend selection changed: force re-selection on next getPass().
294
  PassBackendFactory::invalidate();
16✔
295
}
16✔
296

297
auto QtPassSettings::getAutoclearSeconds(const int &defaultValue) -> int {
12✔
298
  return getInstance()
12✔
299
      ->value(SettingsConstants::autoclearSeconds, defaultValue)
24✔
300
      .toInt();
24✔
301
}
302
void QtPassSettings::setAutoclearSeconds(const int &autoClearSeconds) {
2✔
303
  getInstance()->setValue(SettingsConstants::autoclearSeconds,
2✔
304
                          autoClearSeconds);
305
}
2✔
306

307
auto QtPassSettings::getAutoclearPanelSeconds(const int &defaultValue) -> int {
×
308
  return getInstance()
×
309
      ->value(SettingsConstants::autoclearPanelSeconds, defaultValue)
×
310
      .toInt();
×
311
}
312
void QtPassSettings::setAutoclearPanelSeconds(
2✔
313
    const int &autoClearPanelSeconds) {
314
  getInstance()->setValue(SettingsConstants::autoclearPanelSeconds,
2✔
315
                          autoClearPanelSeconds);
316
}
2✔
317

318
/**
319
 * @brief Retrieves the password store path, normalizes it, and ensures the
320
 * directory exists.
321
 * @example
322
 * QString passStore =
323
 * QtPassSettings::getPassStore("/home/user/.password-store"); qDebug() <<
324
 * passStore; // Expected output: "/home/user/.password-store/"
325
 *
326
 * @param defaultValue - Fallback path used when no password store is
327
 * configured.
328
 * @return QString - The normalized absolute password store path, guaranteed to
329
 * end with a path separator.
330
 */
331
auto QtPassSettings::getPassStore(const QString &defaultValue) -> QString {
33✔
332
  QString returnValue = getInstance()
33✔
333
                            ->value(SettingsConstants::passStore, defaultValue)
66✔
334
                            .toString();
33✔
335

336
  // Normalize the path string
337
  returnValue = QDir(returnValue).absolutePath();
66✔
338

339
  // ensure directory exists if never used pass or misconfigured.
340
  // otherwise process->setWorkingDirectory(passStore); will fail on execution.
341
  if (!QDir(returnValue).exists()) {
33✔
342
    if (!QDir().mkdir(returnValue)) {
4✔
343
      qWarning() << "Failed to create password store directory:" << returnValue;
×
344
    }
345
  }
346

347
  // ensure path ends in /
348
  if (!returnValue.endsWith("/") && !returnValue.endsWith(QDir::separator())) {
66✔
349
    returnValue += QDir::separator();
33✔
350
  }
351

352
  return returnValue;
33✔
353
}
354
void QtPassSettings::setPassStore(const QString &passStore) {
51✔
355
  getInstance()->setValue(SettingsConstants::passStore, passStore);
51✔
356
}
51✔
357

358
auto QtPassSettings::getPassSigningKey(const QString &defaultValue) -> QString {
1✔
359
  return getInstance()
1✔
360
      ->value(SettingsConstants::passSigningKey, defaultValue)
2✔
361
      .toString();
2✔
362
}
363
void QtPassSettings::setPassSigningKey(const QString &passSigningKey) {
2✔
364
  getInstance()->setValue(SettingsConstants::passSigningKey, passSigningKey);
2✔
365
}
2✔
366

367
/**
368
 * @brief Initializes executable paths for Pass, Git, GPG, and Pwgen by locating
369
 * them in the system PATH.
370
 * @example
371
 * QtPassSettings::initExecutables();
372
 *
373
 * @return void - This method does not return a value.
374
 */
375
void QtPassSettings::initExecutables() {
12✔
376
  const AppSettings s = QtPassSettings::load();
12✔
377
  QtPassSettings::setPassExecutable(s.passExecutable.isEmpty()
12✔
378
                                        ? Util::findBinaryInPath("pass")
24✔
379
                                        : s.passExecutable);
380
  QtPassSettings::setGitExecutable(s.gitExecutable.isEmpty()
12✔
381
                                       ? Util::findBinaryInPath("git")
24✔
382
                                       : s.gitExecutable);
383
  QtPassSettings::setGpgExecutable(s.gpgExecutable.isEmpty()
12✔
384
                                       ? Util::findBinaryInPath("gpg2")
24✔
385
                                       : s.gpgExecutable);
386
  QtPassSettings::setPwgenExecutable(s.pwgenExecutable.isEmpty()
12✔
387
                                         ? Util::findBinaryInPath("pwgen")
24✔
388
                                         : s.pwgenExecutable);
389
}
12✔
390
auto QtPassSettings::getPassExecutable(const QString &defaultValue) -> QString {
13✔
391
  return getInstance()
13✔
392
      ->value(SettingsConstants::passExecutable, defaultValue)
26✔
393
      .toString();
26✔
394
}
395
void QtPassSettings::setPassExecutable(const QString &passExecutable) {
12✔
396
  getInstance()->setValue(SettingsConstants::passExecutable, passExecutable);
12✔
397
}
12✔
398

399
void QtPassSettings::setGitExecutable(const QString &gitExecutable) {
13✔
400
  getInstance()->setValue(SettingsConstants::gitExecutable, gitExecutable);
13✔
401
}
13✔
402

403
void QtPassSettings::setGpgExecutable(const QString &gpgExecutable) {
30✔
404
  getInstance()->setValue(SettingsConstants::gpgExecutable, gpgExecutable);
30✔
405
}
30✔
406

407
auto QtPassSettings::getPwgenExecutable(const QString &defaultValue)
×
408
    -> QString {
409
  return getInstance()
×
410
      ->value(SettingsConstants::pwgenExecutable, defaultValue)
×
411
      .toString();
×
412
}
413
void QtPassSettings::setPwgenExecutable(const QString &pwgenExecutable) {
12✔
414
  getInstance()->setValue(SettingsConstants::pwgenExecutable, pwgenExecutable);
12✔
415
}
12✔
416

417
auto QtPassSettings::isUseWebDav(const bool &defaultValue) -> bool {
12✔
418
  return getInstance()
12✔
419
      ->value(SettingsConstants::useWebDav, defaultValue)
24✔
420
      .toBool();
24✔
421
}
422
auto QtPassSettings::getProfile(const QString &defaultValue) -> QString {
26✔
423
  return getInstance()
26✔
424
      ->value(SettingsConstants::profile, defaultValue)
52✔
425
      .toString();
52✔
426
}
427
void QtPassSettings::setProfile(const QString &profile) {
1✔
428
  getInstance()->setValue(SettingsConstants::profile, profile);
1✔
429
}
1✔
430

431
/**
432
 * @brief Gets the useGit setting for a specific profile.
433
 * @param profileName The profile name.
434
 * @param defaultValue The default value if not set.
435
 * @return The useGit setting for the profile.
436
 */
437
auto QtPassSettings::getProfileUseGit(const QString &profileName,
3✔
438
                                      const bool &defaultValue) -> bool {
439
  QString stored =
440
      getInstance()
3✔
441
          ->value(SettingsConstants::profile + "/" + profileName + "/useGit")
9✔
442
          .toString();
3✔
443
  // If empty or not set, return default (migration-friendly fallback)
444
  if (stored.isEmpty()) {
3✔
445
    return defaultValue;
1✔
446
  }
447
  return stored == "true";
448
}
449

450
/**
451
 * @brief Sets the useGit setting for a specific profile.
452
 * @param profileName The profile name.
453
 * @param useGit The useGit value to set.
454
 */
455
void QtPassSettings::setProfileUseGit(const QString &profileName,
2✔
456
                                      const bool &useGit) {
457
  getInstance()->setValue(SettingsConstants::profile + "/" + profileName +
6✔
458
                              "/useGit",
459
                          useGit ? "true" : "false");
2✔
460
}
2✔
461

462
/**
463
 * @brief Gets the autoPush setting for a specific profile.
464
 * @param profileName The profile name.
465
 * @param defaultValue The default value if not set.
466
 * @return The autoPush setting for the profile.
467
 */
468
auto QtPassSettings::getProfileAutoPush(const QString &profileName,
3✔
469
                                        const bool &defaultValue) -> bool {
470
  QString stored =
471
      getInstance()
3✔
472
          ->value(SettingsConstants::profile + "/" + profileName + "/autoPush")
9✔
473
          .toString();
3✔
474
  if (stored.isEmpty()) {
3✔
475
    return defaultValue;
1✔
476
  }
477
  return stored == "true";
478
}
479

480
/**
481
 * @brief Sets the autoPush setting for a specific profile.
482
 * @param profileName The profile name.
483
 * @param autoPush The autoPush value to set.
484
 */
485
void QtPassSettings::setProfileAutoPush(const QString &profileName,
2✔
486
                                        const bool &autoPush) {
487
  getInstance()->setValue(SettingsConstants::profile + "/" + profileName +
6✔
488
                              "/autoPush",
489
                          autoPush ? "true" : "false");
2✔
490
}
2✔
491

492
/**
493
 * @brief Gets the autoPull setting for a specific profile.
494
 * @param profileName The profile name.
495
 * @param defaultValue The default value if not set.
496
 * @return The autoPull setting for the profile.
497
 */
498
auto QtPassSettings::getProfileAutoPull(const QString &profileName,
3✔
499
                                        const bool &defaultValue) -> bool {
500
  QString stored =
501
      getInstance()
3✔
502
          ->value(SettingsConstants::profile + "/" + profileName + "/autoPull")
9✔
503
          .toString();
3✔
504
  if (stored.isEmpty()) {
3✔
505
    return defaultValue;
1✔
506
  }
507
  return stored == "true";
508
}
509

510
/**
511
 * @brief Sets the autoPull setting for a specific profile.
512
 * @param profileName The profile name.
513
 * @param autoPull The autoPull value to set.
514
 */
515
void QtPassSettings::setProfileAutoPull(const QString &profileName,
2✔
516
                                        const bool &autoPull) {
517
  getInstance()->setValue(SettingsConstants::profile + "/" + profileName +
6✔
518
                              "/autoPull",
519
                          autoPull ? "true" : "false");
2✔
520
}
2✔
521

522
/**
523
 * @brief Determines whether Git should be used for the current QtPass settings.
524
 * @example
525
 * bool result = QtPassSettings::isUseGit(true);
526
 * std::cout << result << std::endl; // Expected output: true or false
527
 *
528
 * @param const bool &defaultValue - The fallback value used when no explicit
529
 * setting is stored.
530
 * @return bool - True if Git usage is enabled, otherwise false.
531
 */
532
auto QtPassSettings::isUseGit(const bool &defaultValue) -> bool {
6✔
533
  bool storedValue =
534
      getInstance()->value(SettingsConstants::useGit, defaultValue).toBool();
6✔
535
  if (storedValue == defaultValue && defaultValue) {
6✔
536
    QString passStore = getPassStore();
4✔
537
    if (QFileInfo(passStore).isDir() &&
4✔
538
        QFileInfo(passStore + QDir::separator() + ".git").isDir()) {
6✔
539
      return true;
540
    }
541
  }
542
  return storedValue;
543
}
544
auto QtPassSettings::isUseGrepSearch(const bool &defaultValue) -> bool {
12✔
545
  return getInstance()
12✔
546
      ->value(SettingsConstants::useGrepSearch, defaultValue)
24✔
547
      .toBool();
24✔
548
}
549

550
auto QtPassSettings::isUseOtp(const bool &defaultValue) -> bool {
15✔
551
  return getInstance()->value(SettingsConstants::useOtp, defaultValue).toBool();
15✔
552
}
553

554
void QtPassSettings::setQrencodeExecutable(const QString &qrencodeExecutable) {
13✔
555
  getInstance()->setValue(SettingsConstants::qrencodeExecutable,
13✔
556
                          qrencodeExecutable);
557
}
13✔
558

559
void QtPassSettings::setUsePwgen(const bool &usePwgen) {
4✔
560
  getInstance()->setValue(SettingsConstants::usePwgen, usePwgen);
4✔
561
}
4✔
562

563
auto QtPassSettings::isHideOnClose(const bool &defaultValue) -> bool {
×
564
  return getInstance()
×
565
      ->value(SettingsConstants::hideOnClose, defaultValue)
×
566
      .toBool();
×
567
}
568
auto QtPassSettings::isAlwaysOnTop(const bool &defaultValue) -> bool {
×
569
  return getInstance()
×
570
      ->value(SettingsConstants::alwaysOnTop, defaultValue)
×
571
      .toBool();
×
572
}
573

574
auto QtPassSettings::isAutoPush(const bool &defaultValue) -> bool {
×
575
  return getInstance()
×
576
      ->value(SettingsConstants::autoPush, defaultValue)
×
577
      .toBool();
×
578
}
579
auto QtPassSettings::getPassTemplate(const QString &defaultValue) -> QString {
12✔
580
  return getInstance()
12✔
581
      ->value(SettingsConstants::passTemplate, defaultValue)
24✔
582
      .toString();
24✔
583
}
584
void QtPassSettings::setPassTemplate(const QString &passTemplate) {
×
585
  getInstance()->setValue(SettingsConstants::passTemplate, passTemplate);
×
586
}
×
587

588
auto QtPassSettings::isShowProcessOutput(const bool &defaultValue) -> bool {
15✔
589
  return getInstance()
15✔
590
      ->value(SettingsConstants::showProcessOutput, defaultValue)
30✔
591
      .toBool();
30✔
592
}
593
auto QtPassSettings::getRealPass() -> RealPass * {
12✔
594
  return PassBackendFactory::getRealPass();
12✔
595
}
596
auto QtPassSettings::getImitatePass() -> ImitatePass * {
36✔
597
  return PassBackendFactory::getImitatePass();
36✔
598
}
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