diff options
author | Saturn&Eric <[email protected]> | 2021-12-05 19:32:25 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-12-05 19:32:25 +0000 |
commit | e3ecf7cb0e5fc3058760ac28d58ad9766e9037b6 (patch) | |
tree | 4108a6205fb517a694d65b3044f7369f32b43862 /src/ui/main_window/MainWindowFileSlotFunction.cpp | |
parent | Merge branch 'main' into develop (diff) | |
parent | Improve UI (diff) | |
download | GpgFrontend-e3ecf7cb0e5fc3058760ac28d58ad9766e9037b6.tar.gz GpgFrontend-e3ecf7cb0e5fc3058760ac28d58ad9766e9037b6.zip |
Merge pull request #27 from saturneric/develop-ui
Improve UI
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(); |