diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-31 20:19:59 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-31 20:19:59 +0200 |
commit | 04c1ced9bd76a05435ba3f6e5bae4bec46729924 (patch) | |
tree | 2f95ca405cad734de0ed8a893330e88f38a12e5e | |
parent | c38fc6ee62feb3ac3b3c2e9ac7328343249cd513 (diff) | |
parent | dc0640ba7a780ead1e4cb66599299b5430ed8801 (diff) |
merged
-rw-r--r-- | dialog.cpp | 16 | ||||
-rw-r--r-- | dialog.h | 3 | ||||
-rw-r--r-- | mainwindow.cpp | 1 |
3 files changed, 16 insertions, 4 deletions
@@ -215,7 +215,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); } } @@ -477,6 +477,11 @@ void Dialog::on_deleteButton_clicked() } } +void Dialog::criticalMessage(const QString &title, const QString &text) +{ + QMessageBox::critical(this, title, text, QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); +} + /** * @brief Dialog::wizard */ @@ -487,7 +492,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 ? @@ -502,14 +507,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); } @@ -65,6 +65,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 a88be65f..00454f20 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> |