Commit 532c1daf authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

Make mimetreeparser to build without libkleo, for gpgme > 1.7.1

parent 1a6974a3
......@@ -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)
......
......@@ -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
......
......@@ -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()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment