diff --git a/CMakeLists.txt b/CMakeLists.txt index e1d9b58c..6f2823b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,136 +1,136 @@ cmake_minimum_required(VERSION 3.5) -set(PIM_VERSION "5.12.61") +set(PIM_VERSION "5.12.62") if (POLICY CMP0053) cmake_policy(SET CMP0053 NEW) endif() project(Messagelib VERSION ${PIM_VERSION}) option(MIMETREEPARSER_ONLY_BUILD "Build only mimetreeparser" FALSE) option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE) option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) option(DKIM_CHECKER_BUILD "DKIM CHECKER (experimental)" FALSE) set(KF5_MIN_VERSION "5.62.0") set(MESSAGELIB_LIB_VERSION ${PIM_VERSION}) set(AKONADIMIME_LIB_VERSION "5.12.40") set(QT_REQUIRED_VERSION "5.11.0") set(AKONADI_VERSION "5.12.40") set(GRANTLEETHEME_LIB_VERSION "5.12.40") set(GRAVATAR_LIB_VERSION "5.12.40") set(IDENTITYMANAGEMENT_LIB_VERSION "5.12.40") set(KCONTACTS_LIB_VERSION "5.12.40") set(KDEPIM_APPS_LIB_VERSION "5.12.40") set(KLDAP_LIB_VERSION "5.12.40") set(KMAILTRANSPORT_LIB_VERSION "5.12.40") set(KMBOX_LIB_VERSION "5.12.40") set(KMIME_LIB_VERSION "5.12.40") set(KPIMTEXTEDIT_LIB_VERSION "5.12.42") set(LIBKDEPIM_LIB_VERSION "5.12.40") set(LIBKLEO_LIB_VERSION "5.12.40") set(PIMCOMMON_LIB_VERSION "5.12.40") set(GPGME_LIB_VERSION "1.11.1") set(AKONADI_CONTACT_VERSION "5.12.42") if (${MIMETREEPARSER_ONLY_BUILD}) set(ECM_VERSION "5.26.0") set(KMIME_LIB_VERSION "5.1.40") else() set(ECM_VERSION ${KF5_MIN_VERSION}) endif() find_package(ECM ${ECM_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${Messagelib_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) set(LIBRARY_NAMELINK) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(FeatureSummary) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui Test) find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5NewStuff ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(QGpgme ${GPGME_LIB_VERSION} CONFIG REQUIRED) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets) find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5JobWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Sonnet ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(Grantlee5 "5.1" CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED) find_package(KF5FollowupReminder ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5KaddressbookGrantlee ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mbox ${KMBOX_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5SendLater ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiSearch "5.12.40" CONFIG REQUIRED) set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "https://kde.org/" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi") endif() set(CMAKE_CXX_STANDARD 14) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() if(BUILD_TESTING) add_definitions(-DBUILD_TESTING) endif() add_subdirectory(mimetreeparser) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) add_subdirectory(messageviewer) add_subdirectory(templateparser) add_subdirectory(messagecomposer) add_subdirectory(messagecore) add_subdirectory(messagelist) add_subdirectory(webengineviewer) endif() install(FILES messagelib.renamecategories messagelib.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt index 0c10a518..ce57b90f 100644 --- a/messageviewer/src/CMakeLists.txt +++ b/messageviewer/src/CMakeLists.txt @@ -1,556 +1,558 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libmessageviewer\") add_subdirectory(messagepartthemes/grantlee) # KCFG files: # The main messageviewer.kcfg is configured by CMake and put in the build directory. if(KDEPIM_ENTERPRISE_BUILD) set(LEGACY_MANGLE_FROM_TO_HEADERS true) set(LEGACY_BODY_INVITES true) set(EXCHANGE_COMPATIBLE_INVITATIONS true) else() set(LEGACY_MANGLE_FROM_TO_HEADERS false) set(LEGACY_BODY_INVITES false) set(EXCHANGE_COMPATIBLE_INVITATIONS false) endif() if (DKIM_CHECKER_BUILD) set(USE_DKIM_CHECKER 1) endif() configure_file(settings/messageviewer.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/messageviewer.kcfg) include(CheckIncludeFiles) find_package(Inotify) set_package_properties(Inotify PROPERTIES PURPOSE "Filesystem alteration notifications using inotify") if(Inotify_FOUND) set(HAVE_SYS_INOTIFY_H 1) else() set(HAVE_SYS_INOTIFY_H 0) endif() configure_file(config-messageviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h) # target_include_directories does not handle empty include paths include_directories(${GPGME_INCLUDES}) if(BUILD_TESTING) add_subdirectory(header/autotests) add_subdirectory(scamdetection/autotests) add_subdirectory(scamdetection/tests) add_subdirectory(viewerplugins/tests/) add_subdirectory(htmlwriter/autotests) add_subdirectory(viewer/webengine/tests) add_subdirectory(messagepartthemes/default/autotests) add_subdirectory(widgets/autotests/) add_subdirectory(utils/autotests) endif() add_subdirectory(pics) add_subdirectory(kconf_update) add_subdirectory(about) add_subdirectory(messageviewerheaderplugins) if (DKIM_CHECKER_BUILD) find_package(Qca-qt5 2.1.0) set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Qt Cryptographic Architecture" URL "https:/download.kde.org/stable/qca-qt5" TYPE OPTIONAL PURPOSE "Needed for most of the algorithms of the checksum tool") if (BUILD_TESTING) add_subdirectory(dkim-verify/autotests) add_subdirectory(dkim-verify/tests) endif() set(dkim_verify_SRCS dkim-verify/dkiminfo.cpp dkim-verify/dkimmanagerkey.cpp dkim-verify/dkimmanagerkeywidget.cpp dkim-verify/dkimmanagerkeydialog.cpp dkim-verify/dkimdownloadkeyjob.cpp dkim-verify/dkimchecksignaturejob.cpp dkim-verify/dkimcheckauthenticationstatusjob.cpp dkim-verify/dkimauthenticationstatusinfo.cpp dkim-verify/dkimutil.cpp dkim-verify/dkimkeyrecord.cpp dkim-verify/dkimmanager.cpp dkim-verify/dkimresultattribute.cpp dkim-verify/dkimwidgetinfo.cpp dkim-verify/dkimstoreresultjob.cpp ) endif() if(DEBUG_SIGNATURE) add_definitions(-DDEBUG_SIGNATURE) endif() set(libmessageviewer_mailviewer_SRCS viewer/webengine/mailwebengineview.cpp viewer/webengine/mailwebenginepage.cpp viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp ) set(libmessageviewer_viewer_SRCS viewer/attachmentstrategy.cpp viewer/csshelper.cpp viewer/csshelperbase.cpp viewer/editorwatcher.cpp viewer/objecttreeemptysource.cpp viewer/objecttreeviewersource.cpp viewer/viewer.cpp viewer/viewer_p.cpp viewer/messagedisplayformatattribute.cpp viewer/urlhandlermanager.cpp viewer/mimeparttree/mimeparttreeview.cpp viewer/mimeparttree/mimetreemodel.cpp ) set(libmessageviewer_widgets_SRCS widgets/attachmentdialog.cpp widgets/configurewidget.cpp widgets/printingsettings.cpp widgets/htmlstatusbar.cpp widgets/vcardviewer.cpp widgets/invitationsettings.cpp widgets/openattachmentfolderwidget.cpp widgets/mailsourceviewtextbrowserwidget.cpp widgets/submittedformwarningwidget.cpp widgets/mailtrackingwarningwidget.cpp widgets/mailtrackingdetailsdialog.cpp widgets/shownextmessagewidget.cpp ) set(libmessageviewer_widgets_webengine_SRCS widgets/mailsourcewebengineviewer.cpp ) set(libmessageviewer_header_SRCS header/contactdisplaymessagememento.cpp header/headerstrategy.cpp header/richheaderstrategy.cpp header/headerstyle.cpp header/grantleeheaderstyle.cpp header/plainheaderstyle.cpp header/headerstyle_util.cpp header/grantleeheaderformatter.cpp header/grantleeheaderteststyle.cpp header/kxface.cpp header/headerstyleplugin.cpp header/headerstylepluginmanager.cpp header/headerstyleinterface.cpp header/headerstylemenumanager.cpp ) set(libmessageviewer_scamdetection_SRCS scamdetection/scamdetectionwarningwidget.cpp scamdetection/scamdetectiondetailsdialog.cpp scamdetection/scamattribute.cpp scamdetection/scamcheckshorturl.cpp scamdetection/scamexpandurljob.cpp scamdetection/scamcheckshorturlmanager.cpp ) set(libmessageviewer_scamdetection_webengine_SRCS scamdetection/scamdetectionwebengine.cpp ) set(libmessageviewer_findbar_SRCS findbar/findbarsourceview.cpp ) set(libmessageviewer_utils_SRCS utils/iconnamecache.cpp utils/markmessagereadhandler.cpp utils/messageviewerutil.cpp utils/mimetype.cpp ) set(libmessageviewer_htmlwriter_webengine_SRCS htmlwriter/webengineparthtmlwriter.cpp htmlwriter/webengineembedpart.cpp ) set(libmessageviewer_htmlwriter_SRCS ${libmessageviewer_htmlwriter_webengine_SRCS} htmlwriter/bufferedhtmlwriter.cpp htmlwriter/filehtmlwriter.cpp ) set(libmessageviewer_antispam_SRCS antispam/spamheaderanalyzer.cpp antispam/antispamconfig.cpp ) set(libmessageviewer_job_SRCS job/modifymessagedisplayformatjob.cpp ) set(libmessageviewer_viewerplugins_SRCS viewerplugins/viewerpluginmanager.cpp viewerplugins/viewerplugin.cpp viewerplugins/viewerplugininterface.cpp viewerplugins/viewerplugintoolmanager.cpp ) set(libmessageviewer_configureplugins_SRCS messageviewerconfigureplugins/messageviewerconfiguresettingsplugin.cpp messageviewerconfigureplugins/messageviewerconfiguresettingspluginmanager.cpp messageviewerconfigureplugins/messageviewerconfiguresettingspluginwidget.cpp ) set(libmessageviewer_messagepartthemes_default_SRCS messagepartthemes/default/converthtmltoplaintext.cpp messagepartthemes/default/defaultrenderer.cpp messagepartthemes/default/htmlblock.cpp messagepartthemes/default/messagepartrenderermanager.cpp messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp messagepartthemes/default/plugins/messagepartrenderer.cpp messagepartthemes/default/plugins/textmessagepartrenderer.cpp messagepartthemes/default/plugins/quotehtml.cpp messagepartthemes/default/messagepartrenderbase.cpp messagepartthemes/default/messagepartrenderplugin.cpp messagepartthemes/default/messagepartrendererfactory.cpp ) set(libmessageviewer_interfaces_SRCS interfaces/htmlwriter.cpp ) set(libmessageviewer_SRCS ${dkim_verify_SRCS} ${libmessageviewer_messagepartthemes_default_SRCS} ${libmessageviewer_htmlwriter_SRCS} ${libmessageviewer_messagepartthemes_SRCS} ${libmessageviewer_scamdetection_webengine_SRCS} ${libmessageviewer_widgets_webengine_SRCS} ${libmessageviewer_viewer_SRCS} ${libmessageviewer_widgets_SRCS} ${libmessageviewer_header_SRCS} ${libmessageviewer_scamdetection_SRCS} ${libmessageviewer_findbar_SRCS} ${libmessageviewer_utils_SRCS} ${libmessageviewer_antispam_SRCS} ${libmessageviewer_job_SRCS} ${libmessageviewer_viewerplugins_SRCS} settings/messageviewersettings.cpp ${libmessageviewer_mailviewer_SRCS} ${libmessageviewer_interfaces_SRCS} ${libmessageviewer_configureplugins_SRCS} ) qt5_add_resources(libmessageviewer_SRCS messagepartthemes.qrc) ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_debug.h IDENTIFIER MESSAGEVIEWER_LOG CATEGORY_NAME org.kde.pim.messageviewer) #temporary ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_dkimcheckerdebug.h IDENTIFIER MESSAGEVIEWER_DKIMCHECKER_LOG CATEGORY_NAME org.kde.pim.messageviewer_dkimchecker) kconfig_add_kcfg_files(libmessageviewer_SRCS settings/globalsettings_messageviewer.kcfgc ) ki18n_wrap_ui(libmessageviewer_SRCS ui/settings.ui ui/invitationsettings.ui ui/printingsettings.ui ) add_library(KF5MessageViewer ${libmessageviewer_SRCS}) generate_export_header(KF5MessageViewer BASE_NAME messageviewer) add_library(KF5::MessageViewer ALIAS KF5MessageViewer) target_include_directories(KF5MessageViewer INTERFACE "$;${Inotify_INCLUDE_DIRS}") if (DKIM_CHECKER_BUILD) set(OPTIONAL_PRIVATE qca-qt5) endif() target_link_libraries(KF5MessageViewer PUBLIC KF5::MessageCore KF5::PimCommon KF5::AkonadiCore KF5::AkonadiMime KF5::Contacts KF5::Libkleo KF5::MimeTreeParser PRIVATE KF5::SyntaxHighlighting KF5::ItemViews Qt5::Network KF5::WebEngineViewer KF5::LibkdepimAkonadi KF5::GrantleeTheme KF5::KaddressbookGrantlee KF5::MailTransportAkonadi KF5::Mime KF5::Mbox KF5::PimTextEdit KF5::Gravatar KF5::IconThemes KF5::I18n KF5::KIOFileWidgets KF5::KIOWidgets KF5::XmlGui Grantlee5::TextDocument Grantlee5::Templates Qt5::PrintSupport QGpgme ${Inotify_LIBRARIES} ${OPTIONAL_PRIVATE} ) set(OPTIONAL_PRIVATE qca-qt5) set_target_properties(KF5MessageViewer PROPERTIES VERSION ${MESSAGEVIEWER_VERSION_STRING} SOVERSION ${MESSAGEVIEWER_SOVERSION} EXPORT_NAME MessageViewer ) install(TARGETS KF5MessageViewer EXPORT KF5MessageViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) ecm_generate_headers(MessageViewer_Camelblockmailtrackingurlinterceptor_HEADERS HEADER_NAMES BlockMailTrackingUrlInterceptor REQUIRED_HEADERS MessageViewer_blockmailtrackingurlinterceptor_HEADERS PREFIX MessageViewer RELATIVE viewer/webengine/blockmailtrackingurlinterceptor ) ecm_generate_headers(MessageViewer_Camelcasewebengine_HEADERS HEADER_NAMES MailWebEnginePage MailWebEngineView REQUIRED_HEADERS MessageViewer_webengine_HEADERS PREFIX MessageViewer RELATIVE viewer/webengine ) ecm_generate_headers(MessageViewer_Camelcasescam_HEADERS HEADER_NAMES ScamExpandUrlJob ScamCheckShortUrlManager ScamCheckShortUrl REQUIRED_HEADERS MessageViewer_scam_HEADERS PREFIX MessageViewer RELATIVE scamdetection ) if (DKIM_CHECKER_BUILD) ecm_generate_headers(MessageViewer_Cameldkimverify_HEADERS HEADER_NAMES DKIMManagerKey DKIMCheckSignatureJob DKIMManager DKIMManagerKeyWidget DKIMManagerKeyDialog + DKIMKeyRecord DKIMInfo + DKIMWidgetInfo REQUIRED_HEADERS MessageViewer_dkimverify_HEADERS PREFIX MessageViewer RELATIVE dkim-verify ) endif() ecm_generate_headers(MessageViewer_Camelcaseviewer_HEADERS HEADER_NAMES AttachmentStrategy Viewer CSSHelperBase CSSHelper ObjectTreeEmptySource EditorWatcher Stl_Util REQUIRED_HEADERS MessageViewer_viewer_HEADERS PREFIX MessageViewer RELATIVE viewer ) ecm_generate_headers(MessageViewer_Camelcasewidgets_HEADERS HEADER_NAMES InvitationSettings PrintingSettings ConfigureWidget REQUIRED_HEADERS MessageViewer_widgets_HEADERS PREFIX MessageViewer RELATIVE widgets ) ecm_generate_headers(MessageViewer_Camelcaseutils_HEADERS HEADER_NAMES IconNameCache MarkMessageReadHandler MessageViewerUtil MimeType REQUIRED_HEADERS MessageViewer_utils_HEADERS PREFIX MessageViewer RELATIVE utils ) ecm_generate_headers(MessageViewer_Camelcaseantispam_HEADERS HEADER_NAMES SpamHeaderAnalyzer REQUIRED_HEADERS MessageViewer_antispam_HEADERS PREFIX MessageViewer RELATIVE antispam ) ecm_generate_headers(MessageViewer_Camelcaseinterfaces_HEADERS HEADER_NAMES HtmlWriter BodyPartURLHandler URLHandler REQUIRED_HEADERS MessageViewer_interfaces_HEADERS PREFIX MessageViewer RELATIVE interfaces ) ecm_generate_headers(MessageViewer_Camelcasehtmlwriter_HEADERS HEADER_NAMES BufferedHtmlWriter FileHtmlWriter REQUIRED_HEADERS MessageViewer_htmlwriter_HEADERS PREFIX MessageViewer RELATIVE htmlwriter ) ecm_generate_headers(MessageViewer_Camelcasesettings_HEADERS HEADER_NAMES MessageViewerSettings REQUIRED_HEADERS MessageViewer_settings_HEADERS PREFIX MessageViewer RELATIVE settings ) ecm_generate_headers(MessageViewer_CamelcaseConfigurePlugins_HEADERS HEADER_NAMES MessageViewerConfigureSettingsPluginManager MessageViewerConfigureSettingsPlugin MessageViewerConfigureSettingsPluginWidget REQUIRED_HEADERS MessageViewer_ConfigurePlugins_HEADERS PREFIX MessageViewer RELATIVE messageviewerconfigureplugins ) ecm_generate_headers(MessageViewer_Camelcaseheader_HEADERS HEADER_NAMES HeaderStrategy GrantleeHeaderTestStyle GrantleeHeaderStyle HeaderStyle KXFace HeaderStyle_Util HeaderStylePlugin HeaderStyleInterface PlainHeaderStyle RichHeaderStrategy HeaderStylePluginManager HeaderStyleMenuManager REQUIRED_HEADERS MessageViewer_header_HEADERS PREFIX MessageViewer RELATIVE header ) ecm_generate_headers(MessageViewer_Camelcaseviewerplugin_HEADERS HEADER_NAMES ViewerPluginManager ViewerPlugin ViewerPluginInterface ViewerPluginToolManager REQUIRED_HEADERS MessageViewer_viewerplugin_HEADERS PREFIX MessageViewer RELATIVE viewerplugins ) ecm_generate_headers(MessageViewer_Camelcaserenderer_HEADERS HEADER_NAMES HtmlBlock MessagePartRendererBase MessagePartRendererManager MessagePartRenderPlugin REQUIRED_HEADERS MessageViewer_renderer_HEADERS PREFIX MessageViewer RELATIVE messagepartthemes/default ) ecm_generate_pri_file(BASE_NAME MessageViewer LIB_NAME KF5MessageViewer DEPS "PimCommon MessageCore AkonadiCore AkonadiMime Contacts Libkleo MimeTreeParser" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer ) if (DKIM_CHECKER_BUILD) install(FILES ${MessageViewer_Cameldkimverify_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer COMPONENT Devel ) install(FILES ${MessageViewer_dkimverify_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer COMPONENT Devel ) endif() install(FILES ${MessageViewer_CamelcaseConfigurePlugins_HEADERS} ${MessageViewer_Camelcasewebengine_HEADERS} ${MessageViewer_Camelcaseheader_HEADERS} ${MessageViewer_Camelcaseviewerplugin_HEADERS} ${MessageViewer_Camelcasesettings_HEADERS} ${MessageViewer_Camelcaseutils_HEADERS} ${MessageViewer_Camelcaseinterfaces_HEADERS} ${MessageViewer_Camelcasehtmlwriter_HEADERS} ${MessageViewer_Camelcaseviewer_HEADERS} ${MessageViewer_Camelcasewidgets_HEADERS} ${MessageViewer_Camelcaseantispam_HEADERS} ${MessageViewer_Camelfindbar_HEADERS} ${MessageViewer_Camelcasescam_HEADERS} ${MessageViewer_Camelcaserenderer_HEADERS} ${MessageViewer_Camelblockmailtrackingurlinterceptor_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer COMPONENT Devel ) install(FILES ${MessageViewer_ConfigurePlugins_HEADERS} ${MessageViewer_webengine_HEADERS} ${MessageViewer_scam_HEADERS} ${MessageViewer_viewerplugin_HEADERS} ${MessageViewer_settings_HEADERS} ${MessageViewer_header_HEADERS} ${MessageViewer_utils_HEADERS} ${MessageViewer_interfaces_HEADERS} ${MessageViewer_htmlwriter_HEADERS} ${MessageViewer_HEADERS} ${MessageViewer_viewer_HEADERS} ${MessageViewer_widgets_HEADERS} ${MessageViewer_antispam_HEADERS} ${MessageViewer_findbar_HEADERS} ${MessageViewer_renderer_HEADERS} ${MessageViewer_blockmailtrackingurlinterceptor_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_export.h ${CMAKE_CURRENT_BINARY_DIR}/globalsettings_messageviewer.h ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_debug.h ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) install(FILES header/data/messageviewer_header_themes.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} ) install(FILES notify/messageviewer.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} ) install(FILES scamdetection/data/longurlServices.json DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer ) diff --git a/messageviewer/src/dkim-verify/dkimchecksignaturejob.h b/messageviewer/src/dkim-verify/dkimchecksignaturejob.h index 1a66971b..15655e8a 100644 --- a/messageviewer/src/dkim-verify/dkimchecksignaturejob.h +++ b/messageviewer/src/dkim-verify/dkimchecksignaturejob.h @@ -1,147 +1,147 @@ /* Copyright (C) 2018-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DKIMCHECKSIGNATUREJOB_H #define DKIMCHECKSIGNATUREJOB_H #include -#include "dkimkeyrecord.h" +#include #include "dkiminfo.h" #include "messageviewer_export.h" #include #include namespace MessageViewer { class MESSAGEVIEWER_EXPORT DKIMCheckSignatureJob : public QObject { Q_OBJECT public: enum class DKIMStatus : int { Unknown = 0, Valid = 1, Invalid = 2, EmailNotSigned = 3 }; enum class DKIMError : int { Any = 0, CorruptedBodyHash = 1, DomainNotExist = 2, MissingFrom = 3, MissingSignature = 4, InvalidQueryMethod = 5, InvalidHeaderCanonicalization = 6, InvalidBodyCanonicalization = 7, InvalidBodyHashAlgorithm = 8, InvalidSignAlgorithm = 9, PublicKeyWasRevoked = 10, SignatureTooLarge = 11, InsupportedHashAlgorithm = 12, PublicKeyTooSmall = 13, ImpossibleToVerifySignature = 14, //TODO add more }; enum class DKIMWarning : int { Any = 0, SignatureExpired = 1, SignatureCreatedInFuture = 2, SignatureTooSmall = 3 }; struct CheckSignatureResult { bool isValid() const { return status != DKIMCheckSignatureJob::DKIMStatus::Unknown; } Q_REQUIRED_RESULT bool operator==(const CheckSignatureResult &other) const { return error == other.error && warning == other.warning && status == other.status && item == other.item; } Q_REQUIRED_RESULT bool operator!=(const CheckSignatureResult &other) const { return !CheckSignatureResult::operator==(other); } DKIMCheckSignatureJob::DKIMError error = DKIMCheckSignatureJob::DKIMError::Any; DKIMCheckSignatureJob::DKIMWarning warning = DKIMCheckSignatureJob::DKIMWarning::Any; DKIMCheckSignatureJob::DKIMStatus status = DKIMCheckSignatureJob::DKIMStatus::Unknown; Akonadi::Item item; }; explicit DKIMCheckSignatureJob(QObject *parent = nullptr); ~DKIMCheckSignatureJob(); void start(); Q_REQUIRED_RESULT QString dkimValue() const; Q_REQUIRED_RESULT DKIMCheckSignatureJob::DKIMStatus status() const; void setStatus(const DKIMCheckSignatureJob::DKIMStatus &status); Q_REQUIRED_RESULT MessageViewer::DKIMCheckSignatureJob::DKIMStatus checkSignature(const MessageViewer::DKIMInfo &info); Q_REQUIRED_RESULT DKIMCheckSignatureJob::DKIMError error() const; Q_REQUIRED_RESULT KMime::Message::Ptr message() const; void setMessage(const KMime::Message::Ptr &message); Q_REQUIRED_RESULT DKIMCheckSignatureJob::DKIMWarning warning() const; void setWarning(const DKIMWarning &warning); Q_REQUIRED_RESULT QString headerCanonizationResult() const; Q_REQUIRED_RESULT QString bodyCanonizationResult() const; Q_REQUIRED_RESULT Akonadi::Item item() const; void setItem(const Akonadi::Item &item); Q_SIGNALS: void result(const MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult &checkResult); void storeKey(const QString &key, const QString &domain, const QString &selector); private: void downloadKey(const DKIMInfo &info); void slotDownloadKeyDone(const QList &lst, const QString &domain, const QString &selector); void parseDKIMKeyRecord(const QString &str, const QString &domain, const QString &selector, bool storeKeyValue = true); Q_REQUIRED_RESULT QString headerCanonizationSimple() const; Q_REQUIRED_RESULT QString headerCanonizationRelaxed() const; Q_REQUIRED_RESULT QString bodyCanonizationRelaxed() const; Q_REQUIRED_RESULT QString bodyCanonizationSimple() const; Q_REQUIRED_RESULT MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult createCheckResult(); void verifyRSASignature(); KMime::Message::Ptr mMessage; Akonadi::Item mMessageItem; DKIMInfo mDkimInfo; DKIMKeyRecord mDkimKeyRecord; QString mDkimValue; QString mHeaderCanonizationResult; QString mBodyCanonizationResult; DKIMCheckSignatureJob::DKIMError mError = DKIMCheckSignatureJob::DKIMError::Any; DKIMCheckSignatureJob::DKIMWarning mWarning = DKIMCheckSignatureJob::DKIMWarning::Any; DKIMCheckSignatureJob::DKIMStatus mStatus = DKIMCheckSignatureJob::DKIMStatus::Unknown; }; } #endif // DKIMCHECKSIGNATUREJOB_H diff --git a/messageviewer/src/dkim-verify/dkimmanager.cpp b/messageviewer/src/dkim-verify/dkimmanager.cpp index e234dbc8..29846fe5 100644 --- a/messageviewer/src/dkim-verify/dkimmanager.cpp +++ b/messageviewer/src/dkim-verify/dkimmanager.cpp @@ -1,95 +1,100 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "dkimmanager.h" #include "dkimmanagerkey.h" #include "dkimresultattribute.h" #include "dkimstoreresultjob.h" #include "settings/messageviewersettings.h" #include using namespace MessageViewer; DKIMManager::DKIMManager(QObject *parent) : QObject(parent) { Akonadi::AttributeFactory::registerAttribute(); } DKIMManager::~DKIMManager() { } DKIMManager *DKIMManager::self() { static DKIMManager s_self; return &s_self; } void DKIMManager::checkDKim(const Akonadi::Item &item) { if (MessageViewer::MessageViewerSettings::self()->saveDkimResult()) { if (item.hasAttribute()) { const MessageViewer::DKIMResultAttribute *const attr = item.attribute(); if (attr) { DKIMCheckSignatureJob::CheckSignatureResult checkResult; checkResult.item = item; checkResult.error = static_cast(attr->error()); checkResult.warning = static_cast(attr->warning()); checkResult.status = static_cast(attr->status()); qDebug() << "result : status " << (int)checkResult.status << " error : " << (int)checkResult.error << " warning " << (int)checkResult.warning; Q_EMIT result(checkResult); return; } } } DKIMCheckSignatureJob *job = new DKIMCheckSignatureJob(this); connect(job, &DKIMCheckSignatureJob::storeKey, this, &DKIMManager::storeKey); connect(job, &DKIMCheckSignatureJob::result, this, &DKIMManager::slotResult); job->setItem(item); job->start(); } +void DKIMManager::clearInfoWidget() +{ + Q_EMIT clearInfo(); +} + void DKIMManager::checkDKim(const KMime::Message::Ptr &message) { DKIMCheckSignatureJob *job = new DKIMCheckSignatureJob(this); connect(job, &DKIMCheckSignatureJob::storeKey, this, &DKIMManager::storeKey); connect(job, &DKIMCheckSignatureJob::result, this, &DKIMManager::slotResult); job->setMessage(message); job->start(); } void DKIMManager::storeKey(const QString &key, const QString &domain, const QString &selector) { if (MessageViewer::MessageViewerSettings::self()->saveKey()) { const MessageViewer::KeyInfo info {key, selector, domain}; MessageViewer::DKIMManagerKey::self()->addKey(info); } } void DKIMManager::slotResult(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult) { if (MessageViewer::MessageViewerSettings::self()->saveDkimResult()) { DKIMStoreResultJob *job = new DKIMStoreResultJob(this); job->setResult(checkResult); job->start(); } qDebug() << "result : status " << (int)checkResult.status << " error : " << (int)checkResult.error << " warning " << (int)checkResult.warning; Q_EMIT result(checkResult); } diff --git a/messageviewer/src/dkim-verify/dkimmanager.h b/messageviewer/src/dkim-verify/dkimmanager.h index cb6f3b39..330b9382 100644 --- a/messageviewer/src/dkim-verify/dkimmanager.h +++ b/messageviewer/src/dkim-verify/dkimmanager.h @@ -1,49 +1,51 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DKIMMANAGER_H #define DKIMMANAGER_H #include #include "messageviewer_export.h" #include "dkimchecksignaturejob.h" #include #include namespace MessageViewer { class MESSAGEVIEWER_EXPORT DKIMManager : public QObject { Q_OBJECT public: explicit DKIMManager(QObject *parent = nullptr); ~DKIMManager(); static DKIMManager *self(); void checkDKim(const KMime::Message::Ptr &message); void checkDKim(const Akonadi::Item &item); + void clearInfoWidget(); + Q_SIGNALS: void result(const MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult &checkResult); - + void clearInfo(); private: void storeKey(const QString &key, const QString &domain, const QString &selector); void slotResult(const MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult &checkResult); }; } #endif // DKIMMANAGER_H diff --git a/messageviewer/src/dkim-verify/dkimwidgetinfo.cpp b/messageviewer/src/dkim-verify/dkimwidgetinfo.cpp index 2101d735..d7843322 100644 --- a/messageviewer/src/dkim-verify/dkimwidgetinfo.cpp +++ b/messageviewer/src/dkim-verify/dkimwidgetinfo.cpp @@ -1,125 +1,133 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "dkimwidgetinfo.h" +#include "dkimmanager.h" #include #include #include using namespace MessageViewer; DKIMWidgetInfo::DKIMWidgetInfo(QWidget *parent) : QWidget(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setObjectName(QStringLiteral("mainLayout")); mainLayout->setContentsMargins(0, 0, 0, 0); mLabel = new QLabel(this); mLabel->setObjectName(QStringLiteral("label")); mainLayout->addWidget(mLabel); + connect(DKIMManager::self(), &DKIMManager::result, this, &DKIMWidgetInfo::setResult); + connect(DKIMManager::self(), &DKIMManager::clearInfo, this, &DKIMWidgetInfo::clear); } DKIMWidgetInfo::~DKIMWidgetInfo() { } void DKIMWidgetInfo::setResult(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult) { if (mResult != checkResult) { mResult = checkResult; updateInfo(); } } +void DKIMWidgetInfo::clear() +{ + mLabel->clear(); +} + void DKIMWidgetInfo::updateInfo() { switch (mResult.status) { case DKIMCheckSignatureJob::DKIMStatus::Unknown: mLabel->setText(i18n("Unknown")); break; case DKIMCheckSignatureJob::DKIMStatus::Valid: mLabel->setText(i18n("KDIM: valid")); break; case DKIMCheckSignatureJob::DKIMStatus::Invalid: mLabel->setText(i18n("KDIM: invalid")); break; case DKIMCheckSignatureJob::DKIMStatus::EmailNotSigned: mLabel->setText(i18n("KDIM: Unsigned")); break; } updateToolTip(); } void DKIMWidgetInfo::updateToolTip() { QString tooltip; if (mResult.status == DKIMCheckSignatureJob::DKIMStatus::Invalid) { switch (mResult.error) { case DKIMCheckSignatureJob::DKIMError::Any: break; case DKIMCheckSignatureJob::DKIMError::CorruptedBodyHash: tooltip = i18n("Body Hash was corrupted."); break; case DKIMCheckSignatureJob::DKIMError::DomainNotExist: break; case DKIMCheckSignatureJob::DKIMError::MissingFrom: tooltip = i18n("Missing header From."); break; case DKIMCheckSignatureJob::DKIMError::MissingSignature: tooltip = i18n("Missing signature."); break; case DKIMCheckSignatureJob::DKIMError::InvalidQueryMethod: break; case DKIMCheckSignatureJob::DKIMError::InvalidHeaderCanonicalization: break; case DKIMCheckSignatureJob::DKIMError::InvalidBodyCanonicalization: break; case DKIMCheckSignatureJob::DKIMError::InvalidBodyHashAlgorithm: break; case DKIMCheckSignatureJob::DKIMError::InvalidSignAlgorithm: break; case DKIMCheckSignatureJob::DKIMError::PublicKeyWasRevoked: tooltip = i18n("The public key was revoked."); break; case DKIMCheckSignatureJob::DKIMError::SignatureTooLarge: break; case DKIMCheckSignatureJob::DKIMError::InsupportedHashAlgorithm: tooltip = i18n("Hash Algorithm is unsupported."); break; case DKIMCheckSignatureJob::DKIMError::PublicKeyTooSmall: break; case DKIMCheckSignatureJob::DKIMError::ImpossibleToVerifySignature: break; } } switch (mResult.warning) { case DKIMCheckSignatureJob::DKIMWarning::Any: break; case DKIMCheckSignatureJob::DKIMWarning::SignatureExpired: tooltip = i18n("Signature expired"); break; case DKIMCheckSignatureJob::DKIMWarning::SignatureCreatedInFuture: tooltip = i18n("Signature created in the future"); break; case DKIMCheckSignatureJob::DKIMWarning::SignatureTooSmall: tooltip = i18n("Signature too small"); break; } mLabel->setToolTip(tooltip); } diff --git a/messageviewer/src/dkim-verify/dkimwidgetinfo.h b/messageviewer/src/dkim-verify/dkimwidgetinfo.h index 428455e8..a4044225 100644 --- a/messageviewer/src/dkim-verify/dkimwidgetinfo.h +++ b/messageviewer/src/dkim-verify/dkimwidgetinfo.h @@ -1,43 +1,44 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DKIMWIDGETINFO_H #define DKIMWIDGETINFO_H #include #include "dkimchecksignaturejob.h" -#include "messageviewer_private_export.h" +#include "messageviewer_export.h" class QLabel; namespace MessageViewer { -class MESSAGEVIEWER_TESTS_EXPORT DKIMWidgetInfo : public QWidget +class MESSAGEVIEWER_EXPORT DKIMWidgetInfo : public QWidget { Q_OBJECT public: explicit DKIMWidgetInfo(QWidget *parent = nullptr); ~DKIMWidgetInfo(); void setResult(const MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult &checkResult); + void clear(); private: void updateInfo(); void updateToolTip(); MessageViewer::DKIMCheckSignatureJob::CheckSignatureResult mResult; QLabel *mLabel = nullptr; }; } #endif // DKIMWIDGETINFO_H