QtPass  1.2.3
Multi-platform GUI for pass, the standard unix password manager.
configdialog.cpp
Go to the documentation of this file.
1 #include "configdialog.h"
2 #include "keygendialog.h"
3 #include "mainwindow.h"
4 #include "qtpasssettings.h"
5 #include "ui_configdialog.h"
6 #include <QClipboard>
7 #include <QDir>
8 #include <QFileDialog>
9 #include <QMessageBox>
10 #include <QPushButton>
11 #include <QSystemTrayIcon>
12 #include <QTableWidgetItem>
13 #include <utility>
14 #ifdef Q_OS_WIN
15 #include <windows.h>
16 #endif
17 
18 #ifdef QT_DEBUG
19 #include "debughelper.h"
20 #endif
21 
27  : QDialog(parent), ui(new Ui::ConfigDialog) {
28  mainWindow = parent;
29  ui->setupUi(this);
30 
31  ui->passPath->setText(QtPassSettings::getPassExecutable());
33  ui->gpgPath->setText(QtPassSettings::getGpgExecutable());
34  ui->storePath->setText(QtPassSettings::getPassStore());
35 
36  ui->spinBoxAutoclearSeconds->setValue(QtPassSettings::getAutoclearSeconds());
37  ui->spinBoxAutoclearPanelSeconds->setValue(
39  ui->checkBoxHidePassword->setChecked(QtPassSettings::isHidePassword());
40  ui->checkBoxHideContent->setChecked(QtPassSettings::isHideContent());
41  ui->checkBoxAddGPGconst Id->set&Checked(QtPassSettings::isAddGPGId(true));
42 
43  if (QSystemTrayIcon::isSystemTrayAvailable()) {
44  ui->checkBoxHideOnClose->setChecked(QtPassSettings::isHideOnClose());
45  ui->checkBoxStartMinimized->setChecked(QtPassSettings::isStartMinimized());
46  } else {
47  ui->checkBoxUseTrayIcon->setEnabled(false);
48  ui->checkBoxUseTrayIcon->setToolTip(tr("System tray is not available"));
49  ui->checkBoxHideOnClose->setEnabled(false);
50  ui->checkBoxStartMinimized->setEnabled(false);
51  }
52 
53  ui->checkBoxAvoidCapitals->setChecked(QtPassSettings::isAvoidCapitals());
54  ui->checkBoxAvoidNumbers->setChecked(QtPassSettings::isAvoidNumbers());
55  ui->checkBoxLessRandom->setChecked(QtPassSettings::isLessRandom());
56  ui->checkBoxUseSymbols->setChecked(QtPassSettings::isUseSymbols());
57  ui->plainTextEditTemplate->setPlainText(QtPassSettings::getPassTemplate());
58  ui->checkBoxTemplateAllFields->setChecked(
60  ui->checkBoxAutoPull->setChecked(QtPassSettings::isAutoPull());
61  ui->checkBoxAutoPush->setChecked(QtPassSettings::isAutoPush());
62  ui->checkBoxAlwaysOnTop->setChecked(QtPassSettings::isAlwaysOnTop());
63 
64 #if defined(Q_OS_WIN) || defined(__APPLE__)
65  ui->checkBoxUseOtp->hide();
66  ui->label_10->hide();
67 #endif
68 
69  if (!isPassOtpAvailable()) {
70  ui->checkBoxUseOtp->setEnabled(false);
71  ui->checkBoxUseOtp->setToolTip(
72  tr("Pass OTP extension needs to be installed"));
73  }
74 
77  setPasswordConficonst guratio&n(QtPassSettings::getPasswordConfiguration());
78 
79  usePass(QtPassSettings::isUsePass());
80  uconst seAutoc&lear(QtPassSettings::isUseAutoclear());
84 
86 
89 
90  ui->profileTable->verticalHeader()->hide();
91  ui->profileTable->horizontalHeader()->setStretchLastSection(true);
92  ui->label->setText(ui->label->text() + VERSION);
93  ui->comboBoxClipboard->clear();
94 
95  ui->comboBoxClipboard->addItem(tr("No Clipboard"));
96  ui->comboBoxClipboard->addItem(tr("Always copy to clipboard"));
97  ui->comboBoxClipboard->addItem(tr("On-demand copy to clipboard"));
98 
99  int currentIndex = QtPassSettings::getClipBoardTypeRaw();
100  ui->comboBoxClipboard->setCurrentIndex(currentIndex);
101  on_comboBoxClipboard_activated(currentIndex);
102 
103  QClipboard *clip = QApplication::clipboard();
104  if (!clip->supportsSelection()) {
105  useSelection(false);
106  ui->checkBoxSelection->setVisible(false);
107  } else {
109  }
110 
111  connect(ui->profileTable, &QTableWidget::itemChanged, this,
112  &ConfigDialog::onProfileTableItemChanged);
113  connect(this, &ConfigDialog::accepted, this, &ConfigDialog::on_accepted);
114 }
115 
121  QtPassSettings::setGitExecutable(ui->gitPath->text());
122  QtPassSettings::setGpgExecutable(ui->gpgPath->text());
123  QtPassSettings::setPassExecutable(ui->passPath->text());
124 }
125 
131 void ConfigDialog::setGitPath(const QString& path) {
132  ui->gitPath->setText(path);
133  ui->checkBoxUseGit->setEnabled(!path.isEmpty());
134  if (path.isEmpty()) {
135  useGit(false);
136  }
137 }
138 
144 void ConfigDialog::usePass(bool usePass) {
145  ui->radioButtonNative->setChecked(!usePass);
146  ui->radioButtonPass->setChecked(usePass);
147  setGroupBoxState();
148 }
149 
150 void ConfigDialog::validate(QTableWidgetItem *item) {
151  bool status = true;
152 
153  if (item == nullptr) {
154  for (int i = 0; i < ui->profileTable->rowCount(); i++) {
155  for (int j = 0; j < ui->profileTable->columnCount(); j++) {
156  QTableWidgetItem *_item = ui->profileTable->item(i, j);
157 
158  if (_item->text().isEmpty()) {
159  _item->setBackgroundColor(Qt::red);
160  status = false;
161  break;
162  }
163  }
164 
165  if (!status)
166  break;
167  }
168  } else {
169  if (item->text().isEmpty()) {
170  item->setBackgroundColor(Qt::red);
171  status = false;
172  }
173  }
174 
175  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status);
176 }
177 
178 void ConfigDialog::on_accepted() {
179  QtPassSettings::setPassExecutable(ui->passPath->text());
180  QtPassSettings::setGitExecutable(ui->gitPath->text());
181  QtPassSettings::setGpgExecutable(ui->gpgPath->text());
183  Util::normalizeFolderPath(ui->storePath->text()));
184  QtPassSettings::setUsePass(ui->radioButtonPass->isChecked());
185  QtPassSettings::setClipBoardType(ui->comboBoxClipboard->currentIndex());
186  QtPassSettings::setUseSelection(ui->checkBoxSelection->isChecked());
187  QtPassSettings::setUseAutoclear(ui->checkBoxAutoclear->isChecked());
188  QtPassSettings::setAutoclearSeconds(ui->spinBoxAutoclearSeconds->value());
189  QtPassSettings::setUseAutoclearPanel(ui->checkBoxAutoclearPanel->isChecked());
191  ui->spinBoxAutoclearPanelSeconds->value());
192  QtPassSettings::setHidePassword(ui->checkBoxHidePassword->isChecked());
193  QtPassSettings::setHideContent(ui->checkBoxHideContent->isChecked());
194  QtPassSettings::setAddGPGId(ui->checkBoxAddGPGId->isChecked());
195  QtPassSettings::setUseTrayIcon(ui->checkBoxUseTrayIcon->isEnabled() &&
196  ui->checkBoxUseTrayIcon->isChecked());
197  QtPassSettings::setHideOnClose(ui->checkBoxHideOnClose->isEnabled() &&
198  ui->checkBoxHideOnClose->isChecked());
199  QtPassSettings::setStartMinimized(ui->checkBoxStartMinimized->isEnabled() &&
200  ui->checkBoxStartMinimized->isChecked());
202  QtPassSettings::setUseGit(ui->checkBoxUseGit->isChecked());
203  QtPassSettings::setUseOtp(ui->checkBoxUseOtp->isChecked());
204  QtPassSettings::setPwgenExecutable(ui->pwgenPath->text());
205  QtPassSettings::setUsePwgen(ui->checkBoxUsePwgen->isChecked());
206  QtPassSettings::setAvoidCapitals(ui->checkBoxAvoidCapitals->isChecked());
207  QtPassSettings::setAvoidNumbers(ui->checkBoxAvoidNumbers->isChecked());
208  QtPassSettings::setLessRandom(ui->checkBoxLessRandom->isChecked());
209  QtPassSettings::setUseSymbols(ui->checkBoxUseSymbols->isChecked());
211  QtPassSettings::setUseTemplate(ui->checkBoxUseTemplate->isChecked());
212  QtPassSettings::setPassTemplate(ui->plainTextEditTemplate->toPlainText());
214  ui->checkBoxTemplateAllFields->isChecked());
215  QtPassSettings::setAutoPush(ui->checkBoxAutoPush->isChecked());
216  QtPassSettings::setAutoPull(ui->checkBoxAutoPull->isChecked());
217  QtPassSettings::setAlwaysOnTop(ui->checkBoxAlwaysOnTop->isChecked());
218 
220 }
221 
226 void ConfigDialog::on_radioButtonNative_clicked() { setGroupBoxState(); }
227 
232 void ConfigDialog::on_radioButtonPass_clicked() { setGroupBoxState(); }
233 
238 QStringList ConfigDialog::getSecretKeys() {
239  QList<UserInfo> keys = QtPassSettings::getPass()->listKeys("", true);
240  QStringList names;
241 
242  if (keys.empty())
243  return names;
244 
245  foreach (const UserInfo &sec, keys)
246  names << sec.name;
247 
248  return names;
249 }
250 
254 void ConfigDialog::setGroupBoxState() {
255  bool state = ui->radioButtonPass->isChecked();
256  ui->groupBoxNative->setEnabled(!state);
257  ui->groupBoxPass->setEnabled(state);
258 }
259 
264 QString ConfigDialog::selectExecutable() {
265  QFileDialog dialog(this);
266  dialog.setFileMode(QFileDialog::ExistingFile);
267  dialog.setOption(QFileDialog::ReadOnly);
268  if (dialog.exec())
269  return dialog.selectedFiles().first();
270 
271  return QString();
272 }
273 
278 QString ConfigDialog::selectFolder() {
279  QFileDialog dialog(this);
280  dialog.setFileMode(QFileDialog::Directory);
281  dialog.setFilter(QDir::NoFilter);
282  dialog.setOption(QFileDialog::ShowDirsOnly);
283  if (dialog.exec())
284  return dialog.selectedFiles().first();
285 
286  return QString();
287 }
288 
293 void ConfigDialog::on_toolButtonGit_clicked() {
294  QString git = selectExecutable();
295  bool state = !git.isEmpty();
296  if (state) {
297  ui->gitPath->setText(git);
298  } else {
299  useGit(false);
300  }
301 
302  ui->checkBoxUseGit->setEnabled(state);
303 }
304 
308 void ConfigDialog::on_toolButtonGpg_clicked() {
309  QString gpg = selectExecutable();
310  if (!gpg.isEmpty())
311  ui->gpgPath->setText(gpg);
312 }
313 
317 void ConfigDialog::on_toolButtonPass_clicked() {
318  QString pass = selectExecutable();
319  if (!pass.isEmpty())
320  ui->passPath->setText(pass);
321 }
322 
327 void ConfigDialog::on_toolButtonStore_clicked() {
328  QString store = selectFolder();
329  if (!store.isEmpty()) // TODO(annejan) call check
330  ui->storePath->setText(store);
331 }
332 
337 void ConfigDialog::on_comboBoxClipboard_activated(int index) {
338  bool state = index > 0;
339 
340  ui->checkBoxSelection->setEnabled(state);
341  ui->checkBoxAutoclear->setEnabled(state);
342  ui->checkBoxHidePassword->setEnabled(state);
343  ui->checkBoxHideContent->setEnabled(state);
344  if (state) {
345  ui->spinBoxAutoclearSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
346  ui->labelSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
347  } else {
348  ui->spinBoxAutoclearSeconds->setEnabled(false);
349  ui->labelSeconds->setEnabled(false);
350  }
351 }
352 
357 void ConfigDialog::on_checkBoxAutoclearPanel_clicked() {
358  bool state = ui->checkBoxAutoclearPanel->isChecked();
359  ui->spinBoxAutoclearPanelSeconds->setEnabled(state);
360  ui->labelPanelSeconds->setEnabled(state);
361 }
362 
368 void ConfigDialog::useSelection(bool useSelection) {
369  ui->checkBoxSelection->setChecked(useSelection);
370  on_checkBoxSelection_clicked();
371 }
372 
378 void ConfigDialog::useAutoclear(bool useAutoclear) {
379  ui->checkBoxAutoclear->setChecked(useAutoclear);
380  on_checkBoxAutoclear_clicked();
381 }
382 
388 void ConfigDialog::useAutoclearPanel(bool useAutoclearPanel) {
389  ui->checkBoxAutoclearPanel->setChecked(useAutoclearPanel);
390  on_checkBoxAutoclearPanel_clicked();
391 }
392 
397 void ConfigDialog::on_checkBoxSelection_clicked() {
398  on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
399 }
400 
405 void ConfigDialog::on_checkBoxAutoclear_clicked() {
406  on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
407 }
408 
416 void ConfigDialog::genKey(QString batch, QDialog *dialog) {
417  mainWindow->generateKeyPair(std::move(batch), dialog);
418 }
419 
426 void ConfigDialog::setProfiles(QHash<QString, QString> profiles,
427  const QString& profile) {
428  // dbg()<< profiles;
429  if (profiles.contains("")) {
430  profiles.remove("");
431  // remove weird "" key value pairs
432  }
433 
434  ui->profileTable->setRowCount(profiles.count());
435  QHashIterator<QString, QString> i(profiles);
436  int n = 0;
437  while (i.hasNext()) {
438  i.next();
439  if (!i.value().isEmpty() && !i.key().isEmpty()) {
440  ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key()));
441  ui->profileTable->setItem(n, 1, new QTableWidgetItem(i.value()));
442  // dbg()<< "naam:" + i.key();
443  if (i.key() == profile)
444  ui->profileTable->selectRow(n);
445  }
446  ++n;
447  }
448 }
449 
454 QHash<QString, QString> ConfigDialog::getProfiles() {
455  QHash<QString, QString> profiles;
456  // Check?
457  for (int i = 0; i < ui->profileTable->rowCount(); ++i) {
458  QTableWidgetItem *pathItem = ui->profileTable->item(i, 1);
459  if (nullptr != pathItem) {
460  QTableWidgetItem *item = ui->profileTable->item(i, 0);
461  if (item == nullptr) {
462  continue;
463  }
464  profiles.insert(item->text(), pathItem->text());
465  }
466  }
467  return profiles;
468 }
469 
473 void ConfigDialog::on_addButton_clicked() {
474  int n = ui->profileTable->rowCount();
475  ui->profileTable->insertRow(n);
476  ui->profileTable->setItem(n, 0, new QTableWidgetItem());
477  ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text()));
478  ui->profileTable->selectRow(n);
479  ui->deleteButton->setEnabled(true);
480 
481  validate();
482 }
483 
487 void ConfigDialog::on_deleteButton_clicked() {
488  QSet<int> selectedRows; // we use a set to prevent doubles
489  QList<QTableWidgetItem *> itemList = ui->profileTable->selectedItems();
490  if (itemList.count() == 0) {
491  QMessageBox::warning(this, tr("No profile selected"),
492  tr("No profile selected to delete"));
493  return;
494  }
495  QTableWidgetItem *item;
496  foreach (item, itemList)
497  selectedRows.insert(item->row());
498  // get a list, and sort it big to small
499  QList<int> rows = selectedRows.toList();
500  qSort(rows.begin(), rows.end());
501  // now actually do the removing:
502  foreach (int row, rows)
503  ui->profileTable->removeRow(row);
504  if (ui->profileTable->rowCount() < 1)
505  ui->deleteButton->setEnabled(false);
506 
507  validate();
508 }
509 
516 void ConfigDialog::criticalMessage(const QString &title, const QString &text) {
517  QMessageBox::critical(this, title, text, QMessageBox::Ok, QMessageBox::Ok);
518 }
519 
520 bool ConfigDialog::isPassOtpAvailable() {
521 #ifdef Q_OS_WIN
522  return false;
523 #elif defined(__APPLE__)
524  return false;
525 #else
526  QFileInfo file("/usr/lib/password-store/extensions/otp.bash");
527 
528  return file.exists();
529 #endif
530 }
531 
537  // mainWindow->checkConfig();
538  bool clean = false;
539 
540  QString gpg = ui->gpgPath->text();
541  // QString gpg = mainWindow->getGpgExecutable();
542  if (!QFile(gpg).exists()) {
543  criticalMessage(
544  tr("GnuPG not found"),
545  tr("Please install GnuPG on your system.<br>Install "
546  "<strong>gpg</strong> using your favorite package manager<br>or "
547  "<a "
548  "href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
549  "from GnuPG.org"));
550  clean = true;
551  }
552 
553  QStringList names = getSecretKeys();
554 
555 #ifdef QT_DEBUG
556  dbg() << names;
557 #endif
558 
559  if (QFile(gpg).exists() && names.empty()) {
560  KeygenDialog d(this);
561  if (!d.exec())
562  return;
563  }
564 
565  QString passStore = ui->storePath->text();
566 
567  if (!QFile(passStore).exists()) {
568  // TODO(annejan) pass version?
569  if (QMessageBox::question(
570  this, tr("Create password-store?"),
571  tr("Would you like to create a password-store at %1?")
572  .arg(passStore),
573  QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
574  QDir().mkdir(passStore);
575 #ifdef Q_OS_WIN
576  SetFileAttributes(passStore.toStdWString().c_str(),
577  FILE_ATTRIBUTE_HIDDEN);
578 #endif
579  if (ui->checkBoxUseGit->isChecked())
580  emit mainWindow->passGitInitNeeded();
581  mainWindow->userDialog(passStore);
582  }
583  }
584 
585  if (!QFile(QDir(passStore).filePath(".gpg-id")).exists()) {
586 #ifdef QT_DEBUG
587  dbg() << ".gpg-id file does not exist";
588 #endif
589  if (!clean) {
590  criticalMessage(tr("Password store not initialised"),
591  tr("The folder %1 doesn't seem to be a password store or "
592  "is not yet initialised.")
593  .arg(passStore));
594  }
595  while (!QFile(passStore).exists()) {
596  on_toolButtonStore_clicked();
597  // allow user to cancel
598  if (passStore == ui->storePath->text())
599  return;
600  passStore = ui->storePath->text();
601  }
602  if (!QFile(passStore + ".gpg-id").exists()) {
603 #ifdef QT_DEBUG
604  dbg() << ".gpg-id file still does not exist :/";
605 #endif
606  // appears not to be store
607  // init yes / no ?
608  mainWindow->userDialog(passStore);
609  }
610  }
611 }
612 
618 void ConfigDialog::useTrayIcon(bool useSystray) {
619  if (QSystemTrayIcon::isSystemTrayAvailable()) {
620  ui->checkBoxUseTrayIcon->setChecked(useSystray);
621  ui->checkBoxHideOnClose->setEnabled(useSystray);
622  ui->checkBoxStartMinimized->setEnabled(useSystray);
623 
624  if (!useSystray) {
625  ui->checkBoxHideOnClose->setChecked(false);
626  ui->checkBoxStartMinimized->setChecked(false);
627  }
628  }
629 }
630 
635 void ConfigDialog::on_checkBoxUseTrayIcon_clicked() {
636  bool state = ui->checkBoxUseTrayIcon->isChecked();
637  ui->checkBoxHideOnClose->setEnabled(state);
638  ui->checkBoxStartMinimized->setEnabled(state);
639 }
640 
645 void ConfigDialog::closeEvent(QCloseEvent *event) {
646  // TODO(annejan) save window size or something?
647  event->accept();
648 }
649 
654 void ConfigDialog::useGit(bool useGit) {
655  ui->checkBoxUseGit->setChecked(useGit);
656  on_checkBoxUseGit_clicked();
657 }
658 
663 void ConfigDialog::useOtp(bool useOtp) {
664  ui->checkBoxUseOtp->setChecked(useOtp);
665 }
666 
671 void ConfigDialog::on_checkBoxUseGit_clicked() {
672  ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked());
673  ui->checkBoxAutoPull->setEnabled(ui->checkBoxUseGit->isChecked());
674  ui->checkBoxAutoPush->setEnabled(ui->checkBoxUseGit->isChecked());
675 }
676 
681 void ConfigDialog::on_toolButtonPwgen_clicked() {
682  QString pwgen = selectExecutable();
683  if (!pwgen.isEmpty()) {
684  ui->pwgenPath->setText(pwgen);
685  ui->checkBoxUsePwgen->setEnabled(true);
686  } else {
687  ui->checkBoxUsePwgen->setEnabled(false);
688  ui->checkBoxUsePwgen->setChecked(false);
689  }
690 }
691 
697 void ConfigDialog::setPwgenPath(const QString& pwgen) {
698  ui->pwgenPath->setText(pwgen);
699  if (pwgen.isEmpty()) {
700  ui->checkBoxUsePwgen->setChecked(false);
701  ui->checkBoxUsePwgen->setEnabled(false);
702  }
703  on_checkBoxUsePwgen_clicked();
704 }
705 
710 void ConfigDialog::on_checkBoxUsePwgen_clicked() {
711  bool usePwgen = ui->checkBoxUsePwgen->isChecked();
712  ui->checkBoxAvoidCapitals->setEnabled(usePwgen);
713  ui->checkBoxAvoidNumbers->setEnabled(usePwgen);
714  ui->checkBoxLessRandom->setEnabled(usePwgen);
715  ui->checkBoxUseSymbols->setEnabled(usePwgen);
716  ui->lineEditPasswordChars->setEnabled(!usePwgen);
717  ui->labelPasswordChars->setEnabled(!usePwgen);
718  ui->passwordCharTemplateSelector->setEnabled(!usePwgen);
719 }
720 
728 void ConfigDialog::usePwgen(bool usePwgen) {
729  if (ui->pwgenPath->text().isEmpty())
730  usePwgen = false;
731  ui->checkBoxUsePwgen->setChecked(usePwgen);
732  on_checkBoxUsePwgen_clicked();
733 }
734 
736  const PasswordConfiguration &config) {
737  ui->spinBoxPasswordLength->setValue(config.length);
738  ui->passwordCharTemplateSelector->setCurrentIndex(config.selected);
740  ui->lineEditPasswordChars->setEnabled(false);
741  ui->lineEditPasswordChars->setText(config.Characters[config.selected]);
742 }
743 
745  PasswordConfiguration config;
746  config.length = ui->spinBoxPasswordLength->value();
747  config.selected = static_cast<PasswordConfiguration::characterSet>(
748  ui->passwordCharTemplateSelector->currentIndex());
750  ui->lineEditPasswordChars->text();
751  return config;
752 }
753 
760 void ConfigDialog::on_passwordCharTemplateSelector_activated(int index) {
761  ui->lineEditPasswordChars->setText(
762  QtPassSettings::getPasswordConfiguration().Characters[index]);
763  if (index == 3) {
764  ui->lineEditPasswordChars->setEnabled(true);
765  } else {
766  ui->lineEditPasswordChars->setEnabled(false);
767  }
768 }
769 
774 void ConfigDialog::on_checkBoxUseTemplate_clicked() {
775  ui->plainTextEditTemplate->setEnabled(ui->checkBoxUseTemplate->isChecked());
776  ui->checkBoxTemplateAllFields->setEnabled(
777  ui->checkBoxUseTemplate->isChecked());
778 }
779 
780 void ConfigDialog::onProfileTableItemChanged(QTableWidgetItem *item) {
781  validate(item);
782 }
783 
788 void ConfigDialog::useTemplate(bool useTemplate) {
789  ui->checkBoxUseTemplate->setChecked(useTemplate);
790  on_checkBoxUseTemplate_clicked();
791 }
static void setPwgenExecutable(const QString &pwgenExecutable)
void passGitInitNeeded()
static void setAutoclearSeconds(const int &autoClearSeconds)
QHash< QString, QString > getProfiles()
ConfigDialog::getProfiles return profile list.
static int getAutoclearSeconds(const int &defaultValue=QVariant().toInt())
static void setUsePwgen(const bool &usePwgen)
static bool isStartMinimized(const bool &defaultValue=QVariant().toBool())
void setPasswordConfiguration(const PasswordConfiguration &config)
~ConfigDialog()
ConfigDialog::~ConfigDialog config destructor, makes sure the mainWindow knows about git...
static void setUsePass(const bool &usePass)
static bool isLessRandom(const bool &defaultValue=QVariant().toBool())
static void setPassExecutable(const QString &passExecutable)
int length
Length of the password.
QList< UserInfo > listKeys(QStringList keystring, bool secret=false)
Pass::listKeys list users.
Definition: pass.cpp:129
void useOtp(bool useOtp)
ConfigDialog::useOtp set preference for using otp plugin.
#define dbg()
Definition: debughelper.h:7
static bool isAlwaysOnTop(const bool &defaultValue=QVariant().toBool())
Holds the Password configuration settings.
Definition: configdialog.h:9
static void setAutoPush(const bool &autoPush)
static void setGitExecutable(const QString &gitExecutable)
static void setAlwaysOnTop(const bool &alwaysOnTop)
static bool isUseSelection(const bool &defaultValue=QVariant().toBool())
Handles GPG keypair generation.
Definition: keygendialog.h:16
static void setPassTemplate(const QString &passTemplate)
ConfigDialog(MainWindow *parent)
ConfigDialog::ConfigDialog this sets up the configuration screen.
static void setUseGit(const bool &useGit)
static bool isAvoidNumbers(const bool &defaultValue=QVariant().toBool())
void useGit(bool useGit)
ConfigDialog::useGit set preference for using git.
static void setPasswordConfiguration(const PasswordConfiguration &config)
static void setHideContent(const bool &hideContent)
static bool isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool())
static void setLessRandom(const bool &lessRandom)
static void setAutoPull(const bool &autoPull)
static bool isAddGPGId(const bool &defaultValue=QVariant().toBool())
static bool isUseAutoclear(const bool &defaultValue=QVariant().toBool())
static bool isHideOnClose(const bool &defaultValue=QVariant().toBool())
static void setProfiles(const QHash< QString, QString > &profiles)
static bool isUseGit(const bool &defaultValue=QVariant().toBool())
void useAutoclearPanel(bool useAutoclearPanel)
ConfigDialog::useAutoclearPanel set the panel autoclear use from MainWindow.
static QString getPassStore(const QString &defaultValue=QVariant().toString())
void userDialog(QString="")
MainWindow::userDialog see MainWindow::onUsers()
Definition: mainwindow.cpp:680
void useAutoclear(bool useAutoclear)
ConfigDialog::useAutoclear set the clipboard autoclear use from MainWindow.
static QString getGitExecutable(const QString &defaultValue=QVariant().toString())
enum PasswordConfiguration::characterSet selected
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
void genKey(QString, QDialog *)
ConfigDialog::genKey tunnel function to make MainWindow generate a gpg key pair.
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
void wizard()
ConfigDialog::wizard first-time use wizard.
static bool isUseTrayIcon(const bool &defaultValue=QVariant().toBool())
static bool isUseOtp(const bool &defaultValue=QVariant().toBool())
static void setAvoidNumbers(const bool &avoidNumbers)
static QString getPassExecutable(const QString &defaultValue=QVariant().toString())
static void setHideOnClose(const bool &hideOnClose)
static bool isAvoidCapitals(const bool &defaultValue=QVariant().toBool())
void closeEvent(QCloseEvent *event)
ConfigDialog::closeEvent close this window.
void usePwgen(bool usePwgen)
ConfigDialog::usePwgen set preference for using pwgen (can be overruled buy empty pwgenPath)...
static Pass * getPass()
static void setGpgExecutable(const QString &gpgExecutable)
void useSelection(bool useSelection)
ConfigDialog::useSelection set the clipboard type use from MainWindow.
static void setStartMinimized(const bool &startMinimized)
static bool isUsePwgen(const bool &defaultValue=QVariant().toBool())
static void setUseAutoclear(const bool &useAutoclear)
static QString getPassTemplate(const QString &defaultValue=QVariant().toString())
static QString getPwgenExecutable(const QString &defaultValue=QVariant().toString())
static void setUseOtp(const bool &useOtp)
static bool isUseSymbols(const bool &defaultValue=QVariant().toBool())
void useTemplate(bool useTemplate)
ConfigDialog::useTemplate set preference for using templates.
The ConfigDialog handles the configuration interface.
Definition: configdialog.h:24
QString name
UserInfo::name full name.
Definition: userinfo.h:32
Stores key info lines including validity, creation date and more.
Definition: userinfo.h:11
static void setUseTemplate(const bool &useTemplate)
static int getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt())
static void setAddGPGId(const bool &addGPGId)
static QString getGpgExecutable(const QString &defaultValue=QVariant().toString())
static bool isUseTemplate(const bool &defaultValue=QVariant().toBool())
static bool isTemplateAllFields(const bool &defaultValue=QVariant().toBool())
static void setUseSymbols(const bool &useSymbols)
QString Characters[CHARSETS_COUNT]
The different character sets.
static void setTemplateAllFields(const bool &templateAllFields)
static QHash< QString, QString > getProfiles()
static void setUseTrayIcon(const bool &useTrayIcon)
static PasswordConfiguration getPasswordConfiguration()
PasswordConfiguration getPasswordConfiguration()
static void setClipBoardType(const int &clipBoardType)
void generateKeyPair(QString, QDialog *)
MainWindow::generateKeyPair internal gpg keypair generator . .
Definition: mainwindow.cpp:722
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more...
Definition: mainwindow.h:39
static bool isHidePassword(const bool &defaultValue=QVariant().toBool())
static bool isHideContent(const bool &defaultValue=QVariant().toBool())
static QString getProfile(const QString &defaultValue=QVariant().toString())
void setPwgenPath(QString)
ConfigDialog::setPwgenPath set pwgen executable path. Enable or disable related options in the interf...
static void setVersion(const QString &version)
static void setHidePassword(const bool &hidePassword)
static void setPassStore(const QString &passStore)
static void setUseSelection(const bool &useSelection)
void useTrayIcon(bool useTrayIdon)
ConfigDialog::useTrayIcon set preference for using trayicon. Enable or disable related checkboxes acc...
static bool isUsePass(const bool &defaultValue=QVariant().toBool())
static bool isAutoPull(const bool &defaultValue=QVariant().toBool())
static QString normalizeFolderPath(QString path)
Util::normalizeFolderPath let&#39;s always end folders with a QDir::separator()
Definition: util.cpp:68
characterSet
The selected character set.
static bool isAutoPush(const bool &defaultValue=QVariant().toBool())
static int getClipBoardTypeRaw(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
static void setAvoidCapitals(const bool &avoidCapitals)