diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-11-24 11:19:27 +0100 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-11-24 11:19:27 +0100 |
commit | f4b2507e9bcde04f3178121d4bea017676b96886 (patch) | |
tree | ebac1d41d7513e8667b398cd7def235bcb421a2a | |
parent | ff072d1dac75589600e764a9fde013cf069807bb (diff) | |
parent | 247f6ee799fc912b40928f85a7167fff438430cb (diff) |
Merge pull request #120 from IJHack/develop
Cleanup and coding standards
-rw-r--r-- | .linthub.yml | 13 | ||||
-rw-r--r-- | CONTRIBUTING.md | 8 | ||||
-rw-r--r-- | FAQ.md | 33 | ||||
-rw-r--r-- | README.md | 31 | ||||
-rw-r--r-- | configdialog.cpp | 764 | ||||
-rw-r--r-- | configdialog.h | 192 | ||||
-rw-r--r-- | keygendialog.cpp | 191 | ||||
-rw-r--r-- | keygendialog.h | 54 | ||||
-rw-r--r-- | main.cpp | 83 | ||||
-rw-r--r-- | mainwindow.cpp | 2760 | ||||
-rw-r--r-- | mainwindow.h | 274 | ||||
-rw-r--r-- | passworddialog.cpp | 189 | ||||
-rw-r--r-- | passworddialog.h | 49 | ||||
-rw-r--r-- | progressindicator.cpp | 116 | ||||
-rw-r--r-- | progressindicator.h | 87 | ||||
-rw-r--r-- | qprogressindicator.cpp | 94 | ||||
-rw-r--r-- | qprogressindicator.h | 99 | ||||
-rw-r--r-- | qtpass.plist (renamed from Info.plist) | 0 | ||||
-rw-r--r-- | qtpass.pro | 10 | ||||
-rw-r--r-- | singleapplication.cpp | 104 | ||||
-rw-r--r-- | singleapplication.h | 41 | ||||
-rw-r--r-- | storemodel.cpp | 97 | ||||
-rw-r--r-- | storemodel.h | 29 | ||||
-rw-r--r-- | trayicon.cpp | 81 | ||||
-rw-r--r-- | trayicon.h | 48 | ||||
-rw-r--r-- | usersdialog.cpp | 151 | ||||
-rw-r--r-- | usersdialog.h | 58 | ||||
-rw-r--r-- | util.cpp | 130 | ||||
-rw-r--r-- | util.h | 30 |
29 files changed, 2803 insertions, 3013 deletions
diff --git a/.linthub.yml b/.linthub.yml new file mode 100644 index 00000000..900fabca --- /dev/null +++ b/.linthub.yml @@ -0,0 +1,13 @@ +platform: linux | osx +build: +- qmake +- make +analyzers: + - cpplint: true + include: ["*.cpp", "*.h", "*.hpp", "*.c"] + path: ./ + filters: + - -whitespace + - +whitespace/braces + style: google + - markdownlint: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 150ba07a..76ccd97b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,11 +10,13 @@ This document is stil in a very early stage and needs a lot more work. ## Translations -* Add you language to the `qtpass.pro` file under TRANSLATIONS and in the `resources.qrc` file. +* Add you language to the `qtpass.pro` file + under TRANSLATIONS and in the `resources.qrc` file. * Next run the command `lupdate qtpass.pro` which will create the localization files. -* Edit your file with (let's imagine your language is sv_SE (Swedish) `linguist localization/localization_sv_SE.ts` +* Edit your file with (let's imagine your language is sv_SE (Swedish) + `linguist localization/localization_sv_SE.ts` -Qt Linguist has very nice in-context translation options https://doc-snapshots.qt.io/qt5-5.6/linguist-translators.html +Qt Linguist has very nice in-context translation options [for translators](https://doc-snapshots.qt.io/qt5-5.6/linguist-translators.html) ## IRC @@ -1,14 +1,18 @@ -#FAQ +# FAQ ## Issues ### Can't save a password -* Is folder initialised? Easiest way is to use the [Users] button and make sure you can encrypt for someone (eg. yourself) + +* Is folder initialised? Easiest way is to use the [Users] button + and make sure you can encrypt for someone (eg. yourself) * Are you using git? If not, make sure it is switched off. ### I have an issue with GNOME keyring + * Disable GNOME keyring * Create a `~/.gnupg/gpg-agent.conf` containing: + ``` enable-ssh-support write-env-file @@ -17,7 +21,8 @@ default-cache-ttl 600 max-cache-ttl 7200 ``` -Also, the following is useful to add to your .bashrc if you are using Yubikey NEO on Ubuntu: +Also, the following is useful to add to +your .bashrc if you are using Yubikey NEO on Ubuntu: ``` # OpenPGP applet support for YubiKey NEO @@ -31,28 +36,38 @@ fi * More info: [issue 60](https://github.com/IJHack/qtpass/issues/60) and [issue 73](https://github.com/IJHack/qtpass/issues/73) ### I don't get a passphrase / PIN dialog -* You'll need to install pinentry-qt (or -qt4 or -qt5 or even -gtk) and possibly set the full path to that executable in your `~/.gnupg/gpg-agent.conf` for example: `pinentry-program /usr/bin/pinentry-qt4` -* On some esotheric systems it might be necessary to create a symbolic link `/usr/bin/pinentry` to your pinentry application of choice eg: `ln -s /usr/bin/pinentry-qt5 /usr/bin/pinentry` + +* You'll need to install pinentry-qt (or -qt4 or -qt5 or even -gtk) and + possibly set the full path to that executable in your `~/.gnupg/gpg-agent.conf` + for example: `pinentry-program /usr/bin/pinentry-qt4` +* On some esotheric systems it might be necessary to create a symbolic + link `/usr/bin/pinentry` to your pinentry application of choice + eg: `ln -s /usr/bin/pinentry-qt5 /usr/bin/pinentry` ### Where can I ask for help? + * Create an [issue](https://github.com/IJHack/qtpass/) issues on github. * Send an email to [help@qtpass.org](help@qtpass.org) ### Can I import from KeePass, LastPass or X? -* Yes, check [passwordstore.org/#migration](http://www.passwordstore.org/#migration) for more info. + +* Yes, check [passwordstore.org/#migration](http://www.passwordstore.org/#migration) + for more info. ### I don't like the design, what gives? + * It's all on github, clone, change and send a pull request. * Open an issue and point out defects or better yet propose changes. ## How can I help improve QtPass? -###I would like to donate! +### I would like to donate! * Time: * Read [contributing](CONTRIBUTING.md) documentation. * Fork, clone hack and send a pull request. * Find an [issue](https://github.com/IJHack/qtpass/issues) to work on.. - * Participate in our bug bounty, you submit an issue and help us fix it, I send you a bounty. + * Participate in our bug bounty, you submit an issue and help us + fix it, I send you a bounty. * Money: -IJhack takes donations in [bitcoin](https://blockchain.info/address/146dqz8zXn9iNZMv5s7JVqwZKjrmumHBfb) + * IJhack takes donations in [bitcoin](https://blockchain.info/address/146dqz8zXn9iNZMv5s7JVqwZKjrmumHBfb) @@ -1,29 +1,37 @@ -QtPass [![Build Status](https://travis-ci.org/IJHack/qtpass.svg?branch=master)](https://travis-ci.org/IJHack/qtpass) [![Build status](https://ci.appveyor.com/api/projects/status/9rjnj72rdir7u9eg/branch/master?svg=true)](https://ci.appveyor.com/project/annejan/qtpass/branch/master) +QtPass ====== -QtPass is a GUI for [pass](http://www.passwordstore.org/), the standard unix password manager. +[![Build Status](https://travis-ci.org/IJHack/qtpass.svg?branch=master)](https://travis-ci.org/IJHack/qtpass) +[![Build status](https://ci.appveyor.com/api/projects/status/9rjnj72rdir7u9eg/branch/master?svg=true)](https://ci.appveyor.com/project/annejan/qtpass/branch/master) +[![Coverity scan](https://scan.coverity.com/projects/5266/badge.svg)](https://scan.coverity.com/projects/ijhack-qtpass) + +QtPass is a GUI for [pass](http://www.passwordstore.org/), +the standard unix password manager. Features -------- + * Using pass or git and gpg2 directly * Configurable shoulder surfing protection options * Cross platform: Linux, BSD, OS X and Windows * Per-folder user selection for multi recipient encryption * Multiple profiles -Logo based on https://commons.wikimedia.org/wiki/File:Heart-padlock.svg by AnonMoos. +Logo based on [Heart-padlock by AnonMoos](https://commons.wikimedia.org/wiki/File:Heart-padlock.svg). Installation ------------ + On most systems all you need is: `qmake && make && make install` On Mac OS X: `qmake && make && macdeployqt QtPass.app` -* Currently seems to only work with MacGPG2 +Currently seems to only work with MacGPG2 Security considerations ----------------------- + Using this program will not magically keep your passwords secure against compromised computers even if you use it in combination with a smartcard. @@ -39,6 +47,7 @@ it installed (or at least one that knows how to use a smartcard). To get better protection out of use with a smartcard even against a targeted attack I can think of at least two options: + * The smartcard must require explicit confirmation for each decryption operation. Or if it just provides a counter for decrypted data you could at least notice an attack afterwards, though at quite some effort on your part. @@ -51,22 +60,28 @@ attack I can think of at least two options: Known issues ------------ -* Filtering (searching) breaks the tree/model sometimes -* Starting without a correctly set password-store folder give weird results in the tree view + +* Filtering (searching) breaks the tree/model sometimes +* Starting without a correctly set password-store folder + gives weird results in the tree view * On Mac OS X only the gpgtools MacGPG2 version works with passphrase or PIN Planned features ---------------- + * Re-encryption after users-change (optional of course) * Plugins based on field name, plugins follow same format as password files * Colour coding folders (possibly disabling folders you can't decrypt) * WebDAV (configuration) support * Optional table view of decrypted folder contents -* Opening of (basic auth) urls in default browser? Possibly with helper plugin for filling out forms? -* Some other form of remote storage that allows for accountability / auditing (web API to retrieve the .gpg files?) +* Opening of (basic auth) urls in default browser? + Possibly with helper plugin for filling out forms? +* Some other form of remote storage that allows for + accountability / auditing (web API to retrieve the .gpg files?) Further reading --------------- + [FAQ](FAQ.md) and [CONTRIBUTING](CONTRIBUTING.md) documentation. [Documentation](https://qtpass.org/) diff --git a/configdialog.cpp b/configdialog.cpp index 69044908..4d6b3d4c 100644 --- a/configdialog.cpp +++ b/configdialog.cpp @@ -13,153 +13,128 @@ * @brief ConfigDialog::ConfigDialog * @param parent */ -ConfigDialog::ConfigDialog(MainWindow *parent) : - QDialog(parent), - ui(new Ui::ConfigDialog) -{ - mainWindow = parent; - ui->setupUi(this); - ui->profileTable->verticalHeader()->hide(); - ui->profileTable->horizontalHeader()->setStretchLastSection(true); - ui->label->setText(ui->label->text() + VERSION); - ui->comboBoxClipboard->clear(); +ConfigDialog::ConfigDialog(MainWindow *parent) + : QDialog(parent), ui(new Ui::ConfigDialog) { + mainWindow = parent; + ui->setupUi(this); + ui->profileTable->verticalHeader()->hide(); + ui->profileTable->horizontalHeader()->setStretchLastSection(true); + 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(0); + 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(0); } /** * @brief ConfigDialog::~ConfigDialog */ -ConfigDialog::~ConfigDialog() -{ - mainWindow->setGitExecutable(ui->gitPath->text()); - mainWindow->setGpgExecutable(ui->gpgPath->text()); - mainWindow->setPassExecutable(ui->passPath->text()); +ConfigDialog::~ConfigDialog() { + mainWindow->setGitExecutable(ui->gitPath->text()); + mainWindow->setGpgExecutable(ui->gpgPath->text()); + mainWindow->setPassExecutable(ui->passPath->text()); } /** * @brief ConfigDialog::setPassPath * @param path */ -void ConfigDialog::setPassPath(QString path) { - ui->passPath->setText(path); -} +void ConfigDialog::setPassPath(QString path) { ui->passPath->setText(path); } /** * @brief ConfigDialog::setGitPath * @param path */ void ConfigDialog::setGitPath(QString path) { - ui->gitPath->setText(path); - if (path.isEmpty()) { - useGit(false); - ui->checkBoxUseGit->setEnabled(false); - } else { - ui->checkBoxUseGit->setEnabled(true); - } + ui->gitPath->setText(path); + if (path.isEmpty()) { + useGit(false); + ui->checkBoxUseGit->setEnabled(false); + } else { + ui->checkBoxUseGit->setEnabled(true); + } } /** * @brief ConfigDialog::setGpgPath * @param path */ -void ConfigDialog::setGpgPath(QString path) { - ui->gpgPath->setText(path); -} +void ConfigDialog::setGpgPath(QString path) { ui->gpgPath->setText(path); } /** * @brief ConfigDialog::setStorePath * @param path */ -void ConfigDialog::setStorePath(QString path) { - ui->storePath->setText(path); -} +void ConfigDialog::setStorePath(QString path) { ui->storePath->setText(path); } /** * @brief ConfigDialog::getPassPath * @return */ -QString ConfigDialog::getPassPath() { - return ui->passPath->text(); -} +QString ConfigDialog::getPassPath() { return ui->passPath->text(); } /** * @brief ConfigDialog::getGitPath * @return */ -QString ConfigDialog::getGitPath() { - return ui->gitPath->text(); -} +QString ConfigDialog::getGitPath() { return ui->gitPath->text(); } /** * @brief ConfigDialog::getGpgPath * @return */ -QString ConfigDialog::getGpgPath() { - return ui->gpgPath->text(); -} +QString ConfigDialog::getGpgPath() { return ui->gpgPath->text(); } /** * @brief ConfigDialog::getStorePath * @return */ -QString ConfigDialog::getStorePath() { - return ui->storePath->text(); -} +QString ConfigDialog::getStorePath() { return ui->storePath->text(); } /** * @brief ConfigDialog::usePass * @return */ -bool ConfigDialog::usePass() { - return ui->radioButtonPass->isChecked(); -} +bool ConfigDialog::usePass() { return ui->radioButtonPass->isChecked(); } /** * @brief ConfigDialog::usePass * @param pass */ void ConfigDialog::usePass(bool usePass) { - if (usePass) { - ui->radioButtonNative->setChecked(false); - ui->radioButtonPass->setChecked(true); - } else { - ui->radioButtonNative->setChecked(true); - ui->radioButtonPass->setChecked(false); - } - setGroupBoxState(); + if (usePass) { + ui->radioButtonNative->setChecked(false); + ui->radioButtonPass->setChecked(true); + } else { + ui->radioButtonNative->setChecked(true); + ui->radioButtonPass->setChecked(false); + } + setGroupBoxState(); } /** * @brief ConfigDialog::on_radioButtonNative_clicked */ -void ConfigDialog::on_radioButtonNative_clicked() -{ - setGroupBoxState(); -} +void ConfigDialog::on_radioButtonNative_clicked() { setGroupBoxState(); } /** * @brief ConfigDialog::on_radioButtonPass_clicked */ -void ConfigDialog::on_radioButtonPass_clicked() -{ - setGroupBoxState(); -} +void ConfigDialog::on_radioButtonPass_clicked() { setGroupBoxState(); } /** * @brief ConfigDialog::setGroupBoxState */ void ConfigDialog::setGroupBoxState() { - if (ui->radioButtonPass->isChecked()) { - ui->groupBoxNative->setEnabled(false); - ui->groupBoxPass->setEnabled(true); - } else { - ui->groupBoxNative->setEnabled(true); - ui->groupBoxPass->setEnabled(false); - } + if (ui->radioButtonPass->isChecked()) { + ui->groupBoxNative->setEnabled(false); + ui->groupBoxPass->setEnabled(true); + } else { + ui->groupBoxNative->setEnabled(true); + ui->groupBoxPass->setEnabled(false); + } } /** @@ -167,13 +142,13 @@ void ConfigDialog::setGroupBoxState() { * @return */ QString ConfigDialog::selectExecutable() { - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::ExistingFile); - dialog.setOption(QFileDialog::ReadOnly); - if (dialog.exec()) { - return dialog.selectedFiles().first(); - } - else return ""; + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::ExistingFile); + dialog.setOption(QFileDialog::ReadOnly); + if (dialog.exec()) + return dialog.selectedFiles().first(); + else + return ""; } /** @@ -181,264 +156,234 @@ QString ConfigDialog::selectExecutable() { * @return */ QString ConfigDialog::selectFolder() { - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::Directory); - dialog.setFilter(QDir::NoFilter); - dialog.setOption(QFileDialog::ShowDirsOnly); - if (dialog.exec()) { - return dialog.selectedFiles().first(); - } - else return ""; + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::Directory); + dialog.setFilter(QDir::NoFilter); + dialog.setOption(QFileDialog::ShowDirsOnly); + if (dialog.exec()) + return dialog.selectedFiles().first(); + else + return ""; } /** * @brief ConfigDialog::on_toolButtonGit_clicked */ -void ConfigDialog::on_toolButtonGit_clicked() -{ - QString git = selectExecutable(); - if (!git.isEmpty()) { - ui->gitPath->setText(git); - ui->checkBoxUseGit->setEnabled(true); - } else { - useGit(false); - ui->checkBoxUseGit->setEnabled(false); - } +void ConfigDialog::on_toolButtonGit_clicked() { + QString git = selectExecutable(); + if (!git.isEmpty()) { + ui->gitPath->setText(git); + ui->checkBoxUseGit->setEnabled(true); + } else { + useGit(false); + ui->checkBoxUseGit->setEnabled(false); + } } /** * @brief ConfigDialog::on_toolButtonGpg_clicked */ -void ConfigDialog::on_toolButtonGpg_clicked() -{ - QString gpg = selectExecutable(); - if (!gpg.isEmpty()) { - ui->gpgPath->setText(gpg); - } +void ConfigDialog::on_toolButtonGpg_clicked() { + QString gpg = selectExecutable(); + if (!gpg.isEmpty()) + ui->gpgPath->setText(gpg); } /** * @brief ConfigDialog::on_toolButtonPass_clicked */ -void ConfigDialog::on_toolButtonPass_clicked() -{ - QString pass = selectExecutable(); - if (!pass.isEmpty()) { - ui->passPath->setText(pass); - } +void ConfigDialog::on_toolButtonPass_clicked() { + QString pass = selectExecutable(); + if (!pass.isEmpty()) + ui->passPath->setText(pass); } /** * @brief ConfigDialog::on_toolButtonStore_clicked */ -void ConfigDialog::on_toolButtonStore_clicked() -{ - QString store = selectFolder(); - if (!store.isEmpty()) { // TODO call check - ui->storePath->setText(store); - } +void ConfigDialog::on_toolButtonStore_clicked() { + QString store = selectFolder(); + if (!store.isEmpty()) // TODO(annejan) call check + ui->storePath->setText(store); } /** * @brief ConfigDialog::on_comboBoxClipboard_activated */ -void ConfigDialog::on_comboBoxClipboard_activated() -{ - if (ui->comboBoxClipboard->currentIndex() > 0) { - ui->checkBoxAutoclear->setEnabled(true); - ui->checkBoxHidePassword->setEnabled(true); - ui->checkBoxHideContent->setEnabled(true); - if (ui->checkBoxAutoclear->isChecked()) { - ui->spinBoxAutoclearSeconds->setEnabled(true); - ui->labelSeconds->setEnabled(true); - } else { - ui->spinBoxAutoclearSeconds->setEnabled(false); - ui->labelSeconds->setEnabled(false); - } +void ConfigDialog::on_comboBoxClipboard_activated() { + if (ui->comboBoxClipboard->currentIndex() > 0) { + ui->checkBoxAutoclear->setEnabled(true); + ui->checkBoxHidePassword->setEnabled(true); + ui->checkBoxHideContent->setEnabled(true); + if (ui->checkBoxAutoclear->isChecked()) { + ui->spinBoxAutoclearSeconds->setEnabled(true); + ui->labelSeconds->setEnabled(true); } else { - ui->checkBoxAutoclear->setEnabled(false); - ui->spinBoxAutoclearSeconds->setEnabled(false); - ui->labelSeconds->setEnabled(false); - ui->checkBoxHidePassword->setEnabled(false); - ui->checkBoxHideContent->setEnabled(false); + ui->spinBoxAutoclearSeconds->setEnabled(false); + ui->labelSeconds->setEnabled(false); } + } else { + ui->checkBoxAutoclear->setEnabled(false); + ui->spinBoxAutoclearSeconds->setEnabled(false); + ui->labelSeconds->setEnabled(false); + ui->checkBoxHidePassword->setEnabled(false); + ui->checkBoxHideContent->setEnabled(false); + } } /** * @brief ConfigDialog::on_checkBoxAutoclearPanel_clicked */ -void ConfigDialog::on_checkBoxAutoclearPanel_clicked() -{ - if (ui->checkBoxAutoclearPanel->isChecked()) { - ui->spinBoxAutoclearPanelSeconds->setEnabled(true); - ui->labelPanelSeconds->setEnabled(true); - } else { - ui->spinBoxAutoclearPanelSeconds->setEnabled(false); - ui->labelPanelSeconds->setEnabled(false); - } +void ConfigDialog::on_checkBoxAutoclearPanel_clicked() { + if (ui->checkBoxAutoclearPanel->isChecked()) { + ui->spinBoxAutoclearPanelSeconds->setEnabled(true); + ui->labelPanelSeconds->setEnabled(true); + } else { + ui->spinBoxAutoclearPanelSeconds->setEnabled(false); + ui->labelPanelSeconds->setEnabled(false); + } } /** * @brief ConfigDialog::useClipboard */ -void ConfigDialog::useClipboard(MainWindow::clipBoardType useClipboard) -{ - ui->comboBoxClipboard->setCurrentIndex(static_cast<int>(useClipboard)); - on_comboBoxClipboard_activated(); +void ConfigDialog::useClipboard(MainWindow::clipBoardType useClipboard) { + ui->comboBoxClipboard->setCurrentIndex(static_cast<int>(useClipboard)); + on_comboBoxClipboard_activated(); } /** * @brief ConfigDialog::useAutoclear * @param useAutoclear */ -void ConfigDialog::useAutoclear(bool useAutoclear) -{ - ui->checkBoxAutoclear->setChecked(useAutoclear); - on_checkBoxAutoclear_clicked(); +void ConfigDialog::useAutoclear(bool useAutoclear) { + ui->checkBoxAutoclear->setChecked(useAutoclear); + on_checkBoxAutoclear_clicked(); } /** * @brief ConfigDialog::setAutoclear * @param seconds */ -void ConfigDialog::setAutoclear(int seconds) -{ - ui->spinBoxAutoclearSeconds->setValue(seconds); +void ConfigDialog::setAutoclear(int seconds) { + ui->spinBoxAutoclearSeconds->setValue(seconds); } /** * @brief ConfigDialog::useAutoclearPanel * @param useAutoclearPanel */ -void ConfigDialog::useAutoclearPanel(bool useAutoclearPanel) -{ - ui->checkBoxAutoclearPanel->setChecked(useAutoclearPanel); - on_checkBoxAutoclearPanel_clicked(); +void ConfigDialog::useAutoclearPanel(bool useAutoclearPanel) { + ui->checkBoxAutoclearPanel->setChecked(useAutoclearPanel); + on_checkBoxAutoclearPanel_clicked(); } /** * @brief ConfigDialog::setAutoclearPanel * @param seconds */ -void ConfigDialog::setAutoclearPanel(int seconds) -{ - ui->spinBoxAutoclearPanelSeconds->setValue(seconds); +void ConfigDialog::setAutoclearPanel(int seconds) { + ui->spinBoxAutoclearPanelSeconds->setValue(seconds); } /** * @brief ConfigDialog::useClipboard * @return */ -MainWindow::clipBoardType ConfigDialog::useClipboard() -{ - return static_cast<MainWindow::clipBoardType>(ui->comboBoxClipboard->currentIndex()); +MainWindow::clipBoardType ConfigDialog::useClipboard() { + return static_cast<MainWindow::clipBoardType>( + ui->comboBoxClipboard->currentIndex()); } /** * @brief ConfigDialog::useAutoclear * @return */ -bool ConfigDialog::useAutoclear() -{ - return ui->checkBoxAutoclear->isChecked(); -} +bool ConfigDialog::useAutoclear() { return ui->checkBoxAutoclear->isChecked(); } /** * @brief ConfigDialog::getAutoclear * @return */ -int ConfigDialog::getAutoclear() -{ - return ui->spinBoxAutoclearSeconds->value(); +int ConfigDialog::getAutoclear() { + return ui->spinBoxAutoclearSeconds->value(); } /** * @brief ConfigDialog::on_checkBoxAutoclear_clicked */ -void ConfigDialog::on_checkBoxAutoclear_clicked() -{ - on_comboBoxClipboard_activated(); +void ConfigDialog::on_checkBoxAutoclear_clicked() { + on_comboBoxClipboard_activated(); } /** * @brief ConfigDialog::useAutoclearPanel * @return */ -bool ConfigDialog::useAutoclearPanel() -{ - return ui->checkBoxAutoclearPanel->isChecked(); +bool ConfigDialog::useAutoclearPanel() { + return ui->checkBoxAutoclearPanel->isChecked(); } /** * @brief ConfigDialog::getAutoclearPanel * @return */ -int ConfigDialog::getAutoclearPanel() -{ - return ui->spinBoxAutoclearPanelSeconds->value(); +int ConfigDialog::getAutoclearPanel() { + return ui->spinBoxAutoclearPanelSeconds->value(); } /** * @brief ConfigDialog::hidePassword * @return */ -bool ConfigDialog::hidePassword() -{ - return ui->checkBoxHidePassword->isChecked(); +bool ConfigDialog::hidePassword() { + return ui->checkBoxHidePassword->isChecked(); } /** * @brief ConfigDialog::hideContent * @return */ -bool ConfigDialog::hideContent() -{ - return ui->checkBoxHideContent->isChecked(); +bool ConfigDialog::hideContent() { + return ui->checkBoxHideContent->isChecked(); } /** * @brief ConfigDialog::hidePassword * @param hidePassword */ -void ConfigDialog::hidePassword(bool hidePassword) -{ - ui->checkBoxHidePassword->setChecked(hidePassword); +void ConfigDialog::hidePassword(bool hidePassword) { + ui->checkBoxHidePassword->setChecked(hidePassword); } /** * @brief ConfigDialog::hideContent * @param hideContent */ -void ConfigDialog::hideContent(bool hideContent) -{ - ui->checkBoxHideContent->setChecked(hideContent); +void ConfigDialog::hideContent(bool hideContent) { + ui->checkBoxHideContent->setChecked(hideContent); } /** * @brief ConfigDialog::addGPGId * @return */ -bool ConfigDialog::addGPGId() -{ - return ui->checkBoxAddGPGId->isChecked(); -} +bool ConfigDialog::addGPGId() { return ui->checkBoxAddGPGId->isChecked(); } /** * @brief ConfigDialog::addGPGId * @param addGPGId */ -void ConfigDialog::addGPGId(bool addGPGId) -{ - ui->checkBoxAddGPGId->setChecked(addGPGId); +void ConfigDialog::addGPGId(bool addGPGId) { + ui->checkBoxAddGPGId->setChecked(addGPGId); } /** * @brief ConfigDialog::genKey * @param QString batch */ -void ConfigDialog::genKey(QString batch, QDialog *dialog) -{ - mainWindow->generateKeyPair(batch, dialog); +void ConfigDialog::genKey(QString batch, QDialog *dialog) { + mainWindow->generateKeyPair(batch, dialog); } /** @@ -446,162 +391,160 @@ void ConfigDialog::genKey(QString batch, QDialog *dialog) * @param profiles * @param profile */ -void ConfigDialog::setProfiles(QHash<QString, QString> profiles, QString profile) -{ - //qDebug() << profiles; - if (profiles.contains("")) { - profiles.remove(""); - // remove weird "" key value pairs - } - - ui->profileTable->setRowCount(profiles.count()); - QHashIterator<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())); - //qDebug() << "naam:" + i.key(); - if (i.key() == profile) { - ui->profileTable->selectRow(n); - } - } - n++; +void ConfigDialog::setProfiles(QHash<QString, QString> profiles, + QString profile) { + // qDebug() << profiles; + if (profiles.contains("")) { + profiles.remove(""); + // remove weird "" key value pairs + } + + ui->profileTable->setRowCount(profiles.count()); + QHashIterator<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())); + // qDebug() << "naam:" + i.key(); + if (i.key() == profile) + ui->profileTable->selectRow(n); } + ++n; + } } /** * @brief ConfigDialog::getProfiles * @return */ -QHash<QString, QString> ConfigDialog::getProfiles() -{ - QHash<QString, QString> profiles; - // Check? - for (int i = 0; i < ui->profileTable->rowCount(); i++) { - QTableWidgetItem* pathItem = ui->profileTable->item(i, 1); - if (0 != pathItem) { - QTableWidgetItem* item = ui->profileTable->item(i, 0); - if (item == 0) { - qDebug() << "empty name, shoud fix in frontend"; - continue; - } - profiles.insert(item->text(), - pathItem->text()); - } +QHash<QString, QString> ConfigDialog::getProfiles() { |