Validates the configuration table fields and enables or disables the OK button accordingly.
Validates the configuration table fields and enables or disables the OK button accordingly.
#include "ui_configdialog.h"
#include <QClipboard>
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
#include <QPushButton>
#include <QSystemTrayIcon>
#include <QTableWidgetItem>
#include <utility>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#ifdef QT_DEBUG
#endif
mainWindow = parent;
ui->setupUi(this);
bool hasSavedGeometry = !savedGeometry.isEmpty();
if (hasSavedGeometry) {
restoreGeometry(savedGeometry);
}
showMaximized();
} else if (!hasSavedGeometry) {
}
ui->spinBoxAutoclearPanelSeconds->setValue(
if (QSystemTrayIcon::isSystemTrayAvailable()) {
} else {
ui->checkBoxUseTrayIcon->setEnabled(false);
ui->checkBoxUseTrayIcon->setToolTip(tr("System tray is not available"));
ui->checkBoxHideOnClose->setEnabled(false);
ui->checkBoxStartMinimized->setEnabled(false);
}
ui->checkBoxTemplateAllFields->setChecked(
#if defined(Q_OS_WIN)
ui->checkBoxUseOtp->hide();
ui->checkBoxUseQrencode->hide();
ui->label_10->hide();
#endif
if (!isPassOtpAvailable()) {
ui->checkBoxUseOtp->setEnabled(false);
ui->checkBoxUseOtp->setToolTip(
tr("Pass OTP extension needs to be installed"));
}
if (!isQrencodeAvailable()) {
ui->checkBoxUseQrencode->setEnabled(false);
ui->checkBoxUseQrencode->setToolTip(tr("qrencode needs to be installed"));
}
ui->profileTable->verticalHeader()->hide();
ui->profileTable->horizontalHeader()->setSectionResizeMode(
1, QHeaderView::Stretch);
ui->label->setText(ui->label->text() + VERSION);
ui->comboBoxClipboard->clear();
ui->comboBoxClipboard->addItem(tr("No Clipboard"));
ui->comboBoxClipboard->addItem(tr("Always copy to clipboard"));
ui->comboBoxClipboard->addItem(tr("On-demand copy to clipboard"));
ui->comboBoxClipboard->setCurrentIndex(currentIndex);
on_comboBoxClipboard_activated(currentIndex);
QClipboard *clip = QApplication::clipboard();
if (!clip->supportsSelection()) {
useSelection(false);
ui->checkBoxSelection->setVisible(false);
} else {
}
ui->tabWidget->setCurrentIndex(1);
}
connect(ui->profileTable, &QTableWidget::itemChanged, this,
&ConfigDialog::onProfileTableItemChanged);
connect(this, &ConfigDialog::accepted, this, &ConfigDialog::on_accepted);
}
}
void ConfigDialog::setGitPath(const QString &path) {
ui->gitPath->setText(path);
ui->checkBoxUseGit->setEnabled(!path.isEmpty());
if (path.isEmpty()) {
}
}
void ConfigDialog::usePass(bool usePass) {
ui->radioButtonNative->setChecked(!usePass);
ui->radioButtonPass->setChecked(usePass);
setGroupBoxState();
}
void ConfigDialog::validate(QTableWidgetItem *item) {
bool status = true;
if (item == nullptr) {
for (int i = 0; i < ui->profileTable->rowCount(); i++) {
for (int j = 0; j < ui->profileTable->columnCount(); j++) {
QTableWidgetItem *_item = ui->profileTable->item(i, j);
if (_item->text().isEmpty() && j != 2) {
_item->setBackground(Qt::red);
_item->setToolTip(tr("This field is required"));
status = false;
break;
} else {
_item->setBackground(QBrush());
_item->setToolTip(QString());
}
}
if (!status) {
break;
}
}
} else {
if (item->text().isEmpty() && item->column() != 2) {
item->setBackground(Qt::red);
item->setToolTip(tr("This field is required"));
status = false;
} else {
item->setBackground(QBrush());
item->setToolTip(QString());
}
}
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status);
}
void ConfigDialog::on_accepted() {
ui->spinBoxAutoclearPanelSeconds->value());
ui->checkBoxUseTrayIcon->isChecked());
ui->checkBoxHideOnClose->isChecked());
ui->checkBoxStartMinimized->isChecked());
ui->checkBoxTemplateAllFields->isChecked());
}
void ConfigDialog::on_autodetectButton_clicked() {
if (!pass.isEmpty()) {
ui->passPath->setText(pass);
}
usePass(!pass.isEmpty());
if (gpg.isEmpty()) {
}
if (!gpg.isEmpty()) {
ui->gpgPath->setText(gpg);
}
if (!git.isEmpty()) {
ui->gitPath->setText(git);
}
if (!pwgen.isEmpty()) {
ui->pwgenPath->setText(pwgen);
}
}
void ConfigDialog::on_radioButtonNative_clicked() { setGroupBoxState(); }
void ConfigDialog::on_radioButtonPass_clicked() { setGroupBoxState(); }
auto ConfigDialog::getSecretKeys() -> QStringList {
QStringList names;
if (keys.empty()) {
return names;
}
return names;
}
void ConfigDialog::setGroupBoxState() {
bool state = ui->radioButtonPass->isChecked();
ui->groupBoxNative->setEnabled(!state);
ui->groupBoxPass->setEnabled(state);
}
auto ConfigDialog::selectExecutable() -> QString {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setOption(QFileDialog::ReadOnly);
if (dialog.exec()) {
return dialog.selectedFiles().constFirst();
}
return {};
}
auto ConfigDialog::selectFolder() -> QString {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::Directory);
dialog.setFilter(QDir::NoFilter);
dialog.setOption(QFileDialog::ShowDirsOnly);
if (dialog.exec()) {
return dialog.selectedFiles().constFirst();
}
return {};
}
void ConfigDialog::on_toolButtonGit_clicked() {
QString git = selectExecutable();
bool state = !git.isEmpty();
if (state) {
ui->gitPath->setText(git);
} else {
}
ui->checkBoxUseGit->setEnabled(state);
}
void ConfigDialog::on_toolButtonGpg_clicked() {
QString gpg = selectExecutable();
if (!gpg.isEmpty()) {
ui->gpgPath->setText(gpg);
}
}
void ConfigDialog::on_pushButtonGenerateKey_clicked() {
KeygenDialog d(this);
d.exec();
}
void ConfigDialog::on_toolButtonPass_clicked() {
QString pass = selectExecutable();
if (!pass.isEmpty()) {
ui->passPath->setText(pass);
}
}
void ConfigDialog::on_toolButtonStore_clicked() {
QString store = selectFolder();
if (!store.isEmpty()) {
ui->storePath->setText(store);
}
}
void ConfigDialog::on_comboBoxClipboard_activated(int index) {
bool state = index > 0;
ui->checkBoxSelection->setEnabled(state);
ui->checkBoxAutoclear->setEnabled(state);
ui->checkBoxHidePassword->setEnabled(state);
ui->checkBoxHideContent->setEnabled(state);
if (state) {
ui->spinBoxAutoclearSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
ui->labelSeconds->setEnabled(ui->checkBoxAutoclear->isChecked());
} else {
ui->spinBoxAutoclearSeconds->setEnabled(false);
ui->labelSeconds->setEnabled(false);
}
}
void ConfigDialog::on_checkBoxAutoclearPanel_clicked() {
bool state = ui->checkBoxAutoclearPanel->isChecked();
ui->spinBoxAutoclearPanelSeconds->setEnabled(state);
ui->labelPanelSeconds->setEnabled(state);
}
on_checkBoxSelection_clicked();
}
on_checkBoxAutoclear_clicked();
}
on_checkBoxAutoclearPanel_clicked();
}
void ConfigDialog::on_checkBoxSelection_clicked() {
on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
}
void ConfigDialog::on_checkBoxAutoclear_clicked() {
on_comboBoxClipboard_activated(ui->comboBoxClipboard->currentIndex());
}
mainWindow->generateKeyPair(batch, dialog);
}
void ConfigDialog::setProfiles(QHash<QString, QHash<QString, QString>> profiles,
const QString ¤tProfile) {
if (profiles.contains("")) {
profiles.remove("");
}
ui->profileTable->setRowCount(profiles.count());
QHashIterator<QString, QHash<QString, QString>> i(profiles);
int n = 0;
while (i.hasNext()) {
i.next();
if (!i.value().isEmpty() && !i.key().isEmpty()) {
ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key()));
ui->profileTable->setItem(n, 1,
new QTableWidgetItem(i.value().value("path")));
ui->profileTable->setItem(
n, 2, new QTableWidgetItem(i.value().value("signingKey")));
if (i.key() == currentProfile) {
ui->profileTable->selectRow(n);
}
}
++n;
}
}
QHash<QString, QHash<QString, QString>> profiles;
for (int i = 0; i < ui->profileTable->rowCount(); ++i) {
QHash<QString, QString> profile;
QTableWidgetItem *pathItem = ui->profileTable->item(i, 1);
if (nullptr != pathItem) {
QTableWidgetItem *item = ui->profileTable->item(i, 0);
if (item == nullptr) {
continue;
}
profile["path"] = pathItem->text();
QTableWidgetItem *signingKeyItem = ui->profileTable->item(i, 2);
if (nullptr != signingKeyItem) {
profile["signingKey"] = signingKeyItem->text();
}
profiles.insert(item->text(), profile);
}
}
return profiles;
}
void ConfigDialog::on_addButton_clicked() {
int n = ui->profileTable->rowCount();
ui->profileTable->insertRow(n);
ui->profileTable->setItem(n, 0, new QTableWidgetItem());
ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text()));
ui->profileTable->setItem(n, 2, new QTableWidgetItem());
ui->profileTable->selectRow(n);
ui->deleteButton->setEnabled(true);
validate();
}
void ConfigDialog::on_deleteButton_clicked() {
QSet<int> selectedRows;
QList<QTableWidgetItem *> itemList = ui->profileTable->selectedItems();
if (itemList.count() == 0) {
QMessageBox::warning(this, tr("No profile selected"),
tr("No profile selected to delete"));
return;
}
QTableWidgetItem *item;
foreach (item, itemList)
selectedRows.insert(item->row());
QList<int> rows = selectedRows.values();
std::sort(rows.begin(), rows.end());
foreach (int row, rows)
ui->profileTable->removeRow(row);
if (ui->profileTable->rowCount() < 1) {
ui->deleteButton->setEnabled(false);
}
validate();
}
void ConfigDialog::criticalMessage(const QString &title, const QString &text) {
QMessageBox::critical(this, title, text, QMessageBox::Ok, QMessageBox::Ok);
}
auto ConfigDialog::isQrencodeAvailable() -> bool {
#ifdef Q_OS_WIN
return false;
#else
QProcess which;
which.start("which", QStringList() << "qrencode");
which.waitForFinished();
which.readAllStandardOutput().trimmed());
return which.exitCode() == 0;
#endif
}
auto ConfigDialog::isPassOtpAvailable() -> bool {
#ifdef Q_OS_WIN
return false;
#else
QProcess pass;
<< "--help");
pass.waitForFinished(2000);
return pass.exitCode() == 0;
#endif
}
on_autodetectButton_clicked();
if (!checkGpgExistence()) {
return;
}
if (!checkSecretKeys()) {
return;
}
if (!checkPasswordStore()) {
return;
}
handleGpgIdFile();
ui->checkBoxHidePassword->setCheckState(Qt::Checked);
}
auto ConfigDialog::checkGpgExistence() -> bool {
QString gpg = ui->gpgPath->text();
if (!gpg.startsWith("wsl ") && !QFile(gpg).exists()) {
criticalMessage(
tr("GnuPG not found"),
#ifdef Q_OS_WIN
#ifdef WINSTORE
tr("Please install GnuPG on your system.<br>Install "
"<strong>Ubuntu</strong> from the Microsoft Store to get it.<br>"
"If you already did so, make sure you started it once and<br>"
"click \"Autodetect\" in the next dialog.")
#else
tr("Please install GnuPG on your system.<br>Install "
"<strong>Ubuntu</strong> from the Microsoft Store<br>or <a "
"href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
"from GnuPG.org")
#endif
#else
tr("Please install GnuPG on your system.<br>Install "
"<strong>gpg</strong> using your favorite package manager<br>or "
"<a "
"href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it "
"from GnuPG.org")
#endif
);
return false;
}
return true;
}
auto ConfigDialog::checkSecretKeys() -> bool {
QString gpg = ui->gpgPath->text();
QStringList names = getSecretKeys();
#ifdef QT_DEBUG
#endif
if ((gpg.startsWith("wsl ") || QFile(gpg).exists()) && names.empty()) {
return d.exec();
}
return true;
}
auto ConfigDialog::checkPasswordStore() -> bool {
QString passStore = ui->storePath->text();
if (!QFile(passStore).exists()) {
if (QMessageBox::question(
this, tr("Create password-store?"),
tr("Would you like to create a password-store at %1?")
.arg(passStore),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
if (!QDir().mkdir(passStore)) {
QMessageBox::warning(
this, tr("Error"),
tr("Failed to create password-store at: %1").arg(passStore));
return false;
}
#ifdef Q_OS_WIN
SetFileAttributes(passStore.toStdWString().c_str(),
FILE_ATTRIBUTE_HIDDEN);
#endif
if (ui->checkBoxUseGit->isChecked()) {
emit mainWindow->passGitInitNeeded();
}
mainWindow->userDialog(passStore);
}
}
return true;
}
void ConfigDialog::handleGpgIdFile() {
QString passStore = ui->storePath->text();
if (!QFile(QDir(passStore).filePath(".gpg-id")).exists()) {
#ifdef QT_DEBUG
dbg() <<
".gpg-id file does not exist";
#endif
criticalMessage(tr("Password store not initialised"),
tr("The folder %1 doesn't seem to be a password store or "
"is not yet initialised.")
.arg(passStore));
while (!QFile(passStore).exists()) {
on_toolButtonStore_clicked();
if (passStore == ui->storePath->text()) {
return;
}
passStore = ui->storePath->text();
}
if (!QFile(passStore + ".gpg-id").exists()) {
#ifdef QT_DEBUG
dbg() <<
".gpg-id file still does not exist :/";
#endif
mainWindow->userDialog(passStore);
}
}
}
if (QSystemTrayIcon::isSystemTrayAvailable()) {
ui->checkBoxUseTrayIcon->setChecked(useSystray);
ui->checkBoxHideOnClose->setEnabled(useSystray);
ui->checkBoxStartMinimized->setEnabled(useSystray);
if (!useSystray) {
ui->checkBoxHideOnClose->setChecked(false);
ui->checkBoxStartMinimized->setChecked(false);
}
}
}
void ConfigDialog::on_checkBoxUseTrayIcon_clicked() {
bool state = ui->checkBoxUseTrayIcon->isChecked();
ui->checkBoxHideOnClose->setEnabled(state);
ui->checkBoxStartMinimized->setEnabled(state);
}
if (!isMaximized()) {
}
event->accept();
}
ui->checkBoxUseGit->setChecked(
useGit);
on_checkBoxUseGit_clicked();
}
ui->checkBoxUseOtp->setChecked(
useOtp);
}
}
void ConfigDialog::on_checkBoxUseGit_clicked() {
ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked());
ui->checkBoxAutoPull->setEnabled(ui->checkBoxUseGit->isChecked());
ui->checkBoxAutoPush->setEnabled(ui->checkBoxUseGit->isChecked());
}
void ConfigDialog::on_toolButtonPwgen_clicked() {
QString pwgen = selectExecutable();
if (!pwgen.isEmpty()) {
ui->pwgenPath->setText(pwgen);
ui->checkBoxUsePwgen->setEnabled(true);
} else {
ui->checkBoxUsePwgen->setEnabled(false);
ui->checkBoxUsePwgen->setChecked(false);
}
}
ui->pwgenPath->setText(pwgen);
if (pwgen.isEmpty()) {
ui->checkBoxUsePwgen->setChecked(false);
ui->checkBoxUsePwgen->setEnabled(false);
}
on_checkBoxUsePwgen_clicked();
}
void ConfigDialog::on_checkBoxUsePwgen_clicked() {
bool usePwgen = ui->checkBoxUsePwgen->isChecked();
ui->checkBoxAvoidCapitals->setEnabled(
usePwgen);
ui->checkBoxAvoidNumbers->setEnabled(
usePwgen);
ui->checkBoxLessRandom->setEnabled(
usePwgen);
ui->checkBoxUseSymbols->setEnabled(
usePwgen);
ui->lineEditPasswordChars->setEnabled(!
usePwgen);
ui->labelPasswordChars->setEnabled(!
usePwgen);
ui->passwordCharTemplateSelector->setEnabled(!
usePwgen);
}
if (ui->pwgenPath->text().isEmpty()) {
}
ui->checkBoxUsePwgen->setChecked(
usePwgen);
on_checkBoxUsePwgen_clicked();
}
ui->spinBoxPasswordLength->setValue(config.
length);
ui->passwordCharTemplateSelector->setCurrentIndex(config.
selected);
ui->lineEditPasswordChars->setEnabled(false);
}
}
config.
length = ui->spinBoxPasswordLength->value();
ui->passwordCharTemplateSelector->currentIndex());
ui->lineEditPasswordChars->text();
return config;
}
void ConfigDialog::on_passwordCharTemplateSelector_activated(int index) {
ui->lineEditPasswordChars->setText(
ui->lineEditPasswordChars->setEnabled(true);
} else {
ui->lineEditPasswordChars->setEnabled(false);
}
}
void ConfigDialog::on_checkBoxUseTemplate_clicked() {
ui->plainTextEditTemplate->setEnabled(ui->checkBoxUseTemplate->isChecked());
ui->checkBoxTemplateAllFields->setEnabled(
ui->checkBoxUseTemplate->isChecked());
}
void ConfigDialog::onProfileTableItemChanged(QTableWidgetItem *item) {
validate(item);
}
on_checkBoxUseTemplate_clicked();
}
The ConfigDialog handles the configuration interface.
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.