aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowFileSlotFunction.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-25 22:42:25 +0000
committersaturneric <[email protected]>2024-11-25 22:42:25 +0000
commit296de126739a0b0a1556f9f34533255c05634651 (patch)
tree8dd47144081f47d9e57eca3aa8b3da5278310827 /src/ui/main_window/MainWindowFileSlotFunction.cpp
parentfix: handling of split CRLF sequences during text insertion (diff)
downloadGpgFrontend-296de126739a0b0a1556f9f34533255c05634651.tar.gz
GpgFrontend-296de126739a0b0a1556f9f34533255c05634651.zip
feat: support verifying email through eml data
Diffstat (limited to 'src/ui/main_window/MainWindowFileSlotFunction.cpp')
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp
index c85b616a..599fe4d6 100644
--- a/src/ui/main_window/MainWindowFileSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp
@@ -556,8 +556,7 @@ void MainWindow::SlotFileVerify(const QString& path) {
process_result_analyse(edit_, info_board_, result_analyse);
if (!result_analyse.GetUnknownSignatures().isEmpty() &&
- Module::IsModuleActivate(
- "com.bktus.gpgfrontend.module.key_server_sync")) {
+ Module::IsModuleActivate(kKeyServerSyncModuleID)) {
LOG_D() << "try to sync missing key info from server"
<< result_analyse.GetUnknownSignatures();
@@ -901,8 +900,7 @@ void MainWindow::SlotFileDecryptVerify(const QString& path) {
this->slot_refresh_current_file_view();
if (!verify_result_analyse.GetUnknownSignatures().isEmpty() &&
- Module::IsModuleActivate(
- "com.bktus.gpgfrontend.module.key_server_sync")) {
+ Module::IsModuleActivate(kKeyServerSyncModuleID)) {
LOG_D() << "try to sync missing key info from server"
<< verify_result_analyse.GetUnknownSignatures();
@@ -1018,4 +1016,30 @@ void MainWindow::SlotArchiveDecryptVerify(const QString& path) {
});
}
+void MainWindow::SlotFileVerifyEML(const QString& path) {
+ auto check_result = TargetFilePreCheck(path, true);
+ if (!std::get<0>(check_result)) {
+ QMessageBox::critical(this, tr("Error"),
+ tr("Cannot read from file: %1").arg(path));
+ return;
+ }
+
+ QFileInfo file_info(path);
+ if (file_info.size() > static_cast<qint64>(1024 * 1024 * 32)) {
+ QMessageBox::warning(
+ this, tr("EML File Too Large"),
+ tr("The EML file \"%1\" is larger than 32MB and will not be opened.")
+ .arg(file_info.fileName()));
+ return;
+ }
+
+ QFile eml_file(path);
+ if (!eml_file.open(QIODevice::ReadOnly)) return;
+ auto buffer = eml_file.readAll();
+
+ // LOG_D() << "EML BUFFER (FILE): " << buffer;
+
+ slot_verify_email_by_eml_data(buffer);
+}
+
} // namespace GpgFrontend::UI