diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-10 16:29:17 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-07-10 16:29:17 +0200 |
commit | 22d00339a9f28589849e08e68492a2693150955e (patch) | |
tree | c7012c9abb1acd5a96cbb4d83aff853cc893964b /mainwindow.cpp | |
parent | 9b14e351090a2bf29565f8477585649b47cd9f97 (diff) |
interface tweaks and base of pwgen stuff
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r-- | mainwindow.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 78f4779d..3d769b73 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -186,6 +186,12 @@ bool MainWindow::checkConfig() { if (gpgExecutable.isEmpty()) { gpgExecutable = Util::findBinaryInPath("gpg2"); } + + pwgenExecutable = settings.value("pwgenExecutable").toString(); + if (pwgenExecutable.isEmpty()) { + pwgenExecutable = Util::findBinaryInPath("pwgen"); + } + gpgHome = settings.value("gpgHome").toString(); useWebDav = (settings.value("useWebDav") == "true"); @@ -201,6 +207,8 @@ bool MainWindow::checkConfig() { } settings.endGroup(); + useGit = (settings.value("useGit") == "true"); + if (Util::checkConfig(passStore, passExecutable, gpgExecutable)) { config(); if (firstRun && Util::checkConfig(passStore, passExecutable, gpgExecutable)) { @@ -271,10 +279,13 @@ bool MainWindow::checkConfig() { updateEnv(); - if (gitExecutable.isEmpty() && passExecutable.isEmpty()) + if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) { ui->pushButton->hide(); ui->updateButton->hide(); + } else { + ui->pushButton->show(); + ui->updateButton->show(); } ui->lineEdit->setFocus(); @@ -306,6 +317,8 @@ void MainWindow::config() { d->useTrayIcon(useTrayIcon); d->hideOnClose(hideOnClose); d->setProfiles(profiles, profile); + d->useGit(useGit); + d->setPwgenPath(pwgenExecutable); d->wizard(); // does shit if (d->exec()) { @@ -324,6 +337,8 @@ void MainWindow::config() { useTrayIcon = d->useTrayIcon(); hideOnClose = d->hideOnClose(); profiles = d->getProfiles(); + useGit = d->useGit(); + pwgenExecutable = d->getPwgenPath(); QSettings &settings(getSettings()); @@ -340,6 +355,8 @@ void MainWindow::config() { settings.setValue("addGPGId", addGPGId ? "true" : "false"); settings.setValue("useTrayIcon", useTrayIcon ? "true" : "false"); settings.setValue("hideOnClose", hideOnClose ? "true" : "false"); + settings.setValue("useGit", useGit ? "true" : "false"); + settings.setValue("pwgenExecutable", pwgenExecutable); if (!profiles.isEmpty()) { settings.beginGroup("profiles"); @@ -369,14 +386,14 @@ void MainWindow::config() { config(); } updateEnv(); - if (gitExecutable.isEmpty() && passExecutable.isEmpty()) + if (!useGit || (gitExecutable.isEmpty() && passExecutable.isEmpty())) { ui->pushButton->hide(); ui->updateButton->hide(); } else { ui->pushButton->show(); ui->updateButton->show(); - } + } if (useTrayIcon && tray == NULL) { initTrayIcon(); } else if (!useTrayIcon && tray != NULL) { @@ -1098,7 +1115,7 @@ void MainWindow::on_usersButton_clicked() tr("None of the selected keys have a secret key available.\n" "You will not be able to decrypt any newly added passwords!")); } - if (!useWebDav && !gitExecutable.isEmpty()){ + if (!useWebDav && useGit && !gitExecutable.isEmpty()){ if (addFile) { executeWrapper(gitExecutable, "add \"" + gpgIdFile + '"'); } |