diff options
author | Saturneric <[email protected]> | 2021-12-06 05:58:52 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-06 06:13:25 +0000 |
commit | b86aa03e5f6061f73389ef17cddf694e8a88f035 (patch) | |
tree | 81516b808e3e262819c6ada934c1c60b752ffc14 /src/ui/main_window/MainWindowFileSlotFunction.cpp | |
parent | Improve CI (diff) | |
parent | Merge pull request #27 from saturneric/develop-ui (diff) | |
download | GpgFrontend-b86aa03e5f6061f73389ef17cddf694e8a88f035.tar.gz GpgFrontend-b86aa03e5f6061f73389ef17cddf694e8a88f035.zip |
Merge branch 'develop' of github.com:saturneric/GpgFrontend into develop-ci
Diffstat (limited to 'src/ui/main_window/MainWindowFileSlotFunction.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 25445dcc..c258e8b0 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -164,15 +164,6 @@ void MainWindow::slotFileSign() { if (!file_pre_check(this, path)) return; - if (QFile::exists(path + ".sig")) { - auto ret = QMessageBox::warning( - this, _("Warning"), - _("The target file already exists, do you need to overwrite it?"), - QMessageBox::Ok | QMessageBox::Cancel); - - if (ret == QMessageBox::Cancel) return; - } - auto key_ids = mKeyList->getChecked(); auto keys = GpgKeyGetter::GetInstance().GetKeys(key_ids); @@ -193,6 +184,18 @@ void MainWindow::slotFileSign() { } } + auto sig_file_path = boost::filesystem::path(path.toStdString() + ".sig"); + if (QFile::exists(sig_file_path.string().c_str())) { + auto ret = QMessageBox::warning( + this, _("Warning"), + QString(_("The signature file \"%1\" exists, " + "do you need to overwrite it?")) + .arg(sig_file_path.filename().string().c_str()), + QMessageBox::Ok | QMessageBox::Cancel); + + if (ret == QMessageBox::Cancel) return; + } + GpgSignResult result = nullptr; gpgme_error_t error; bool if_error = false; @@ -242,12 +245,22 @@ void MainWindow::slotFileVerify() { signFilePath = path + ".sig"; } + bool ok; + QString text = + QInputDialog::getText(this, _("Origin file to verify"), _("Filepath"), + QLineEdit::Normal, dataFilePath, &ok); + if (ok && !text.isEmpty()) { + dataFilePath = text; + } else { + return; + } + QFileInfo dataFileInfo(dataFilePath), signFileInfo(signFilePath); if (!dataFileInfo.isFile() || !signFileInfo.isFile()) { QMessageBox::critical( this, _("Error"), - _("Please select the appropriate target file or signature file. " + _("Please select the appropriate origin file or signature file. " "Ensure that both are in this directory.")); return; } @@ -433,8 +446,6 @@ void MainWindow::slotFileDecryptVerify() { }); if (!if_error) { - infoBoard->associateFileTreeView(edit->curFilePage()); - auto decrypt_res = DecryptResultAnalyse(error, std::move(d_result)); auto verify_res = VerifyResultAnalyse(error, std::move(v_result)); decrypt_res.analyse(); |