aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowGpgOperaFunction.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-01-26 18:33:11 +0000
committersaturneric <[email protected]>2025-01-26 18:33:11 +0000
commit8e7d3d6ac723917f73dcdb188b0056b1798c0ffb (patch)
tree4e33b07c5b743d9cd4b390a01aab6075a94c5ec8 /src/ui/main_window/MainWindowGpgOperaFunction.cpp
parentfeat: allow file batch operations (diff)
downloadGpgFrontend-8e7d3d6ac723917f73dcdb188b0056b1798c0ffb.tar.gz
GpgFrontend-8e7d3d6ac723917f73dcdb188b0056b1798c0ffb.zip
fix: optimums unknown fpr verifying helper
Diffstat (limited to 'src/ui/main_window/MainWindowGpgOperaFunction.cpp')
-rw-r--r--src/ui/main_window/MainWindowGpgOperaFunction.cpp115
1 files changed, 29 insertions, 86 deletions
diff --git a/src/ui/main_window/MainWindowGpgOperaFunction.cpp b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
index 4432d4e4..d9d2000f 100644
--- a/src/ui/main_window/MainWindowGpgOperaFunction.cpp
+++ b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
@@ -289,7 +289,8 @@ void MainWindow::SlotVerify() {
if (!result_analyse.GetUnknownSignatures().isEmpty() &&
Module::IsModuleActivate(kKeyServerSyncModuleID)) {
- slot_verifying_unknown_signature_helper(result_analyse);
+ slot_verifying_unknown_signature_helper(
+ result_analyse.GetUnknownSignatures());
}
});
});
@@ -306,64 +307,34 @@ void MainWindow::SlotVerify(const QByteArray& raw_data,
[this, raw_data_buffer, signature_buffer](const OperaWaitingHd& hd) {
GpgFrontend::GpgBasicOperator::GetInstance(
m_key_list_->GetCurrentGpgContextChannel())
- .Verify(
- raw_data_buffer, signature_buffer,
- [this, hd](GpgError err, const DataObjectPtr& data_obj) {
- // stop waiting
- hd();
-
- if (CheckGpgError(err) == GPG_ERR_USER_1 ||
- data_obj == nullptr ||
- !data_obj->Check<GpgVerifyResult>()) {
- QMessageBox::critical(this, tr("Error"),
- tr("Unknown error occurred"));
- return;
- }
- auto verify_result =
- ExtractParams<GpgVerifyResult>(data_obj, 0);
-
- // analyse result
- auto result_analyse = GpgVerifyResultAnalyse(
- m_key_list_->GetCurrentGpgContextChannel(), err,
- verify_result);
- result_analyse.Analyse();
- slot_result_analyse_show_helper(result_analyse);
+ .Verify(raw_data_buffer, signature_buffer,
+ [this, hd](GpgError err, const DataObjectPtr& data_obj) {
+ // stop waiting
+ hd();
- if (!result_analyse.GetUnknownSignatures().isEmpty() &&
- Module::IsModuleActivate(kKeyServerSyncModuleID)) {
- LOG_D() << "try to sync missing key info from server"
- << result_analyse.GetUnknownSignatures();
+ if (CheckGpgError(err) == GPG_ERR_USER_1 ||
+ data_obj == nullptr ||
+ !data_obj->Check<GpgVerifyResult>()) {
+ QMessageBox::critical(this, tr("Error"),
+ tr("Unknown error occurred"));
+ return;
+ }
+ auto verify_result =
+ ExtractParams<GpgVerifyResult>(data_obj, 0);
- QString fingerprint_list;
- for (const auto& fingerprint :
- result_analyse.GetUnknownSignatures()) {
- fingerprint_list += fingerprint + "\n";
- }
+ // analyse result
+ auto result_analyse = GpgVerifyResultAnalyse(
+ m_key_list_->GetCurrentGpgContextChannel(), err,
+ verify_result);
+ result_analyse.Analyse();
+ slot_result_analyse_show_helper(result_analyse);
- // Interaction with user
- auto user_response = QMessageBox::question(
- this, tr("Missing Keys"),
- tr("Some signatures cannot be verified because the "
- "corresponding keys are missing.\n\n"
- "The following fingerprints are missing:\n%1\n\n"
- "Would you like to fetch these keys from the key "
- "server?")
- .arg(fingerprint_list),
- QMessageBox::Yes | QMessageBox::No);
-
- if (user_response == QMessageBox::Yes) {
- CommonUtils::GetInstance()
- ->ImportKeyByKeyServerSyncModule(
- this, m_key_list_->GetCurrentGpgContextChannel(),
- result_analyse.GetUnknownSignatures());
- } else {
- QMessageBox::information(
- this, tr("Verification Incomplete"),
- tr("Verification was incomplete due to missing "
- "keys. You can manually import the keys later."));
- }
- }
- });
+ if (!result_analyse.GetUnknownSignatures().isEmpty() &&
+ Module::IsModuleActivate(kKeyServerSyncModuleID)) {
+ slot_verifying_unknown_signature_helper(
+ result_analyse.GetUnknownSignatures());
+ }
+ });
});
}
@@ -516,36 +487,8 @@ void MainWindow::SlotDecryptVerify() {
if (!verify_result_analyse.GetUnknownSignatures().isEmpty() &&
Module::IsModuleActivate(kKeyServerSyncModuleID)) {
- LOG_D() << "try to sync missing key info from server"
- << verify_result_analyse.GetUnknownSignatures();
-
- QString fingerprint_list;
- for (const auto& fingerprint :
- verify_result_analyse.GetUnknownSignatures()) {
- fingerprint_list += fingerprint + "\n";
- }
-
- // Interaction with user
- auto user_response = QMessageBox::question(
- this, tr("Missing Keys"),
- tr("Some signatures cannot be verified because the "
- "corresponding keys are missing.\n\n"
- "The following fingerprints are missing:\n%1\n\n"
- "Would you like to fetch these keys from the key "
- "server?")
- .arg(fingerprint_list),
- QMessageBox::Yes | QMessageBox::No);
-
- if (user_response == QMessageBox::Yes) {
- CommonUtils::GetInstance()->ImportKeyByKeyServerSyncModule(
- this, m_key_list_->GetCurrentGpgContextChannel(),
- verify_result_analyse.GetUnknownSignatures());
- } else {
- QMessageBox::information(
- this, tr("Verification Incomplete"),
- tr("Verification was incomplete due to missing "
- "keys. You can manually import the keys later."));
- }
+ slot_verifying_unknown_signature_helper(
+ verify_result_analyse.GetUnknownSignatures());
}
});
});