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

IJHack / QtPass / 24609334109

18 Apr 2026 04:50PM UTC coverage: 22.734% (+0.8%) from 21.908%
24609334109

Pull #1037

github

web-flow
Merge f564bc578 into 68ca2a489
Pull Request #1037: feat: implement pass grep content search (#109)

76 of 192 new or added lines in 7 files covered. (39.58%)

401 existing lines in 9 files now uncovered.

1299 of 5714 relevant lines covered (22.73%)

8.6 hits per line

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

0.0
/src/configdialog.cpp
1
// SPDX-FileCopyrightText: 2014 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
#include "configdialog.h"
4
#include "keygendialog.h"
5
#include "mainwindow.h"
6
#include "profileinit.h"
7
#include "qtpasssettings.h"
8
#include "ui_configdialog.h"
9
#include "usersdialog.h"
10
#include "util.h"
11
#include <QClipboard>
12
#include <QDir>
13
#include <QFileDialog>
14
#include <QMessageBox>
15
#include <QPushButton>
16
#include <QSystemTrayIcon>
17
#include <QTableWidgetItem>
18
#include <utility>
19
#ifdef Q_OS_WIN
20
#include <windows.h>
21
#endif
22

23
#ifdef QT_DEBUG
24
#include "debughelper.h"
25
#endif
26

27
/**
28
 * @brief ConfigDialog::ConfigDialog this sets up the configuration screen.
29
 * @param parent
30
 */
31
ConfigDialog::ConfigDialog(MainWindow *parent)
×
32
    : QDialog(parent), ui(new Ui::ConfigDialog) {
×
33
  mainWindow = parent;
×
34
  ui->setupUi(this);
×
35

36
  // Restore dialog state
37
  QByteArray savedGeometry = QtPassSettings::getDialogGeometry("configDialog");
×
38
  bool hasSavedGeometry = !savedGeometry.isEmpty();
39
  if (hasSavedGeometry) {
×
40
    restoreGeometry(savedGeometry);
×
41
  }
42
  if (QtPassSettings::isDialogMaximized("configDialog")) {
×
43
    showMaximized();
×
44
  } else if (!hasSavedGeometry) {
45
    // Let window manager handle positioning for first launch
46
  }
47

48
  ui->passPath->setText(QtPassSettings::getPassExecutable());
×
49
  setGitPath(QtPassSettings::getGitExecutable());
×
50
  ui->gpgPath->setText(QtPassSettings::getGpgExecutable());
×
51
  ui->storePath->setText(QtPassSettings::getPassStore());
×
52

53
  ui->spinBoxAutoclearSeconds->setValue(QtPassSettings::getAutoclearSeconds());
×
54
  ui->spinBoxAutoclearPanelSeconds->setValue(
×
55
      QtPassSettings::getAutoclearPanelSeconds());
×
56
  ui->checkBoxHidePassword->setChecked(QtPassSettings::isHidePassword());
×
57
  ui->checkBoxHideContent->setChecked(QtPassSettings::isHideContent());
×
58
  ui->checkBoxUseMonospace->setChecked(QtPassSettings::isUseMonospace());
×
59
  ui->checkBoxDisplayAsIs->setChecked(QtPassSettings::isDisplayAsIs());
×
60
  ui->checkBoxNoLineWrapping->setChecked(QtPassSettings::isNoLineWrapping());
×
61
  ui->checkBoxAddGPGId->setChecked(QtPassSettings::isAddGPGId(true));
×
62

63
  if (QSystemTrayIcon::isSystemTrayAvailable()) {
×
64
    ui->checkBoxHideOnClose->setChecked(QtPassSettings::isHideOnClose());
×
65
    ui->checkBoxStartMinimized->setChecked(QtPassSettings::isStartMinimized());
×
66
  } else {
67
    ui->checkBoxUseTrayIcon->setEnabled(false);
×
68
    ui->checkBoxUseTrayIcon->setToolTip(tr("System tray is not available"));
×
69
    ui->checkBoxHideOnClose->setEnabled(false);
×
70
    ui->checkBoxStartMinimized->setEnabled(false);
×
71
  }
72

73
  ui->checkBoxAvoidCapitals->setChecked(QtPassSettings::isAvoidCapitals());
×
74
  ui->checkBoxAvoidNumbers->setChecked(QtPassSettings::isAvoidNumbers());
×
75
  ui->checkBoxLessRandom->setChecked(QtPassSettings::isLessRandom());
×
76
  ui->checkBoxUseSymbols->setChecked(QtPassSettings::isUseSymbols());
×
77
  ui->plainTextEditTemplate->setPlainText(QtPassSettings::getPassTemplate());
×
78
  ui->checkBoxTemplateAllFields->setChecked(
×
79
      QtPassSettings::isTemplateAllFields());
×
80
  ui->checkBoxAutoPull->setChecked(QtPassSettings::isAutoPull());
×
81
  ui->checkBoxAutoPush->setChecked(QtPassSettings::isAutoPush());
×
82
  ui->checkBoxAlwaysOnTop->setChecked(QtPassSettings::isAlwaysOnTop());
×
83

84
#if defined(Q_OS_WIN)
85
  ui->checkBoxUseOtp->hide();
86
  ui->checkBoxUseQrencode->hide();
87
  ui->label_10->hide();
88
#endif
89

90
  if (!isPassOtpAvailable()) {
×
91
    ui->checkBoxUseOtp->setEnabled(false);
×
92
    ui->checkBoxUseOtp->setToolTip(
×
93
        tr("Pass OTP extension needs to be installed"));
×
94
  }
95

96
  if (!isQrencodeAvailable()) {
×
97
    ui->checkBoxUseQrencode->setEnabled(false);
×
98
    ui->checkBoxUseQrencode->setToolTip(tr("qrencode needs to be installed"));
×
99
  }
100

101
  setProfiles(QtPassSettings::getProfiles(), QtPassSettings::getProfile());
×
102
  setPwgenPath(QtPassSettings::getPwgenExecutable());
×
103
  setPasswordConfiguration(QtPassSettings::getPasswordConfiguration());
×
104

105
  usePass(QtPassSettings::isUsePass());
×
106
  useAutoclear(QtPassSettings::isUseAutoclear());
×
107
  useAutoclearPanel(QtPassSettings::isUseAutoclearPanel());
×
108
  useTrayIcon(QtPassSettings::isUseTrayIcon());
×
109
  useGit(QtPassSettings::isUseGit());
×
110

111
  useOtp(QtPassSettings::isUseOtp());
×
112
  useGrepSearch(QtPassSettings::isUseGrepSearch());
×
113
  useQrencode(QtPassSettings::isUseQrencode());
×
114

115
  usePwgen(QtPassSettings::isUsePwgen());
×
116
  useTemplate(QtPassSettings::isUseTemplate());
×
117

118
  ui->profileTable->verticalHeader()->hide();
×
119
  ui->profileTable->horizontalHeader()->setSectionResizeMode(
×
120
      1, QHeaderView::Stretch);
121
  ui->label->setText(ui->label->text() + VERSION);
×
122
  ui->comboBoxClipboard->clear();
×
123

124
  ui->comboBoxClipboard->addItem(tr("No Clipboard"));
×
125
  ui->comboBoxClipboard->addItem(tr("Always copy to clipboard"));
×
126
  ui->comboBoxClipboard->addItem(tr("On-demand copy to clipboard"));
×
127

128
  int currentIndex = QtPassSettings::getClipBoardTypeRaw();
×
129
  ui->comboBoxClipboard->setCurrentIndex(currentIndex);
×
130
  on_comboBoxClipboard_activated(currentIndex);
×
131

132
  QClipboard *clip = QApplication::clipboard();
×
133
  if (!clip->supportsSelection()) {
×
134
    useSelection(false);
×
135
    ui->checkBoxSelection->setVisible(false);
×
136
  } else {
137
    useSelection(QtPassSettings::isUseSelection());
×
138
  }
139

140
  if (!Util::configIsValid()) {
×
141
    // Show Programs tab, which is likely
142
    // what the user needs to fix now.
143
    ui->tabWidget->setCurrentIndex(1);
×
144
  }
145

146
  connect(ui->profileTable, &QTableWidget::itemChanged, this,
×
147
          &ConfigDialog::onProfileTableItemChanged);
×
148
  connect(this, &ConfigDialog::accepted, this, &ConfigDialog::on_accepted);
×
149
}
×
150

151
/**
152
 * @brief ConfigDialog::~ConfigDialog config destructor, makes sure the
153
 * mainWindow knows about git, gpg and pass executables.
154
 */
155
ConfigDialog::~ConfigDialog() {
×
156
  QtPassSettings::setGitExecutable(ui->gitPath->text());
×
157
  QtPassSettings::setGpgExecutable(ui->gpgPath->text());
×
158
  QtPassSettings::setPassExecutable(ui->passPath->text());
×
159
}
×
160

161
/**
162
 * @brief ConfigDialog::setGitPath set the git executable path.
163
 * Make sure the checkBoxUseGit is updated.
164
 * @param path
165
 */
166
void ConfigDialog::setGitPath(const QString &path) {
×
167
  ui->gitPath->setText(path);
×
168
  ui->checkBoxUseGit->setEnabled(!path.isEmpty());
×
169
  if (path.isEmpty()) {
×
170
    useGit(false);
×
171
  }
172
}
×
173

174
/**
175
 * @brief ConfigDialog::usePass set wether or not we want to use pass.
176
 * Update radio buttons accordingly.
177
 * @param usePass
178
 */
179
void ConfigDialog::usePass(bool usePass) {
×
180
  ui->radioButtonNative->setChecked(!usePass);
×
181
  ui->radioButtonPass->setChecked(usePass);
×
182
  setGroupBoxState();
×
183
}
×
184

185
/**
186
 * @brief Validates the configuration table fields and enables or disables the
187
 * OK button accordingly.
188
 * @example
189
 * ConfigDialog dialog;
190
 * QTableWidgetItem *item = dialog.findChild<QTableWidgetItem*>();
191
 * dialog.validate(item);
192
 *
193
 * @param QTableWidgetItem *item - The table item to validate; if null,
194
 * validates all relevant items in the profile table.
195
 * @return void - This function does not return a value.
196
 */
197
void ConfigDialog::validate(QTableWidgetItem *item) {
×
198
  bool status = true;
199

200
  if (item == nullptr) {
×
201
    for (int i = 0; i < ui->profileTable->rowCount(); i++) {
×
202
      for (int j = 0; j < ui->profileTable->columnCount(); j++) {
×
203
        QTableWidgetItem *_item = ui->profileTable->item(i, j);
×
204

205
        if (_item->text().isEmpty() && j != 2) {
×
206
          _item->setBackground(Qt::red);
×
207
          _item->setToolTip(tr("This field is required"));
×
208
          status = false;
209
          break;
210
        } else {
211
          _item->setBackground(QBrush());
×
212
          _item->setToolTip(QString());
×
213
        }
214
      }
215

216
      if (!status) {
217
        break;
218
      }
219
    }
220
  } else {
221
    if (item->text().isEmpty() && item->column() != 2) {
×
222
      item->setBackground(Qt::red);
×
223
      item->setToolTip(tr("This field is required"));
×
224
      status = false;
225
    } else {
226
      item->setBackground(QBrush());
×
227
      item->setToolTip(QString());
×
228
    }
229
  }
230

231
  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status);
×
232
}
×
233

234
/**
235
 * @brief Saves the configuration dialog settings to persistent application
236
 * settings.
237
 * @example
238
 * ConfigDialog dialog;
239
 * dialog.on_accepted();
240
 * // Expected output: All UI-selected configuration values are stored via
241
 * QtPassSettings.
242
 *
243
 * @return void - This method does not return a value.
244
 */
245
void ConfigDialog::on_accepted() {
×
246
  QtPassSettings::setPassExecutable(ui->passPath->text());
×
247
  QtPassSettings::setGitExecutable(ui->gitPath->text());
×
248
  QtPassSettings::setGpgExecutable(ui->gpgPath->text());
×
249
  QtPassSettings::setPassStore(
×
250
      Util::normalizeFolderPath(ui->storePath->text()));
×
251
  QtPassSettings::setUsePass(ui->radioButtonPass->isChecked());
×
252
  QtPassSettings::setClipBoardType(ui->comboBoxClipboard->currentIndex());
×
253
  QtPassSettings::setUseSelection(ui->checkBoxSelection->isChecked());
×
254
  QtPassSettings::setUseAutoclear(ui->checkBoxAutoclear->isChecked());
×
255
  QtPassSettings::setAutoclearSeconds(ui->spinBoxAutoclearSeconds->value());
×
256
  QtPassSettings::setUseAutoclearPanel(ui->checkBoxAutoclearPanel->isChecked());
×
257
  QtPassSettings::setAutoclearPanelSeconds(
×
258
      ui->spinBoxAutoclearPanelSeconds->value());
×
259
  QtPassSettings::setHidePassword(ui->checkBoxHidePassword->isChecked());
×
260
  QtPassSettings::setHideContent(ui->checkBoxHideContent->isChecked());
×
261
  QtPassSettings::setUseMonospace(ui->checkBoxUseMonospace->isChecked());
×
262
  QtPassSettings::setDisplayAsIs(ui->checkBoxDisplayAsIs->isChecked());
×
263
  QtPassSettings::setNoLineWrapping(ui->checkBoxNoLineWrapping->isChecked());
×
264
  QtPassSettings::setAddGPGId(ui->checkBoxAddGPGId->isChecked());
×
265
  QtPassSettings::setUseTrayIcon(ui->checkBoxUseTrayIcon->isEnabled() &&
×
266
                                 ui->checkBoxUseTrayIcon->isChecked());
×
267
  QtPassSettings::setHideOnClose(ui->checkBoxHideOnClose->isEnabled() &&
×
268
                                 ui->checkBoxHideOnClose->isChecked());
×
269
  QtPassSettings::setStartMinimized(ui->checkBoxStartMinimized->isEnabled() &&
×
270
                                    ui->checkBoxStartMinimized->isChecked());
×
271
  QHash<QString, QHash<QString, QString>> existingProfiles =
NEW
272
      QtPassSettings::getProfiles();
×
273
  QtPassSettings::setProfiles(getProfiles());
×
274
  QtPassSettings::setUseGit(ui->checkBoxUseGit->isChecked());
×
275
  QtPassSettings::setUseOtp(ui->checkBoxUseOtp->isChecked());
×
276
  QtPassSettings::setUseGrepSearch(ui->checkBoxUseGrepSearch->isChecked());
×
277
  QtPassSettings::setUseQrencode(ui->checkBoxUseQrencode->isChecked());
×
278
  QtPassSettings::setPwgenExecutable(ui->pwgenPath->text());
×
279
  QtPassSettings::setUsePwgen(ui->checkBoxUsePwgen->isChecked());
×
280
  QtPassSettings::setAvoidCapitals(ui->checkBoxAvoidCapitals->isChecked());
×
281
  QtPassSettings::setAvoidNumbers(ui->checkBoxAvoidNumbers->isChecked());
×
282
  QtPassSettings::setLessRandom(ui->checkBoxLessRandom->isChecked());
×
283
  QtPassSettings::setUseSymbols(ui->checkBoxUseSymbols->isChecked());
×
284
  QtPassSettings::setPasswordConfiguration(getPasswordConfiguration());
×
285
  QtPassSettings::setUseTemplate(ui->checkBoxUseTemplate->isChecked());
×
286
  QtPassSettings::setPassTemplate(ui->plainTextEditTemplate->toPlainText());
×
287
  QtPassSettings::setTemplateAllFields(
×
288
      ui->checkBoxTemplateAllFields->isChecked());
×
289
  QtPassSettings::setAutoPush(ui->checkBoxAutoPush->isChecked());
×
290
  QtPassSettings::setAutoPull(ui->checkBoxAutoPull->isChecked());
×
291
  QtPassSettings::setAlwaysOnTop(ui->checkBoxAlwaysOnTop->isChecked());
×
292

293
  QtPassSettings::setVersion(VERSION);
×
294

295
  // Initialize new profiles that need pass/git initialization
296
  initializeNewProfiles(existingProfiles);
×
297
}
×
298

299
/**
300
 * @brief Automatically detects required external binaries in the system PATH
301
 * and updates the dialog fields.
302
 * @example
303
 * ConfigDialog configDialog;
304
 * configDialog.on_autodetectButton_clicked();
305
 *
306
 * @return void - This function does not return a value.
307
 */
308
void ConfigDialog::on_autodetectButton_clicked() {
×
309
  QString pass = Util::findBinaryInPath("pass");
×
310
  if (!pass.isEmpty()) {
×
311
    ui->passPath->setText(pass);
×
312
  }
313
  usePass(!pass.isEmpty());
×
314
  QString gpg = Util::findBinaryInPath("gpg2");
×
315
  if (gpg.isEmpty()) {
×
316
    gpg = Util::findBinaryInPath("gpg");
×
317
  }
318
  if (!gpg.isEmpty()) {
×
319
    ui->gpgPath->setText(gpg);
×
320
  }
321
  QString git = Util::findBinaryInPath("git");
×
322
  if (!git.isEmpty()) {
×
323
    ui->gitPath->setText(git);
×
324
  }
325
  QString pwgen = Util::findBinaryInPath("pwgen");
×
326
  if (!pwgen.isEmpty()) {
×
327
    ui->pwgenPath->setText(pwgen);
×
328
  }
329
}
×
330

331
/**
332
 * @brief ConfigDialog::on_radioButtonNative_clicked wrapper for
333
 * ConfigDialog::setGroupBoxState()
334
 */
335
void ConfigDialog::on_radioButtonNative_clicked() { setGroupBoxState(); }
×
336

337
/**
338
 * @brief ConfigDialog::on_radioButtonPass_clicked wrapper for
339
 * ConfigDialog::setGroupBoxState()
340
 */
341
void ConfigDialog::on_radioButtonPass_clicked() { setGroupBoxState(); }
×
342

343
/**
344
 * @brief ConfigDialog::getSecretKeys get list of secret/private keys
345
 * @return QStringList keys
346
 */
347
auto ConfigDialog::getSecretKeys() -> QStringList {
×
348
  QList<UserInfo> keys = QtPassSettings::getPass()->listKeys("", true);
×
349
  QStringList names;
×
350

351
  if (keys.empty()) {
×
352
    return names;
353
  }
354

355
  foreach (const UserInfo &sec, keys)
×
356
    names << sec.name;
×
357

358
  return names;
×
359
}
360

361
/**
362
 * @brief ConfigDialog::setGroupBoxState update checkboxes.
363
 */
364
void ConfigDialog::setGroupBoxState() {
×
365
  bool state = ui->radioButtonPass->isChecked();
×
366
  ui->groupBoxNative->setEnabled(!state);
×
367
  ui->groupBoxPass->setEnabled(state);
×
368
  if (state) {
×
369
    // pass mode: disable all password generation controls
370
    ui->spinBoxPasswordLength->setEnabled(false);
×
371
    ui->checkBoxUsePwgen->setEnabled(false);
×
372
    ui->checkBoxAvoidCapitals->setEnabled(false);
×
373
    ui->checkBoxUseSymbols->setEnabled(false);
×
374
    ui->checkBoxLessRandom->setEnabled(false);
×
375
    ui->checkBoxAvoidNumbers->setEnabled(false);
×
376
    ui->labelPasswordChars->setEnabled(false);
×
377
    ui->passwordCharTemplateSelector->setEnabled(false);
×
378
    ui->lineEditPasswordChars->setEnabled(false);
×
379
  } else {
380
    // native mode: restore pwgen/charset state from existing handlers
381
    ui->spinBoxPasswordLength->setEnabled(true);
×
382
    ui->checkBoxUsePwgen->setEnabled(!ui->pwgenPath->text().isEmpty());
×
383
    on_checkBoxUsePwgen_clicked();
×
384
  }
385
}
×
386

387
/**
388
 * @brief ConfigDialog::selectExecutable pop-up to choose an executable.
389
 * @return
390
 */
391
auto ConfigDialog::selectExecutable() -> QString {
×
392
  QFileDialog dialog(this);
×
393
  dialog.setFileMode(QFileDialog::ExistingFile);
×
394
  dialog.setOption(QFileDialog::ReadOnly);
×
395
  if (dialog.exec()) {
×
396
    return dialog.selectedFiles().constFirst();
×
397
  }
398

399
  return {};
400
}
×
401

402
/**
403
 * @brief ConfigDialog::selectFolder pop-up to choose a folder.
404
 * @return
405
 */
406
auto ConfigDialog::selectFolder() -> QString {
×
407
  QFileDialog dialog(this);
×
408
  dialog.setFileMode(QFileDialog::Directory);
×
409
  dialog.setFilter(QDir::NoFilter);
×
410
  dialog.setOption(QFileDialog::ShowDirsOnly);
×
411
  if (dialog.exec()) {
×
412
    return dialog.selectedFiles().constFirst();
×
413
  }
414

415
  return {};
416
}
×
417

418
/**
419
 * @brief ConfigDialog::on_toolButtonGit_clicked get git application.
420
 * Enable checkboxes if found.
421
 */
422
void ConfigDialog::on_toolButtonGit_clicked() {
×
423
  QString git = selectExecutable();
×
424
  bool state = !git.isEmpty();
×
425
  if (state) {
×
426
    ui->gitPath->setText(git);
×
427
  } else {
428
    useGit(false);
×
429
  }
430

431
  ui->checkBoxUseGit->setEnabled(state);
×
432
}
×
433

434
/**
435
 * @brief ConfigDialog::on_toolButtonGpg_clicked get gpg application.
436
 */
437
void ConfigDialog::on_toolButtonGpg_clicked() {
×
438
  QString gpg = selectExecutable();
×
439
  if (!gpg.isEmpty()) {
×
440
    ui->gpgPath->setText(gpg);
×
441
  }
442
}
×
443

444
/**
445
 * @brief ConfigDialog::on_pushButtonGenerateKey_clicked open keygen dialog.
446
 */
447
void ConfigDialog::on_pushButtonGenerateKey_clicked() {
×
448
  KeygenDialog d(this);
×
449
  d.exec();
×
450
}
×
451

452
/**
453
 * @brief ConfigDialog::on_toolButtonPass_clicked get pass application.
454
 */
455
void ConfigDialog::on_toolButtonPass_clicked() {
×
456
  QString pass = selectExecutable();
×
457
  if (!pass.isEmpty()) {
×
458
    ui->passPath->setText(pass);
×
459
  }
460
}
×
461

462
/**
463
 * @brief ConfigDialog::on_toolButtonStore_clicked get .password-store
464
 * location.
465
 */
466
void ConfigDialog::on_toolButtonStore_clicked() {
×
467
  QString store = selectFolder();
×
468
  if (!store.isEmpty()) {
×
469
    ui->storePath->setText(store);
×
470
  }
471
}
×
472

473
/**
474
 * @brief ConfigDialog::on_comboBoxClipboard_activated show and hide options.
475
 * @param index of selectbox (0 = no clipboard).
476
 */
477
void ConfigDialog::on_comboBoxClipboard_activated(int index) {
×
478
  bool state = index > 0;
×
479

480
  ui->checkBoxSelection->setEnabled(state);
×
481
  ui->checkBoxAutoclear->setEnabled(state);
×
482
  ui->checkBoxHidePassword->setEnabled(state);
×
483
  ui->checkBoxHideContent->setEnabled(state);
×
484
  if (state) {
×
485
    ui->spinBoxAutoclearSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
×
486
    ui->labelSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
×
487
  } else {
488
    ui->spinBoxAutoclearSeconds->setEnabled(false);
×
489
    ui->labelSeconds->setEnabled(false);
×
490
  }
491
}
×
492

493
/**
494
 * @brief ConfigDialog::on_checkBoxAutoclearPanel_clicked enable and disable
495
 * options based on autoclear use.
496
 */
497
void ConfigDialog::on_checkBoxAutoclearPanel_clicked() {
×
498
  bool state = ui->checkBoxAutoclearPanel->isChecked();
×
499
  ui->spinBoxAutoclearPanelSeconds->setEnabled(state);
×
500
  ui->labelPanelSeconds->setEnabled(state);
×
501
}
×
502

503
/**
504
 * @brief ConfigDialog::useSelection set the clipboard type use from
505
 * MainWindow.
506
 * @param useSelection
507
 */
508
void ConfigDialog::useSelection(bool useSelection) {
×
509
  ui->checkBoxSelection->setChecked(useSelection);
×
510
  on_checkBoxSelection_clicked();
×
511
}
×
512

513
/**
514
 * @brief ConfigDialog::useAutoclear set the clipboard autoclear use from
515
 * MainWindow.
516
 * @param useAutoclear
517
 */
518
void ConfigDialog::useAutoclear(bool useAutoclear) {
×
519
  ui->checkBoxAutoclear->setChecked(useAutoclear);
×
520
  on_checkBoxAutoclear_clicked();
×
521
}
×
522

523
/**
524
 * @brief ConfigDialog::useAutoclearPanel set the panel autoclear use from
525
 * MainWindow.
526
 * @param useAutoclearPanel
527
 */
528
void ConfigDialog::useAutoclearPanel(bool useAutoclearPanel) {
×
529
  ui->checkBoxAutoclearPanel->setChecked(useAutoclearPanel);
×
530
  on_checkBoxAutoclearPanel_clicked();
×
531
}
×
532

533
/**
534
 * @brief ConfigDialog::on_checkBoxSelection_clicked checkbox clicked, update
535
 * state via ConfigDialog::on_comboBoxClipboard_activated
536
 */
537
void ConfigDialog::on_checkBoxSelection_clicked() {
×
538
  on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
×
539
}
×
540

541
/**
542
 * @brief ConfigDialog::on_checkBoxAutoclear_clicked checkbox clicked, update
543
 * state via ConfigDialog::on_comboBoxClipboard_activated
544
 */
545
void ConfigDialog::on_checkBoxAutoclear_clicked() {
×
546
  on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
×
547
}
×
548

549
/**
550
 * @brief ConfigDialog::genKey tunnel function to make MainWindow generate a
551
 * gpg key pair.
552
 * @todo refactor the process to not be entangled so much.
553
 * @param batch
554
 * @param dialog
555
 */
556
void ConfigDialog::genKey(const QString &batch, QDialog *dialog) {
×
557
  mainWindow->generateKeyPair(batch, dialog);
×
558
}
×
559

560
/**
561
 * @brief ConfigDialog::setProfiles set the profiles and chosen profile from
562
 * MainWindow.
563
 * @param profiles
564
 * @param profile
565
 */
566
void ConfigDialog::setProfiles(QHash<QString, QHash<QString, QString>> profiles,
×
567
                               const QString &currentProfile) {
568
  if (profiles.contains("")) {
×
569
    profiles.remove("");
×
570
    // remove weird "" key value pairs
571
  }
572

573
  ui->profileTable->setRowCount(profiles.count());
×
574
  QHashIterator<QString, QHash<QString, QString>> i(profiles);
×
575
  int n = 0;
576
  while (i.hasNext()) {
×
577
    i.next();
578
    if (!i.value().isEmpty() && !i.key().isEmpty()) {
×
579
      ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key()));
×
580
      ui->profileTable->setItem(n, 1,
×
581
                                new QTableWidgetItem(i.value().value("path")));
×
582
      ui->profileTable->setItem(
×
583
          n, 2, new QTableWidgetItem(i.value().value("signingKey")));
×
584
      if (i.key() == currentProfile) {
×
585
        ui->profileTable->selectRow(n);
×
586
      }
587
    }
588
    ++n;
×
589
  }
590
}
×
591

592
/**
593
 * @brief ConfigDialog::getProfiles return profile list.
594
 * @return
595
 */
596
auto ConfigDialog::getProfiles() -> QHash<QString, QHash<QString, QString>> {
×
597
  QHash<QString, QHash<QString, QString>> profiles;
×
598
  // Check?
599
  for (int i = 0; i < ui->profileTable->rowCount(); ++i) {
×
600
    QHash<QString, QString> profile;
×
601
    QTableWidgetItem *pathItem = ui->profileTable->item(i, 1);
×
602
    if (nullptr != pathItem) {
×
603
      QTableWidgetItem *item = ui->profileTable->item(i, 0);
×
604
      if (item == nullptr) {
×
605
        continue;
606
      }
607
      profile["path"] = pathItem->text();
×
608
      QTableWidgetItem *signingKeyItem = ui->profileTable->item(i, 2);
×
609
      if (nullptr != signingKeyItem) {
×
610
        profile["signingKey"] = signingKeyItem->text();
×
611
      }
612
      profiles.insert(item->text(), profile);
×
613
    }
614
  }
×
615
  return profiles;
×
616
}
×
617

618
/**
619
 * @brief Initialize new profiles that need pass/git initialization.
620
 * @param existingProfiles The profiles that existed before the dialog was
621
 * opened.
622
 */
623
void ConfigDialog::initializeNewProfiles(
×
624
    const QHash<QString, QHash<QString, QString>> &existingProfiles) {
625
  QHash<QString, QHash<QString, QString>> newProfiles = getProfiles();
×
626

627
  // Collect keys and sort for deterministic iteration
628
  QStringList keys = newProfiles.keys();
×
629
  keys.sort();
630

631
  for (const QString &name : keys) {
×
632
    const QString &path = newProfiles.value(name).value("path");
×
633

634
    // Skip if already existed before (check by name and path)
635
    if (existingProfiles.contains(name) &&
×
636
        existingProfiles.value(name).value("path") == path) {
×
637
      continue;
×
638
    }
639

640
    // This is a new profile - check if needs initialization
641
    // needsInit returns false for non-existent directories
642
    if (!ProfileInit::needsInit(path)) {
×
643
      continue;
×
644
    }
645

646
    // Temporarily switch the active store so pass/git init operate on
647
    // the new profile's directory rather than the currently-saved one.
648
    const QString prevStore = QtPassSettings::getPassStore();
×
649
    QtPassSettings::setPassStore(path);
×
650

651
    // Show user selection dialog for GPG recipients
652
    // UsersDialog will run pass init when accepted
653
    UsersDialog usersDialog(path, this);
×
654
    usersDialog.setWindowTitle(tr("Select recipients for %1").arg(name));
×
655
    const int result = usersDialog.exec();
×
656

657
    if (result == QDialog::Accepted && ui->checkBoxUseGit->isChecked()) {
×
658
      QtPassSettings::getPass()->GitInit();
×
659
    }
660

661
    // Restore previous store setting
662
    QtPassSettings::setPassStore(prevStore);
×
663
  }
×
664
}
×
665

666
/**
667
 * @brief ConfigDialog::on_addButton_clicked add a profile row.
668
 */
669
void ConfigDialog::on_addButton_clicked() {
×
670
  int n = ui->profileTable->rowCount();
×
671
  ui->profileTable->insertRow(n);
×
672
  ui->profileTable->setItem(n, 0, new QTableWidgetItem(tr("New Profile")));
×
673
  ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text()));
×
674
  ui->profileTable->setItem(n, 2, new QTableWidgetItem());
×
675
  ui->profileTable->selectRow(n);
×
676
  ui->deleteButton->setEnabled(true);
×
677

678
  ui->profileTable->editItem(ui->profileTable->item(n, 0));
×
679
  ui->profileTable->item(n, 0)->setSelected(true);
×
680

681
  validate();
×
682
}
×
683

684
/**
685
 * @brief ConfigDialog::on_profileTable_cellDoubleClicked open folder browser
686
 * for path column (column 1).
687
 */
688
void ConfigDialog::on_profileTable_cellDoubleClicked(int row, int column) {
×
689
  if (column == 1) {
×
690
    QString dir = selectFolder();
×
691
    if (!dir.isEmpty()) {
×
692
      ui->profileTable->item(row, 1)->setText(dir);
×
693
    }
694
  }
695
}
×
696

697
/**
698
 * @brief ConfigDialog::on_deleteButton_clicked remove a profile row.
699
 */
700
void ConfigDialog::on_deleteButton_clicked() {
×
701
  QSet<int> selectedRows; //  we use a set to prevent doubles
702
  QList<QTableWidgetItem *> itemList = ui->profileTable->selectedItems();
×
703
  if (itemList.count() == 0) {
×
704
    QMessageBox::warning(this, tr("No profile selected"),
×
705
                         tr("No profile selected to delete"));
×
706
    return;
707
  }
708
  QTableWidgetItem *item;
709
  foreach (item, itemList)
×
710
    selectedRows.insert(item->row());
×
711
  // get a list, and sort it big to small
712
  QList<int> rows = selectedRows.values();
×
713
  std::sort(rows.begin(), rows.end());
×
714
  // now actually do the removing:
715
  foreach (int row, rows)
×
716
    ui->profileTable->removeRow(row);
×
717
  if (ui->profileTable->rowCount() < 1) {
×
718
    ui->deleteButton->setEnabled(false);
×
719
  }
720

721
  validate();
×
722
}
723

724
/**
725
 * @brief ConfigDialog::criticalMessage wrapper for showing critical messages
726
 * in a popup.
727
 * @param title
728
 * @param text
729
 */
730
void ConfigDialog::criticalMessage(const QString &title, const QString &text) {
×
731
  QMessageBox::critical(this, title, text, QMessageBox::Ok, QMessageBox::Ok);
×
732
}
×
733

734
/**
735
 * @brief Checks whether the qrencode executable is available on the system.
736
 * @example
737
 * bool result = ConfigDialog::isQrencodeAvailable();
738
 * std::cout << result << std::endl; // Expected output: true if qrencode is
739
 * found, otherwise false
740
 *
741
 * @return bool - True if qrencode is available; otherwise false. On Windows,
742
 * always returns false.
743
 */
744
auto ConfigDialog::isQrencodeAvailable() -> bool {
×
745
#ifdef Q_OS_WIN
746
  return false;
747
#else
748
  QProcess which;
×
749
  which.start("which", QStringList() << "qrencode");
×
750
  which.waitForFinished();
×
751
  QtPassSettings::setQrencodeExecutable(
×
752
      which.readAllStandardOutput().trimmed());
×
753
  return which.exitCode() == 0;
×
754
#endif
755
}
×
756

757
auto ConfigDialog::isPassOtpAvailable() -> bool {
×
758
#ifdef Q_OS_WIN
759
  return false;
760
#else
761
  QProcess pass;
×
762
  pass.start(QtPassSettings::getPassExecutable(), QStringList() << "otp"
×
763
                                                                << "--help");
×
764
  pass.waitForFinished(2000);
×
765
  return pass.exitCode() == 0;
×
766
#endif
767
}
×
768

769
/**
770
 * @brief ConfigDialog::wizard first-time use wizard.
771
 * @todo make this thing more reliable.
772
 */
773
void ConfigDialog::wizard() {
×
774
  (void)Util::configIsValid();
×
775
  on_autodetectButton_clicked();
×
776

777
  if (!checkGpgExistence()) {
×
778
    return;
779
  }
780
  if (!checkSecretKeys()) {
×
781
    return;
782
  }
783
  if (!checkPasswordStore()) {
×
784
    return;
785
  }
786
  handleGpgIdFile();
×
787

788
  ui->checkBoxHidePassword->setCheckState(Qt::Checked);
×
789
}
790

791
/**
792
 * @brief Checks whether the configured GnuPG executable exists.
793
 * @example
794
 * bool result = ConfigDialog::checkGpgExistence();
795
 * std::cout << result << std::endl; // Expected output: true if GnuPG is found,
796
 * false otherwise
797
 *
798
 * @return bool - True if the GnuPG path is valid or uses a WSL command prefix;
799
 * false if the executable cannot be found and an error message is shown.
800
 */
801
auto ConfigDialog::checkGpgExistence() -> bool {
×
802
  QString gpg = ui->gpgPath->text();
×
803
  if (!gpg.startsWith("wsl ") && !QFile(gpg).exists()) {
×
804
    criticalMessage(
×
805
        tr("GnuPG not found"),
×
806
#ifdef Q_OS_WIN
807
#ifdef WINSTORE
808
        tr("Please install GnuPG on your system.<br>Install "
809
           "<strong>Ubuntu</strong> from the Microsoft Store to get it.<br>"
810
           "If you already did so, make sure you started it once and<br>"
811
           "click \"Autodetect\" in the next dialog.")
812
#else
813
        tr("Please install GnuPG on your system.<br>Install "
814
           "<strong>Ubuntu</strong> from the Microsoft Store<br>or <a "
815
           "href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
816
           "from GnuPG.org")
817
#endif
818
#else
819
        tr("Please install GnuPG on your system.<br>Install "
×
820
           "<strong>gpg</strong> using your favorite package manager<br>or "
821
           "<a "
822
           "href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
823
           "from GnuPG.org")
824
#endif
825
    );
826
    return false;
×
827
  }
828
  return true;
829
}
830

831
/**
832
 * @brief Checks whether secret keys are available and, if needed, prompts the
833
 * user to generate them.
834
 * @example
835
 * bool result = ConfigDialog.checkSecretKeys();
836
 * std::cout << result << std::endl; // Expected output: true if keys are
837
 * present or key generation dialog is accepted, false otherwise
838
 *
839
 * @return bool - Returns true when secret keys are already available or the key
840
 * generation dialog is accepted; false if the dialog is rejected.
841
 */
842
auto ConfigDialog::checkSecretKeys() -> bool {
×
843
  QString gpg = ui->gpgPath->text();
×
844
  QStringList names = getSecretKeys();
×
845

846
#ifdef QT_DEBUG
847
  dbg() << names;
848
#endif
849

850
  if ((gpg.startsWith("wsl ") || QFile(gpg).exists()) && names.empty()) {
×
851
    KeygenDialog d(this);
×
852
    return d.exec();
×
853
  }
×
854
  return true;
855
}
856

857
/**
858
 * @brief Checks whether the password-store path exists and prompts the user to
859
 * create it if it does not.
860
 * @example
861
 * bool result = ConfigDialog::checkPasswordStore();
862
 * std::cout << std::boolalpha << result << std::endl; // Expected output: true
863
 * if the store exists or is created successfully, false if creation fails
864
 *
865
 * @return bool - True if the password-store exists or is successfully created,
866
 * false if creation fails.
867
 */
868
auto ConfigDialog::checkPasswordStore() -> bool {
×
869
  QString passStore = ui->storePath->text();
×
870

871
  if (!QFile(passStore).exists()) {
×
872
    if (QMessageBox::question(
×
873
            this, tr("Create password-store?"),
×
874
            tr("Would you like to create a password-store at %1?")
×
875
                .arg(passStore),
×
876
            QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
877
      if (!QDir().mkdir(passStore)) {
×
878
        QMessageBox::warning(
×
879
            this, tr("Error"),
×
880
            tr("Failed to create password-store at: %1").arg(passStore));
×
881
        return false;
×
882
      }
883
#ifdef Q_OS_WIN
884
      SetFileAttributes(passStore.toStdWString().c_str(),
885
                        FILE_ATTRIBUTE_HIDDEN);
886
#endif
887
      if (ui->checkBoxUseGit->isChecked()) {
×
888
        emit mainWindow->passGitInitNeeded();
×
889
      }
890
      mainWindow->userDialog(passStore);
×
891
    }
892
  }
893
  return true;
894
}
895

896
/**
897
 * @brief Handles selection and validation of the password store's .gpg-id file.
898
 * @example
899
 * ConfigDialog dialog;
900
 * dialog.handleGpgIdFile();
901
 *
902
 * @return void - This method does not return a value; it updates the UI flow
903
 * and may prompt the user to choose a valid password store.
904
 */
905
void ConfigDialog::handleGpgIdFile() {
×
906
  QString passStore = ui->storePath->text();
×
907
  if (!QFile(QDir(passStore).filePath(".gpg-id")).exists()) {
×
908
#ifdef QT_DEBUG
909
    dbg() << ".gpg-id file does not exist";
910
#endif
911
    criticalMessage(tr("Password store not initialised"),
×
912
                    tr("The folder %1 doesn't seem to be a password store or "
×
913
                       "is not yet initialised.")
914
                        .arg(passStore));
×
915

916
    while (!QFile(passStore).exists()) {
×
917
      on_toolButtonStore_clicked();
×
918
      if (passStore == ui->storePath->text()) {
×
919
        return;
920
      }
NEW
921
      passStore = ui->storePath->text();
×
922
    }
NEW
923
    if (!QFile(passStore + ".gpg-id").exists()) {
×
924
#ifdef QT_DEBUG
925
      dbg() << ".gpg-id file still does not exist :/";
926
#endif
927
      mainWindow->userDialog(passStore);
×
928
    }
929
  }
930
}
931

932
/**
933
 * @brief ConfigDialog::useTrayIcon set preference for using trayicon.
934
 * Enable or disable related checkboxes accordingly.
935
 * @param useSystray
936
 */
UNCOV
937
void ConfigDialog::useTrayIcon(bool useSystray) {
×
UNCOV
938
  if (QSystemTrayIcon::isSystemTrayAvailable()) {
×
UNCOV
939
    ui->checkBoxUseTrayIcon->setChecked(useSystray);
×
UNCOV
940
    ui->checkBoxHideOnClose->setEnabled(useSystray);
×
941
    ui->checkBoxStartMinimized->setEnabled(useSystray);
×
942

943
    if (!useSystray) {
×
944
      ui->checkBoxHideOnClose->setChecked(false);
×
945
      ui->checkBoxStartMinimized->setChecked(false);
×
946
    }
947
  }
948
}
×
949

950
/**
951
 * @brief ConfigDialog::on_checkBoxUseTrayIcon_clicked enable and disable
952
 * related checkboxes.
953
 */
UNCOV
954
void ConfigDialog::on_checkBoxUseTrayIcon_clicked() {
×
UNCOV
955
  bool state = ui->checkBoxUseTrayIcon->isChecked();
×
UNCOV
956
  ui->checkBoxHideOnClose->setEnabled(state);
×
UNCOV
957
  ui->checkBoxStartMinimized->setEnabled(state);
×
958
}
×
959

960
/**
961
 * @brief ConfigDialog::closeEvent close this window.
962
 * @param event
963
 */
UNCOV
964
void ConfigDialog::closeEvent(QCloseEvent *event) {
×
UNCOV
965
  QtPassSettings::setDialogGeometry("configDialog", saveGeometry());
×
UNCOV
966
  if (!isMaximized()) {
×
UNCOV
967
    QtPassSettings::setDialogPos("configDialog", pos());
×
968
    QtPassSettings::setDialogSize("configDialog", size());
×
969
  }
970
  QtPassSettings::setDialogMaximized("configDialog", isMaximized());
×
971
  event->accept();
972
}
×
973

974
/**
975
 * @brief ConfigDialog::useGit set preference for using git.
976
 * @param useGit
977
 */
UNCOV
978
void ConfigDialog::useGit(bool useGit) {
×
UNCOV
979
  ui->checkBoxUseGit->setChecked(useGit);
×
UNCOV
980
  on_checkBoxUseGit_clicked();
×
UNCOV
981
}
×
982

983
/**
984
 * @brief ConfigDialog::useOtp set preference for using otp plugin.
985
 * @param useOtp
986
 */
UNCOV
987
void ConfigDialog::useOtp(bool useOtp) {
×
UNCOV
988
  ui->checkBoxUseOtp->setChecked(useOtp);
×
UNCOV
989
}
×
990

991
void ConfigDialog::useGrepSearch(bool useGrepSearch) {
×
992
  ui->checkBoxUseGrepSearch->setChecked(useGrepSearch);
×
993
}
×
994

995
/**
996
 * @brief ConfigDialog::useQrencode set preference for using qrencode plugin.
997
 * @param useQrencode
998
 */
999
void ConfigDialog::useQrencode(bool useQrencode) {
×
1000
  ui->checkBoxUseQrencode->setChecked(useQrencode);
×
1001
}
×
1002

1003
/**
1004
 * @brief ConfigDialog::on_checkBoxUseGit_clicked enable or disable related
1005
 * checkboxes.
1006
 */
1007
void ConfigDialog::on_checkBoxUseGit_clicked() {
×
1008
  ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked());
×
1009
  ui->checkBoxAutoPull->setEnabled(ui->checkBoxUseGit->isChecked());
×
1010
  ui->checkBoxAutoPush->setEnabled(ui->checkBoxUseGit->isChecked());
×
1011
}
×
1012

1013
/**
1014
 * @brief ConfigDialog::on_toolButtonPwgen_clicked enable or disable related
1015
 * options in the interface.
1016
 */
1017
void ConfigDialog::on_toolButtonPwgen_clicked() {
×
1018
  QString pwgen = selectExecutable();
×
1019
  if (!pwgen.isEmpty()) {
×
1020
    ui->pwgenPath->setText(pwgen);
×
1021
    ui->checkBoxUsePwgen->setEnabled(true);
×
1022
  } else {
1023
    ui->checkBoxUsePwgen->setEnabled(false);
×
1024
    ui->checkBoxUsePwgen->setChecked(false);
×
1025
  }
1026
}
×
1027

1028
/**
1029
 * @brief ConfigDialog::setPwgenPath set pwgen executable path.
1030
 * Enable or disable related options in the interface.
1031
 * @param pwgen
1032
 */
1033
void ConfigDialog::setPwgenPath(const QString &pwgen) {
×
1034
  ui->pwgenPath->setText(pwgen);
×
1035
  if (pwgen.isEmpty()) {
×
1036
    ui->checkBoxUsePwgen->setChecked(false);
×
1037
    ui->checkBoxUsePwgen->setEnabled(false);
×
1038
  }
1039
  on_checkBoxUsePwgen_clicked();
×
1040
}
×
1041

1042
/**
1043
 * @brief ConfigDialog::on_checkBoxUsePwgen_clicked enable or disable related
1044
 * options in the interface.
1045
 */
1046
void ConfigDialog::on_checkBoxUsePwgen_clicked() {
×
1047
  if (ui->radioButtonPass->isChecked())
×
1048
    return;
1049
  bool usePwgen = ui->checkBoxUsePwgen->isChecked();
×
1050
  ui->checkBoxAvoidCapitals->setEnabled(usePwgen);
×
1051
  ui->checkBoxAvoidNumbers->setEnabled(usePwgen);
×
1052
  ui->checkBoxLessRandom->setEnabled(usePwgen);
×
1053
  ui->checkBoxUseSymbols->setEnabled(usePwgen);
×
1054
  ui->lineEditPasswordChars->setEnabled(!usePwgen);
×
1055
  ui->labelPasswordChars->setEnabled(!usePwgen);
×
1056
  ui->passwordCharTemplateSelector->setEnabled(!usePwgen);
×
1057
}
1058

1059
/**
1060
 * @brief ConfigDialog::usePwgen set preference for using pwgen (can be
1061
 * overruled by empty pwgenPath).
1062
 * enable or disable related options in the interface via
1063
 * ConfigDialog::on_checkBoxUsePwgen_clicked
1064
 * @param usePwgen
1065
 */
1066
void ConfigDialog::usePwgen(bool usePwgen) {
×
1067
  if (ui->pwgenPath->text().isEmpty()) {
×
1068
    usePwgen = false;
1069
  }
1070
  ui->checkBoxUsePwgen->setChecked(usePwgen);
×
1071
  on_checkBoxUsePwgen_clicked();
×
1072
}
×
1073

1074
void ConfigDialog::setPasswordConfiguration(
×
1075
    const PasswordConfiguration &config) {
1076
  ui->spinBoxPasswordLength->setValue(config.length);
×
1077
  ui->passwordCharTemplateSelector->setCurrentIndex(config.selected);
×
1078
  if (config.selected != PasswordConfiguration::CUSTOM) {
×
1079
    ui->lineEditPasswordChars->setEnabled(false);
×
1080
  }
1081
  ui->lineEditPasswordChars->setText(config.Characters[config.selected]);
×
1082
}
×
1083

1084
auto ConfigDialog::getPasswordConfiguration() -> PasswordConfiguration {
×
1085
  PasswordConfiguration config;
×
1086
  config.length = ui->spinBoxPasswordLength->value();
×
1087
  config.selected = static_cast<PasswordConfiguration::characterSet>(
×
1088
      ui->passwordCharTemplateSelector->currentIndex());
×
1089
  config.Characters[PasswordConfiguration::CUSTOM] =
1090
      ui->lineEditPasswordChars->text();
×
1091
  return config;
×
1092
}
×
1093

1094
/**
1095
 * @brief ConfigDialog::on_passwordCharTemplateSelector_activated sets the
1096
 * passwordChar Template
1097
 * combo box to the desired entry
1098
 * @param entry of
1099
 */
1100
void ConfigDialog::on_passwordCharTemplateSelector_activated(int index) {
×
1101
  ui->lineEditPasswordChars->setText(
×
1102
      QtPassSettings::getPasswordConfiguration().Characters[index]);
×
1103
  if (index == PasswordConfiguration::CUSTOM) {
×
1104
    ui->lineEditPasswordChars->setEnabled(true);
×
1105
  } else {
1106
    ui->lineEditPasswordChars->setEnabled(false);
×
1107
  }
1108
}
×
1109

1110
/**
1111
 * @brief ConfigDialog::on_checkBoxUseTemplate_clicked enable or disable the
1112
 * template field and options.
1113
 */
1114
void ConfigDialog::on_checkBoxUseTemplate_clicked() {
×
1115
  ui->plainTextEditTemplate->setEnabled(ui->checkBoxUseTemplate->isChecked());
×
1116
  ui->checkBoxTemplateAllFields->setEnabled(
×
1117
      ui->checkBoxUseTemplate->isChecked());
×
1118
}
×
1119

1120
void ConfigDialog::onProfileTableItemChanged(QTableWidgetItem *item) {
×
1121
  validate(item);
×
1122
}
×
1123

1124
/**
1125
 * @brief ConfigDialog::useTemplate set preference for using templates.
1126
 * @param useTemplate
1127
 */
1128
void ConfigDialog::useTemplate(bool useTemplate) {
×
1129
  ui->checkBoxUseTemplate->setChecked(useTemplate);
×
1130
  on_checkBoxUseTemplate_clicked();
×
1131
}
×
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