diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-06-11 23:29:23 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-06-11 23:29:23 +0200 |
commit | 3b70e5b8abd770a95e26d0ab65dbc08eb14b4ee3 (patch) | |
tree | 91090caa163c094fa40b159e0016d9cf734b1b2e | |
parent | 0fefd700f6de85403167de109f3167ffd0adb904 (diff) |
Streamlined wizard
-rw-r--r-- | dialog.cpp | 25 | ||||
-rw-r--r-- | mainwindow.cpp | 2 |
2 files changed, 17 insertions, 10 deletions
@@ -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.<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 ? + 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; |