summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-11-22 11:52:35 (GMT)
committerSandro Knauß <sknauss@kde.org>2016-11-22 11:52:35 (GMT)
commit532c1daf21edbd433ec993f73d5e3c98e30dc11a (patch)
tree20125e05261fe4725f651c5590d6150ec75c26c6
parent1a6974a3c0737c130ccb1a9475aca31d516267f0 (diff)
Make mimetreeparser to build without libkleo, for gpgme > 1.7.1
-rw-r--r--CMakeLists.txt11
-rw-r--r--mimetreeparser/src/CMakeLists.txt16
-rw-r--r--mimetreeparser/src/viewer/messagepart.cpp20
3 files changed, 40 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 144ef1e..ba0b2e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ set(KPIMTEXTEDIT_LIB_VERSION "5.3.80")
set(LIBKDEPIM_LIB_VERSION "5.3.80")
set(LIBKLEO_LIB_VERSION "5.3.80")
set(PIMCOMMON_LIB_VERSION "5.3.80")
+set(GPGME_LIB_VERSION "1.7.1")
if (${MIMETREEPARSER_ONLY_BUILD})
set(KF5_VERSION "5.26.0")
@@ -54,8 +55,16 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui Test)
find_package(KF5Codecs ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
-find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
+find_package(QGpgme ${GPGME_LIB_VERSION} CONFIG REQUIRED)
+
+if (${MIMETREEPARSER_ONLY_BUILD})
+ if ( ${QGpgme_VERSION} VERSION_LESS "1.7.2" )
+ find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
+ endif()
+else()
+ find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
+endif()
if (NOT ${MIMETREEPARSER_ONLY_BUILD})
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets WebKitWidgets)
diff --git a/mimetreeparser/src/CMakeLists.txt b/mimetreeparser/src/CMakeLists.txt
index 39e5fcb..3556bcd 100644
--- a/mimetreeparser/src/CMakeLists.txt
+++ b/mimetreeparser/src/CMakeLists.txt
@@ -150,14 +150,24 @@ add_library(KF5MimeTreeParser
generate_export_header(KF5MimeTreeParser BASE_NAME mimetreeparser)
add_library(KF5::MimeTreeParser ALIAS KF5MimeTreeParser)
-target_link_libraries(KF5MimeTreeParser
- PRIVATE
- KF5::Libkleo
+set(mimetreeparser_LINK_LIBRARIES
QGpgme
KF5::Codecs
KF5::I18n
KF5::Mime
Qt5::Gui
+ )
+
+if (${QGpgme_VERSION} VERSION_LESS "1.7.2" OR NOT ${MIMETREEPARSER_ONLY_BUILD})
+ set(mimetreeparser_LINK_LIBRARIES
+ KF5::Libkleo
+ ${mimetreeparser_LINK_LIBRARIES}
+ )
+endif()
+
+target_link_libraries(KF5MimeTreeParser
+ PRIVATE
+ ${mimetreeparser_LINK_LIBRARIES}
)
install(TARGETS
diff --git a/mimetreeparser/src/viewer/messagepart.cpp b/mimetreeparser/src/viewer/messagepart.cpp
index 1c6806c..c54f24e 100644
--- a/mimetreeparser/src/viewer/messagepart.cpp
+++ b/mimetreeparser/src/viewer/messagepart.cpp
@@ -33,8 +33,13 @@
#include <KMime/Content>
-#include <Libkleo/Dn>
+#include <qgpgme/qgpgme_version.h>
+#if QGPGME_VERSION < 0x010702
+ #include <Libkleo/Dn>
+#else
+ #include <QGpgME/DN>
+#endif
#include <QGpgME/Protocol>
#include <QGpgME/ImportJob>
#include <QGpgME/KeyListJob>
@@ -854,6 +859,15 @@ static int signatureToStatus(const GpgME::Signature &sig)
}
}
+QString prettifyDN(const char *uid)
+{
+#if QGPGME_VERSION < 0x010702
+ return Kleo::DN(uid).prettyDN();
+#else
+ return QGpgME::DN(uid).prettyDN();
+#endif
+}
+
void SignedMessagePart::sigStatusToMetaData()
{
GpgME::Key key;
@@ -898,7 +912,7 @@ void SignedMessagePart::sigStatusToMetaData()
}
mMetaData.keyTrust = signature.validity();
if (key.numUserIDs() > 0 && key.userID(0).id()) {
- mMetaData.signer = Kleo::DN(key.userID(0).id()).prettyDN();
+ mMetaData.signer = prettifyDN(key.userID(0).id());
}
for (uint iMail = 0; iMail < key.numUserIDs(); ++iMail) {
// The following if /should/ always result in TRUE but we
@@ -923,7 +937,7 @@ void SignedMessagePart::sigStatusToMetaData()
}
if (mMetaData.signer.isEmpty()) {
if (key.numUserIDs() > 0 && key.userID(0).name()) {
- mMetaData.signer = Kleo::DN(key.userID(0).name()).prettyDN();
+ mMetaData.signer = prettifyDN(key.userID(0).name());
}
if (!mMetaData.signerMailAddresses.empty()) {
if (mMetaData.signer.isEmpty()) {