diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2016-05-30 16:57:39 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2016-05-30 16:57:39 +0200 |
commit | 2e0a15113fd8bd4b98c9c9f82bc9b95c28b3565e (patch) | |
tree | 820f838b42bf6e44c34bbc34c81782423776daf5 /mainwindow.cpp | |
parent | 613b044ddd7cbd0456cdd55fb3ee65b1b72471c5 (diff) |
Deletion of empty folder broken when using git via @tobiasvandriessel fixes #181
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r-- | mainwindow.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index ee2dfc8b..18de5fef 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1177,7 +1177,6 @@ void MainWindow::on_addButton_clicked() { setPassword(file, false, true); } - /** * @brief MainWindow::on_deleteButton_clicked */ @@ -1219,26 +1218,41 @@ void MainWindow::on_deleteButton_clicked() { if (QMessageBox::question( this, tr("Delete folder?"), tr("Are you sure you want to delete %1?") - .arg(QDir::separator() + - getDir(ui->treeView->currentIndex(), true)), + .arg(QDir::separator() + + getDir(ui->treeView->currentIndex(), true)), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { return; } else { - if (useGit) { - executeWrapper(gitExecutable, "rm -rf \"" + file + '"'); - executeWrapper(gitExecutable, - "commit \"" + file + "\" -m \"Remove for " + - getFile(ui->treeView->currentIndex(), true) + - " using QtPass.\""); - if (autoPush) + if (usePass) { + currentAction = DELETE; + executePass("rm -rf \"" + file + '"'); + if (useGit && autoPush) { on_pushButton_clicked(); + } } else { + if (useGit) { + executeWrapper(gitExecutable, "rm -rf \"" + file + '"'); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - QDir dir(file); - dir.removeRecursively(); + QDir dir(file); + dir.removeRecursively(); #else - removeDir(passStore + file); + removeDir(passStore + file); #endif + executeWrapper(gitExecutable, + "commit \"" + file + "\" -m \"Remove for " + + getFile(ui->treeView->currentIndex(), true) + + " using QtPass.\""); + if (autoPush) { + on_pushButton_clicked(); + } + } else { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QDir dir(file); + dir.removeRecursively(); +#else + removeDir(passStore + file); +#endif + } } } } |