diff options
author | saturneric <[email protected]> | 2024-11-27 20:23:51 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-27 20:23:51 +0000 |
commit | a83c6e28a16f998d89b956688f07ce5352a2864f (patch) | |
tree | 796ad69eee3add96df38e3e4f1dc78a82745a9db /src/ui/main_window/MainWindowSlotFunction.cpp | |
parent | fix: solve devops build issues (diff) | |
download | GpgFrontend-a83c6e28a16f998d89b956688f07ce5352a2864f.tar.gz GpgFrontend-a83c6e28a16f998d89b956688f07ce5352a2864f.zip |
feat: improve ui logic and support more email operations
Diffstat (limited to 'src/ui/main_window/MainWindowSlotFunction.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index c7579ff9..8bfb4289 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -689,4 +689,36 @@ void MainWindow::slot_decrypt_email_by_eml_data_result_helper( }); } +void MainWindow::SlotSignEML() { + if (edit_->TabCount() == 0 || edit_->CurEMailPage() == nullptr) return; + if (m_key_list_->GetCheckedKeys().isEmpty()) return; + + auto buffer = edit_->CurPlainText().toUtf8(); + + Module::TriggerEvent( + "EMAIL_EXPORT_EML_DATA", + { + {"body_data", QString::fromLatin1(buffer.toBase64())}, + {"channel", + QString::number(m_key_list_->GetCurrentGpgContextChannel())}, + {"sign_key", m_key_list_->GetCheckedKeys().front()}, + }, + [=](Module::EventIdentifier i, Module::Event::ListenerIdentifier ei, + Module::Event::Params p) { + LOG_D() << "EMAIL_DECRYPT_EML_DATA callback: " << i << ei; + if (p["ret"] != "0" || !p["err"].isEmpty()) { + LOG_E() << "An error occurred trying to decrypt email, " + << "error message: " << p["err"]; + + return; + } + + if (!p["eml_data"].isEmpty()) { + edit_->SlotSetText2CurEMailPage(p.value("eml_data", "")); + } + + LOG_E() << "mime or signature data is missing"; + }); +} + } // namespace GpgFrontend::UI |