summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-05-31 20:19:59 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2015-05-31 20:19:59 +0200
commit04c1ced9bd76a05435ba3f6e5bae4bec46729924 (patch)
tree2f95ca405cad734de0ed8a893330e88f38a12e5e
parentc38fc6ee62feb3ac3b3c2e9ac7328343249cd513 (diff)
parentdc0640ba7a780ead1e4cb66599299b5430ed8801 (diff)
merged
-rw-r--r--dialog.cpp16
-rw-r--r--dialog.h3
-rw-r--r--mainwindow.cpp1
3 files changed, 16 insertions, 4 deletions
diff --git a/dialog.cpp b/dialog.cpp
index 52be32ec..00db4e0e 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -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);
}
diff --git a/dialog.h b/dialog.h
index 5d2c12ed..9499c3ea 100644
--- a/dialog.h
+++ b/dialog.h
@@ -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>