From e2d5ba5b6f61b5a9e195dcc87b9ebe468f6c1f1c Mon Sep 17 00:00:00 2001 From: Anne Jan Brouwer Date: Thu, 11 Jun 2015 23:29:23 +0200 Subject: Streamlined wizard --- dialog.cpp | 25 ++++++++++++++++--------- mainwindow.cpp | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dialog.cpp b/dialog.cpp index acaf88ca..475a46e9 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -463,14 +463,14 @@ void Dialog::criticalMessage(const QString &title, const QString &text) void Dialog::wizard() { //mainWindow->checkConfig(); + bool clean = false; QString gpg = ui->gpgPath->text(); //QString gpg = mainWindow->getGpgExecutable(); if(!QFile(gpg).exists()){ criticalMessage(tr("GnuPG not found"), tr("Please install GnuPG on your system.
Install gpg using your favorite package manager
or download it from GnuPG.org")); - - // TODO REST ? + clean = true; } QStringList names = mainWindow->getSecretKeys(); @@ -483,9 +483,21 @@ void Dialog::wizard() } QString passStore = ui->storePath->text(); + + if (clean && !QFile(passStore).exists()) { + // TODO pass version? + if (QMessageBox::question(this, tr("Create password-store?"), + tr("Would you like to create a password-store at %1?").arg(passStore), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + QDir().mkdir(passStore); + } + } + if(!QFile(passStore + ".gpg-id").exists()){ - 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)); + if (!clean) { + 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 @@ -499,11 +511,6 @@ void Dialog::wizard() mainWindow->userDialog(passStore); } } - - // Can you use the store? - - - //ui->gpgPath->setText(gpg); } /** diff --git a/mainwindow.cpp b/mainwindow.cpp index efaa2d11..a2b3e32a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -852,7 +852,7 @@ void MainWindow::on_deleteButton_clicked() if (QMessageBox::question(this, tr("Delete password?"), tr("Are you sure you want to delete %1?").arg(QDir::separator() + getFile(ui->treeView->currentIndex(), true)), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { - return; + return; } if (usePass) { currentAction = DELETE; -- cgit v1.2.3