7#include "ui_configdialog.h"
14#include <QSystemTrayIcon>
15#include <QTableWidgetItem>
36 bool hasSavedGeometry = !savedGeometry.isEmpty();
37 if (hasSavedGeometry) {
38 restoreGeometry(savedGeometry);
42 }
else if (!hasSavedGeometry) {
52 ui->spinBoxAutoclearPanelSeconds->setValue(
61 if (QSystemTrayIcon::isSystemTrayAvailable()) {
65 ui->checkBoxUseTrayIcon->setEnabled(
false);
66 ui->checkBoxUseTrayIcon->setToolTip(tr(
"System tray is not available"));
67 ui->checkBoxHideOnClose->setEnabled(
false);
68 ui->checkBoxStartMinimized->setEnabled(
false);
76 ui->checkBoxTemplateAllFields->setChecked(
83 ui->checkBoxUseOtp->hide();
84 ui->checkBoxUseQrencode->hide();
88 if (!isPassOtpAvailable()) {
89 ui->checkBoxUseOtp->setEnabled(
false);
90 ui->checkBoxUseOtp->setToolTip(
91 tr(
"Pass OTP extension needs to be installed"));
94 if (!isQrencodeAvailable()) {
95 ui->checkBoxUseQrencode->setEnabled(
false);
96 ui->checkBoxUseQrencode->setToolTip(tr(
"qrencode needs to be installed"));
115 ui->profileTable->verticalHeader()->hide();
116 ui->profileTable->horizontalHeader()->setSectionResizeMode(
117 1, QHeaderView::Stretch);
118 ui->label->setText(ui->label->text() + VERSION);
119 ui->comboBoxClipboard->clear();
121 ui->comboBoxClipboard->addItem(tr(
"No Clipboard"));
122 ui->comboBoxClipboard->addItem(tr(
"Always copy to clipboard"));
123 ui->comboBoxClipboard->addItem(tr(
"On-demand copy to clipboard"));
126 ui->comboBoxClipboard->setCurrentIndex(currentIndex);
127 on_comboBoxClipboard_activated(currentIndex);
129 QClipboard *clip = QApplication::clipboard();
130 if (!clip->supportsSelection()) {
132 ui->checkBoxSelection->setVisible(
false);
140 ui->tabWidget->setCurrentIndex(1);
143 connect(ui->profileTable, &QTableWidget::itemChanged,
this,
144 &ConfigDialog::onProfileTableItemChanged);
145 connect(
this, &ConfigDialog::accepted,
this, &ConfigDialog::on_accepted);
163void ConfigDialog::setGitPath(
const QString &path) {
164 ui->gitPath->setText(path);
165 ui->checkBoxUseGit->setEnabled(!path.isEmpty());
166 if (path.isEmpty()) {
176void ConfigDialog::usePass(
bool usePass) {
177 ui->radioButtonNative->setChecked(!usePass);
178 ui->radioButtonPass->setChecked(usePass);
194void ConfigDialog::validate(QTableWidgetItem *item) {
197 if (item ==
nullptr) {
198 for (
int i = 0; i < ui->profileTable->rowCount(); i++) {
199 for (
int j = 0; j < ui->profileTable->columnCount(); j++) {
200 QTableWidgetItem *_item = ui->profileTable->item(i, j);
202 if (_item->text().isEmpty() && j != 2) {
203 _item->setBackground(Qt::red);
204 _item->setToolTip(tr(
"This field is required"));
208 _item->setBackground(QBrush());
209 _item->setToolTip(QString());
218 if (item->text().isEmpty() && item->column() != 2) {
219 item->setBackground(Qt::red);
220 item->setToolTip(tr(
"This field is required"));
223 item->setBackground(QBrush());
224 item->setToolTip(QString());
228 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status);
242void ConfigDialog::on_accepted() {
255 ui->spinBoxAutoclearPanelSeconds->value());
263 ui->checkBoxUseTrayIcon->isChecked());
265 ui->checkBoxHideOnClose->isChecked());
267 ui->checkBoxStartMinimized->isChecked());
282 ui->checkBoxTemplateAllFields->isChecked());
299void ConfigDialog::on_autodetectButton_clicked() {
301 if (!pass.isEmpty()) {
302 ui->passPath->setText(pass);
304 usePass(!pass.isEmpty());
309 if (!gpg.isEmpty()) {
310 ui->gpgPath->setText(gpg);
313 if (!git.isEmpty()) {
314 ui->gitPath->setText(git);
317 if (!pwgen.isEmpty()) {
318 ui->pwgenPath->setText(pwgen);
326void ConfigDialog::on_radioButtonNative_clicked() { setGroupBoxState(); }
332void ConfigDialog::on_radioButtonPass_clicked() { setGroupBoxState(); }
338auto ConfigDialog::getSecretKeys() -> QStringList {
355void ConfigDialog::setGroupBoxState() {
356 bool state = ui->radioButtonPass->isChecked();
357 ui->groupBoxNative->setEnabled(!state);
358 ui->groupBoxPass->setEnabled(state);
365auto ConfigDialog::selectExecutable() -> QString {
366 QFileDialog dialog(
this);
367 dialog.setFileMode(QFileDialog::ExistingFile);
368 dialog.setOption(QFileDialog::ReadOnly);
370 return dialog.selectedFiles().constFirst();
380auto ConfigDialog::selectFolder() -> QString {
381 QFileDialog dialog(
this);
382 dialog.setFileMode(QFileDialog::Directory);
383 dialog.setFilter(QDir::NoFilter);
384 dialog.setOption(QFileDialog::ShowDirsOnly);
386 return dialog.selectedFiles().constFirst();
396void ConfigDialog::on_toolButtonGit_clicked() {
397 QString git = selectExecutable();
398 bool state = !git.isEmpty();
400 ui->gitPath->setText(git);
405 ui->checkBoxUseGit->setEnabled(state);
411void ConfigDialog::on_toolButtonGpg_clicked() {
412 QString gpg = selectExecutable();
413 if (!gpg.isEmpty()) {
414 ui->gpgPath->setText(gpg);
421void ConfigDialog::on_pushButtonGenerateKey_clicked() {
422 KeygenDialog d(
this);
429void ConfigDialog::on_toolButtonPass_clicked() {
430 QString pass = selectExecutable();
431 if (!pass.isEmpty()) {
432 ui->passPath->setText(pass);
440void ConfigDialog::on_toolButtonStore_clicked() {
441 QString store = selectFolder();
442 if (!store.isEmpty()) {
443 ui->storePath->setText(store);
451void ConfigDialog::on_comboBoxClipboard_activated(
int index) {
452 bool state = index > 0;
454 ui->checkBoxSelection->setEnabled(state);
455 ui->checkBoxAutoclear->setEnabled(state);
456 ui->checkBoxHidePassword->setEnabled(state);
457 ui->checkBoxHideContent->setEnabled(state);
459 ui->spinBoxAutoclearSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
460 ui->labelSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
462 ui->spinBoxAutoclearSeconds->setEnabled(
false);
463 ui->labelSeconds->setEnabled(
false);
471void ConfigDialog::on_checkBoxAutoclearPanel_clicked() {
472 bool state = ui->checkBoxAutoclearPanel->isChecked();
473 ui->spinBoxAutoclearPanelSeconds->setEnabled(state);
474 ui->labelPanelSeconds->setEnabled(state);
484 on_checkBoxSelection_clicked();
494 on_checkBoxAutoclear_clicked();
504 on_checkBoxAutoclearPanel_clicked();
511void ConfigDialog::on_checkBoxSelection_clicked() {
512 on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
519void ConfigDialog::on_checkBoxAutoclear_clicked() {
520 on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
531 mainWindow->generateKeyPair(batch, dialog);
540void ConfigDialog::setProfiles(QHash<QString, QHash<QString, QString>> profiles,
541 const QString ¤tProfile) {
542 if (profiles.contains(
"")) {
547 ui->profileTable->setRowCount(profiles.count());
548 QHashIterator<QString, QHash<QString, QString>> i(profiles);
550 while (i.hasNext()) {
552 if (!i.value().isEmpty() && !i.key().isEmpty()) {
553 ui->profileTable->setItem(n, 0,
new QTableWidgetItem(i.key()));
554 ui->profileTable->setItem(n, 1,
555 new QTableWidgetItem(i.value().value(
"path")));
556 ui->profileTable->setItem(
557 n, 2,
new QTableWidgetItem(i.value().value(
"signingKey")));
558 if (i.key() == currentProfile) {
559 ui->profileTable->selectRow(n);
571 QHash<QString, QHash<QString, QString>> profiles;
573 for (
int i = 0; i < ui->profileTable->rowCount(); ++i) {
574 QHash<QString, QString> profile;
575 QTableWidgetItem *pathItem = ui->profileTable->item(i, 1);
576 if (
nullptr != pathItem) {
577 QTableWidgetItem *item = ui->profileTable->item(i, 0);
578 if (item ==
nullptr) {
581 profile[
"path"] = pathItem->text();
582 QTableWidgetItem *signingKeyItem = ui->profileTable->item(i, 2);
583 if (
nullptr != signingKeyItem) {
584 profile[
"signingKey"] = signingKeyItem->text();
586 profiles.insert(item->text(), profile);
595void ConfigDialog::on_addButton_clicked() {
596 int n = ui->profileTable->rowCount();
597 ui->profileTable->insertRow(n);
598 ui->profileTable->setItem(n, 0,
new QTableWidgetItem());
599 ui->profileTable->setItem(n, 1,
new QTableWidgetItem(ui->storePath->text()));
600 ui->profileTable->setItem(n, 2,
new QTableWidgetItem());
601 ui->profileTable->selectRow(n);
602 ui->deleteButton->setEnabled(
true);
610void ConfigDialog::on_deleteButton_clicked() {
611 QSet<int> selectedRows;
612 QList<QTableWidgetItem *> itemList = ui->profileTable->selectedItems();
613 if (itemList.count() == 0) {
614 QMessageBox::warning(
this, tr(
"No profile selected"),
615 tr(
"No profile selected to delete"));
618 QTableWidgetItem *item;
619 foreach (item, itemList)
620 selectedRows.insert(item->row());
622 QList<int> rows = selectedRows.values();
623 std::sort(rows.begin(), rows.end());
625 foreach (
int row, rows)
626 ui->profileTable->removeRow(row);
627 if (ui->profileTable->rowCount() < 1) {
628 ui->deleteButton->setEnabled(
false);
640void ConfigDialog::criticalMessage(
const QString &title,
const QString &text) {
641 QMessageBox::critical(
this, title, text, QMessageBox::Ok, QMessageBox::Ok);
654auto ConfigDialog::isQrencodeAvailable() ->
bool {
659 which.start(
"which", QStringList() <<
"qrencode");
660 which.waitForFinished();
662 which.readAllStandardOutput().trimmed());
663 return which.exitCode() == 0;
667auto ConfigDialog::isPassOtpAvailable() ->
bool {
674 pass.waitForFinished(2000);
675 return pass.exitCode() == 0;
685 on_autodetectButton_clicked();
687 if (!checkGpgExistence()) {
690 if (!checkSecretKeys()) {
693 if (!checkPasswordStore()) {
698 ui->checkBoxHidePassword->setCheckState(Qt::Checked);
711auto ConfigDialog::checkGpgExistence() ->
bool {
712 QString gpg = ui->gpgPath->text();
713 if (!gpg.startsWith(
"wsl ") && !QFile(gpg).exists()) {
715 tr(
"GnuPG not found"),
718 tr(
"Please install GnuPG on your system.<br>Install "
719 "<strong>Ubuntu</strong> from the Microsoft Store to get it.<br>"
720 "If you already did so, make sure you started it once and<br>"
721 "click \"Autodetect\" in the next dialog.")
723 tr(
"Please install GnuPG on your system.<br>Install "
724 "<strong>Ubuntu</strong> from the Microsoft Store<br>or <a "
725 "href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
729 tr(
"Please install GnuPG on your system.<br>Install "
730 "<strong>gpg</strong> using your favorite package manager<br>or "
732 "href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
752auto ConfigDialog::checkSecretKeys() ->
bool {
753 QString gpg = ui->gpgPath->text();
754 QStringList names = getSecretKeys();
760 if ((gpg.startsWith(
"wsl ") || QFile(gpg).exists()) && names.empty()) {
778auto ConfigDialog::checkPasswordStore() ->
bool {
779 QString passStore = ui->storePath->text();
781 if (!QFile(passStore).exists()) {
782 if (QMessageBox::question(
783 this, tr(
"Create password-store?"),
784 tr(
"Would you like to create a password-store at %1?")
786 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
787 if (!QDir().mkdir(passStore)) {
788 QMessageBox::warning(
790 tr(
"Failed to create password-store at: %1").arg(passStore));
794 SetFileAttributes(passStore.toStdWString().c_str(),
795 FILE_ATTRIBUTE_HIDDEN);
797 if (ui->checkBoxUseGit->isChecked()) {
798 emit mainWindow->passGitInitNeeded();
800 mainWindow->userDialog(passStore);
815void ConfigDialog::handleGpgIdFile() {
816 QString passStore = ui->storePath->text();
817 if (!QFile(QDir(passStore).filePath(
".gpg-id")).exists()) {
819 dbg() <<
".gpg-id file does not exist";
821 criticalMessage(tr(
"Password store not initialised"),
822 tr(
"The folder %1 doesn't seem to be a password store or "
823 "is not yet initialised.")
826 while (!QFile(passStore).exists()) {
827 on_toolButtonStore_clicked();
828 if (passStore == ui->storePath->text()) {
831 passStore = ui->storePath->text();
833 if (!QFile(passStore +
".gpg-id").exists()) {
835 dbg() <<
".gpg-id file still does not exist :/";
837 mainWindow->userDialog(passStore);
848 if (QSystemTrayIcon::isSystemTrayAvailable()) {
849 ui->checkBoxUseTrayIcon->setChecked(useSystray);
850 ui->checkBoxHideOnClose->setEnabled(useSystray);
851 ui->checkBoxStartMinimized->setEnabled(useSystray);
854 ui->checkBoxHideOnClose->setChecked(
false);
855 ui->checkBoxStartMinimized->setChecked(
false);
864void ConfigDialog::on_checkBoxUseTrayIcon_clicked() {
865 bool state = ui->checkBoxUseTrayIcon->isChecked();
866 ui->checkBoxHideOnClose->setEnabled(state);
867 ui->checkBoxStartMinimized->setEnabled(state);
876 if (!isMaximized()) {
889 ui->checkBoxUseGit->setChecked(
useGit);
890 on_checkBoxUseGit_clicked();
898 ui->checkBoxUseOtp->setChecked(
useOtp);
913void ConfigDialog::on_checkBoxUseGit_clicked() {
914 ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked());
915 ui->checkBoxAutoPull->setEnabled(ui->checkBoxUseGit->isChecked());
916 ui->checkBoxAutoPush->setEnabled(ui->checkBoxUseGit->isChecked());
923void ConfigDialog::on_toolButtonPwgen_clicked() {
924 QString pwgen = selectExecutable();
925 if (!pwgen.isEmpty()) {
926 ui->pwgenPath->setText(pwgen);
927 ui->checkBoxUsePwgen->setEnabled(
true);
929 ui->checkBoxUsePwgen->setEnabled(
false);
930 ui->checkBoxUsePwgen->setChecked(
false);
940 ui->pwgenPath->setText(pwgen);
941 if (pwgen.isEmpty()) {
942 ui->checkBoxUsePwgen->setChecked(
false);
943 ui->checkBoxUsePwgen->setEnabled(
false);
945 on_checkBoxUsePwgen_clicked();
952void ConfigDialog::on_checkBoxUsePwgen_clicked() {
953 bool usePwgen = ui->checkBoxUsePwgen->isChecked();
954 ui->checkBoxAvoidCapitals->setEnabled(
usePwgen);
955 ui->checkBoxAvoidNumbers->setEnabled(
usePwgen);
956 ui->checkBoxLessRandom->setEnabled(
usePwgen);
957 ui->checkBoxUseSymbols->setEnabled(
usePwgen);
958 ui->lineEditPasswordChars->setEnabled(!
usePwgen);
959 ui->labelPasswordChars->setEnabled(!
usePwgen);
960 ui->passwordCharTemplateSelector->setEnabled(!
usePwgen);
971 if (ui->pwgenPath->text().isEmpty()) {
974 ui->checkBoxUsePwgen->setChecked(
usePwgen);
975 on_checkBoxUsePwgen_clicked();
980 ui->spinBoxPasswordLength->setValue(config.
length);
981 ui->passwordCharTemplateSelector->setCurrentIndex(config.
selected);
983 ui->lineEditPasswordChars->setEnabled(
false);
990 config.
length = ui->spinBoxPasswordLength->value();
992 ui->passwordCharTemplateSelector->currentIndex());
994 ui->lineEditPasswordChars->text();
1004void ConfigDialog::on_passwordCharTemplateSelector_activated(
int index) {
1005 ui->lineEditPasswordChars->setText(
1008 ui->lineEditPasswordChars->setEnabled(
true);
1010 ui->lineEditPasswordChars->setEnabled(
false);
1018void ConfigDialog::on_checkBoxUseTemplate_clicked() {
1019 ui->plainTextEditTemplate->setEnabled(ui->checkBoxUseTemplate->isChecked());
1020 ui->checkBoxTemplateAllFields->setEnabled(
1021 ui->checkBoxUseTemplate->isChecked());
1024void ConfigDialog::onProfileTableItemChanged(QTableWidgetItem *item) {
1034 on_checkBoxUseTemplate_clicked();
void setPasswordConfiguration(const PasswordConfiguration &config)
auto getProfiles() -> QHash< QString, QHash< QString, QString > >
ConfigDialog::getProfiles return profile list.
~ConfigDialog() override
ConfigDialog::~ConfigDialog config destructor, makes sure the mainWindow knows about git,...
void useOtp(bool useOtp)
ConfigDialog::useOtp set preference for using otp plugin.
void useGit(bool useGit)
ConfigDialog::useGit set preference for using git.
void useAutoclearPanel(bool useAutoclearPanel)
ConfigDialog::useAutoclearPanel set the panel autoclear use from MainWindow.
void useAutoclear(bool useAutoclear)
ConfigDialog::useAutoclear set the clipboard autoclear use from MainWindow.
void useQrencode(bool useQrencode)
ConfigDialog::useQrencode set preference for using qrencode plugin.
void useTemplate(bool useTemplate)
ConfigDialog::useTemplate set preference for using templates.
ConfigDialog(MainWindow *parent)
ConfigDialog::ConfigDialog this sets up the configuration screen.
void setPwgenPath(const QString &)
ConfigDialog::setPwgenPath set pwgen executable path. Enable or disable related options in the interf...
auto getPasswordConfiguration() -> PasswordConfiguration
void useTrayIcon(bool useSystray)
ConfigDialog::useTrayIcon set preference for using trayicon. Enable or disable related checkboxes acc...
void usePwgen(bool usePwgen)
ConfigDialog::usePwgen set preference for using pwgen (can be overruled by empty pwgenPath)....
void wizard()
ConfigDialog::wizard first-time use wizard.
void closeEvent(QCloseEvent *event) override
ConfigDialog::closeEvent close this window.
void useSelection(bool useSelection)
ConfigDialog::useSelection set the clipboard type use from MainWindow.
void genKey(const QString &, QDialog *)
ConfigDialog::genKey tunnel function to make MainWindow generate a gpg key pair.
Handles GPG keypair generation.
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more,...
static auto isUseSelection(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use selection (X11) for clipboard.
static void setStartMinimized(const bool &startMinimized)
Save start-minimized flag.
static auto isUseAutoclear(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use autoclear for clipboard.
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
Save panel autoclear seconds.
static void setPassExecutable(const QString &passExecutable)
Save pass executable path.
static auto isStartMinimized(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether application should start minimized.
static void setHidePassword(const bool &hidePassword)
Save hide password setting.
static auto isUseOtp(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether OTP support is enabled.
static void setPwgenExecutable(const QString &pwgenExecutable)
Save pwgen executable path.
static auto getPwgenExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pwgen executable path.
static void setUseTrayIcon(const bool &useTrayIcon)
Save tray icon support flag.
static auto isNoLineWrapping(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to disable line wrapping.
static void setPassStore(const QString &passStore)
Save password store path.
static auto isHideContent(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to hide content (password + username).
static void setPasswordConfiguration(const PasswordConfiguration &config)
Save complete password generation configuration.
static void setHideOnClose(const bool &hideOnClose)
Save hide-on-close flag.
static auto getPass() -> Pass *
Get currently active pass backend instance.
static auto getPasswordConfiguration() -> PasswordConfiguration
Get complete password generation configuration.
static auto isUseQrencode(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether qrencode support is enabled.
static auto isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use panel autoclear.
static auto isAutoPull(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether automatic pull is enabled.
static void setGitExecutable(const QString &gitExecutable)
Save git executable path.
static auto isUseGit(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether Git integration is enabled.
static void setUseOtp(const bool &useOtp)
Save OTP support flag.
static void setProfiles(const QHash< QString, QHash< QString, QString > > &profiles)
Save all configured profiles.
static void setUsePwgen(const bool &usePwgen)
Save pwgen support flag.
static auto isTemplateAllFields(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether template applies to all fields.
static auto isUsePass(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use pass (true) or GPG (false).
static auto getPassStore(const QString &defaultValue=QVariant().toString()) -> QString
Get password store directory path.
static auto isUseTemplate(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether template usage is enabled.
static auto isUseTrayIcon(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether tray icon support is enabled.
static void setUseTemplate(const bool &useTemplate)
Save template usage flag.
static void setDialogPos(const QString &key, const QPoint &pos)
Save dialog position.
static auto isAvoidCapitals(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether uppercase characters should be avoided.
static auto isAddGPGId(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to auto-add GPG ID when receiving files.
static auto getGpgExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get GPG executable path.
static void setAutoPull(const bool &autoPull)
Save automatic pull flag.
static void setPassTemplate(const QString &passTemplate)
Save pass entry template.
static auto isUseSymbols(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether symbol characters are enabled.
static void setGpgExecutable(const QString &gpgExecutable)
Save GPG executable path.
static void setVersion(const QString &version)
Save application version.
static void setUseAutoclear(const bool &useAutoclear)
Save use autoclear setting.
static auto isLessRandom(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether less random password generation is enabled.
static void setAlwaysOnTop(const bool &alwaysOnTop)
Save always-on-top flag.
static auto getPassTemplate(const QString &defaultValue=QVariant().toString()) -> QString
Get pass entry template.
static void setDisplayAsIs(const bool &displayAsIs)
Save display as-is setting.
static void setUseMonospace(const bool &useMonospace)
Save use monospace setting.
static void setDialogSize(const QString &key, const QSize &size)
Save dialog size.
static void setAvoidCapitals(const bool &avoidCapitals)
Save uppercase avoidance flag.
static void setDialogMaximized(const QString &key, const bool &maximized)
Save dialog maximized state.
static void setQrencodeExecutable(const QString &qrencodeExecutable)
Save qrencode executable path.
static auto getProfile(const QString &defaultValue=QVariant().toString()) -> QString
Get active profile name.
static auto isUseMonospace(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to use monospace font.
static void setAddGPGId(const bool &addGPGId)
Save add GPG ID setting.
static void setUsePass(const bool &usePass)
Save use pass setting.
static auto isDialogMaximized(const QString &key, const bool &defaultValue=QVariant().toBool()) -> bool
Get dialog maximized state.
static auto getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt()) -> int
Get panel autoclear delay in seconds.
static auto isUsePwgen(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether pwgen support is enabled.
static auto isAlwaysOnTop(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether main window should stay always on top.
static auto isAvoidNumbers(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether numeric characters should be avoided.
static auto isHidePassword(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to hide password in UI.
static void setDialogGeometry(const QString &key, const QByteArray &geometry)
Save dialog geometry.
static auto getPassExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pass executable path.
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
Save use autoclear panel setting.
static void setAutoclearSeconds(const int &autoClearSeconds)
Save autoclear seconds.
static void setNoLineWrapping(const bool &noLineWrapping)
Save no line wrapping setting.
static void setUseQrencode(const bool &useQrencode)
Save qrencode support flag.
static void setAvoidNumbers(const bool &avoidNumbers)
Save numeric avoidance flag.
static auto getDialogGeometry(const QString &key, const QByteArray &defaultValue=QVariant().toByteArray()) -> QByteArray
Get saved dialog geometry.
static auto isHideOnClose(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether closing the window hides the application.
static void setAutoPush(const bool &autoPush)
Save automatic push flag.
static void setClipBoardType(const int &clipBoardType)
Save clipboard type.
static auto getProfiles() -> QHash< QString, QHash< QString, QString > >
Get all configured profiles.
static void setLessRandom(const bool &lessRandom)
Save less-random generation flag.
static auto getAutoclearSeconds(const int &defaultValue=QVariant().toInt()) -> int
Get autoclear delay in seconds.
static void setHideContent(const bool &hideContent)
Save hide content setting.
static auto isAutoPush(const bool &defaultValue=QVariant().toBool()) -> bool
Check whether automatic push is enabled.
static void setUseSelection(const bool &useSelection)
Save use selection setting.
static auto getClipBoardTypeRaw(const Enums::clipBoardType &defaultValue=Enums::CLIPBOARD_NEVER) -> int
Get clipboard type preference.
static auto getGitExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get git executable path.
static void setTemplateAllFields(const bool &templateAllFields)
Save template-all-fields flag.
static void setUseSymbols(const bool &useSymbols)
Save symbol usage flag.
static auto isDisplayAsIs(const bool &defaultValue=QVariant().toBool()) -> bool
Get whether to display password as-is (no modification).
static void setUseGit(const bool &useGit)
Save Git integration flag.
static auto normalizeFolderPath(const QString &path) -> QString
Ensure a folder path always ends with the native directory separator.
static auto findBinaryInPath(QString binary) -> QString
Locate an executable by searching the process PATH and (on Windows) falling back to WSL.
static auto configIsValid() -> bool
Verify that the required configuration is complete.
Debug utilities for QtPass.
#define dbg()
Simple debug macro that includes file and line number.
Holds the Password configuration settings.
int length
Length of the password.
enum PasswordConfiguration::characterSet selected
characterSet
The selected character set.
QString Characters[CHARSETS_COUNT]
The different character sets.
Stores key info lines including validity, creation date and more.
QString name
UserInfo::name GPG user ID / full name.