diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-31 19:01:28 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-31 19:01:28 +0200 |
commit | dc0640ba7a780ead1e4cb66599299b5430ed8801 (patch) | |
tree | 8cbed23f18db264f25ed1bbb09b94a5610d30559 | |
parent | 09460d379eab60890fa0fa9607694b8781c394cc (diff) | |
parent | e50c77e6b318802d8f5bfa0a72bc665ad7f9273c (diff) |
Merge pull request #49 from rdoeffinger/bugfixes
Bugfixes
-rw-r--r-- | dialog.cpp | 17 | ||||
-rw-r--r-- | dialog.h | 3 | ||||
-rw-r--r-- | mainwindow.cpp | 1 |
3 files changed, 17 insertions, 4 deletions
@@ -212,7 +212,7 @@ void Dialog::on_toolButtonPass_clicked() void Dialog::on_toolButtonStore_clicked() { QString store = selectFolder(); - if (store != "") { // TODO call check + if (store.isEmpty()) { // TODO call check ui->storePath->setText(store); } } @@ -358,6 +358,12 @@ void Dialog::addGPGId(bool addGPGId) { ui->checkBoxAddGPGId->setChecked(addGPGId); } + +void Dialog::criticalMessage(const QString &title, const QString &text) +{ + QMessageBox::critical(this, title, text, QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); +} + /** * @brief Dialog::wizard */ @@ -368,7 +374,7 @@ void Dialog::wizard() QString gpg = ui->gpgPath->text(); //QString gpg = mainWindow->getGpgExecutable(); if(!QFile(gpg).exists()){ - QMessageBox::critical(this, tr("GnuPG not found"), + criticalMessage(tr("GnuPG not found"), 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")); // TODO REST ? @@ -383,14 +389,17 @@ void Dialog::wizard() QString passStore = ui->storePath->text(); if(!QFile(passStore + ".gpg-id").exists()){ - QMessageBox::critical(this, tr("Password store not initialised"), + 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(); + // allow user to cancel + if (passStore == ui->storePath->text()) + return; passStore = ui->storePath->text(); } if (!QFile(passStore + ".gpg-id").exists()) { - // apears not to be store + // appears not to be store // init yes / no ? mainWindow->userDialog(passStore); } @@ -59,6 +59,9 @@ private: void setGroupBoxState(); QString selectExecutable(); QString selectFolder(); + // QMessageBox::critical with hack to avoid crashes with + // Qt 5.4.1 when QApplication::exec was not yet called + void criticalMessage(const QString &title, const QString &text); MainWindow *mainWindow; }; diff --git a/mainwindow.cpp b/mainwindow.cpp index 381d4e18..d3d1ebe8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5,6 +5,7 @@ #include "keygendialog.h" #include "util.h" #include <QClipboard> +#include <QDebug> #include <QInputDialog> #include <QMessageBox> #include <QTimer> |