Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #49

Merged
merged 4 commits into from
May 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 ?
Expand All @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ private slots:
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;
};

Expand Down
1 change: 1 addition & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "keygendialog.h"
#include "util.h"
#include <QClipboard>
#include <QDebug>
#include <QInputDialog>
#include <QMessageBox>
#include <QTimer>
Expand Down