aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowFileSlotFunction.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-12-05 18:51:59 +0000
committerSaturneric <[email protected]>2021-12-05 19:00:26 +0000
commit590f222de4abdf2aae4d2d8de6f9af25996a713e (patch)
tree4108a6205fb517a694d65b3044f7369f32b43862 /src/ui/main_window/MainWindowFileSlotFunction.cpp
parentAdd Submodules & Update & Fixed (diff)
downloadGpgFrontend-590f222de4abdf2aae4d2d8de6f9af25996a713e.tar.gz
GpgFrontend-590f222de4abdf2aae4d2d8de6f9af25996a713e.zip
Improve UI
1. Support Key List Tab 2. File Hash Calculate 3. File Rename 4. Fix known bugs 5. Fix known ci issues.
Diffstat (limited to '')
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp35
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();