summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-05-31 19:01:28 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2015-05-31 19:01:28 +0200
commitdc0640ba7a780ead1e4cb66599299b5430ed8801 (patch)
tree8cbed23f18db264f25ed1bbb09b94a5610d30559
parent09460d379eab60890fa0fa9607694b8781c394cc (diff)
parente50c77e6b318802d8f5bfa0a72bc665ad7f9273c (diff)
Merge pull request #49 from rdoeffinger/bugfixes
Bugfixes
-rw-r--r--dialog.cpp17
-rw-r--r--dialog.h3
-rw-r--r--mainwindow.cpp1
3 files changed, 17 insertions, 4 deletions
diff --git a/dialog.cpp b/dialog.cpp
index 8437244d..8411c605 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -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);
}
diff --git a/dialog.h b/dialog.h
index adb2fa82..72836421 100644
--- a/dialog.h
+++ b/dialog.h
@@ -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>