aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-06-17 14:16:18 +0000
committerSaturneric <[email protected]>2021-06-17 14:16:18 +0000
commit0a11b572c0a21f69909eee94d4b8cc552c13c8ca (patch)
tree97ea8cff1e392ce9b73a79f33a0bd0afe81c8a25
parentMerge branch 'develop' of ssh://tunnel.bktus.com:30412/Saturneric/GPGFrontend... (diff)
downloadGpgFrontend-0a11b572c0a21f69909eee94d4b8cc552c13c8ca.tar.gz
GpgFrontend-0a11b572c0a21f69909eee94d4b8cc552c13c8ca.zip
Make it possible to compile and run on Windows.
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/gpg/CMakeLists.txt13
-rw-r--r--src/gpg/GpgContext.cpp16
3 files changed, 22 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a62d6a0f..1e12853e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,8 @@ IF (MINGW)
message("OS Platform Microsoft Windows")
message("Envrinoment MINGW")
+
+ set(CMAKE_EXE_LINKER_FLAGS "-static")
include_directories(
include
diff --git a/src/gpg/CMakeLists.txt b/src/gpg/CMakeLists.txt
index 3359f662..3213c457 100644
--- a/src/gpg/CMakeLists.txt
+++ b/src/gpg/CMakeLists.txt
@@ -7,6 +7,13 @@ set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils)
set(GPGME_LIB_DIR ${UTILS_DIR}/gpgme/lib)
-target_link_libraries(gpg
- gpgme gpg-error assuan
- Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
+IF (MINGW)
+ target_link_libraries(gpg
+ gpgme gpg-error assuan
+ Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core
+ wsock32)
+else()
+ target_link_libraries(gpg
+ gpgme gpg-error assuan
+ Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
+endif() \ No newline at end of file
diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp
index 4366d967..d0cf30d5 100644
--- a/src/gpg/GpgContext.cpp
+++ b/src/gpg/GpgContext.cpp
@@ -29,7 +29,9 @@
#include <Mime.h>
#ifdef _WIN32
+
#include <windows.h>
+
#endif
namespace GpgME {
@@ -69,7 +71,8 @@ namespace GpgME {
engineInfo = gpgme_ctx_get_engine_info(mCtx);
while (engineInfo != nullptr) {
- qDebug() << gpgme_get_protocol_name(engineInfo->protocol);
+ qDebug() << gpgme_get_protocol_name(engineInfo->protocol) << engineInfo->file_name << engineInfo->protocol
+ << engineInfo->home_dir << engineInfo->version;
engineInfo = engineInfo->next;
}
@@ -418,8 +421,9 @@ namespace GpgME {
bool show_ma_dock = false;
Mime *mime = new Mime(message);
- for(MimePart tmp : mime->parts()) {
- if (tmp.header.getValue("Content-Type") == "text/plain" && tmp.header.getValue("Content-Transfer-Encoding") != "base64") {
+ for (MimePart tmp : mime->parts()) {
+ if (tmp.header.getValue("Content-Type") == "text/plain" &&
+ tmp.header.getValue("Content-Transfer-Encoding") != "base64") {
QByteArray body;
if (tmp.header.getValue("Content-Transfer-Encoding") == "quoted-printable") {
Mime::quotedPrintableDecode(tmp.body, body);
@@ -549,7 +553,7 @@ namespace GpgME {
#ifdef _WIN32
DWORD written;
- HANDLE hd = (HANDLE)fd;
+ HANDLE hd = (HANDLE) fd;
#endif
if (last_was_bad) {
@@ -595,8 +599,8 @@ namespace GpgME {
WriteFile(hd, "\n", 1, &written, 0);
/* program will hang on cancel if hd not closed */
- if(!result) {
- CloseHandle(hd);
+ if (!result) {
+ CloseHandle(hd);
}
#endif