diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6628a7c..9d04bee 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,194 +1,190 @@ # SPDX-FileCopyrightText: 2023 Carl Schwan # SPDX-License-Identifier: BSD-3-Clause ecm_setup_version(PROJECT VARIABLE_PREFIX MIMETREEPARSER_CORE VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_core_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCoreConfigVersion.cmake" SOVERSION 5 ) # private library add_library(mimetreeparserprivate STATIC) set_target_properties(mimetreeparserprivate PROPERTIES POSITION_INDEPENDENT_CODE ON) target_sources(mimetreeparserprivate PUBLIC messagepart.h messagepart.cpp crypto.h crypto.cpp cryptohelper.h cryptohelper.cpp utils.h utils.cpp ) target_link_libraries(mimetreeparserprivate PUBLIC KPim${KF_MAJOR_VERSION}::Mime KF${KF_MAJOR_VERSION}::I18n Qt${KF_MAJOR_VERSION}::Gui KF${KF_MAJOR_VERSION}::Codecs Gpgme::Gpgme ) ecm_qt_declare_logging_category(mimetreeparserprivate HEADER mimetreeparser_core_debug.h IDENTIFIER MIMETREEPARSER_CORE_LOG CATEGORY_NAME org.kde.pim.mimetreeparser.core DESCRIPTION "mimetreeparser (pim lib)" EXPORT MIMETREEPARSERNG ) # public dynamic library add_library(KPim${KF_MAJOR_VERSION}MimeTreeParserCore) add_library(KPim${KF_MAJOR_VERSION}::MimeTreeParserCore ALIAS KPim${KF_MAJOR_VERSION}MimeTreeParserCore ) target_sources(KPim${KF_MAJOR_VERSION}MimeTreeParserCore PRIVATE errors.h async.h attachmentmodel.h bodypartformatter.h bodypartformatterbasefactory.h bodypartformatterbasefactory_p.h enums.h htmlutils.h mailcrypto.h messageparser.h - mimetreeparser_debug.h objecttreeparser.h partmetadata.h partmodel.h attachmentmodel.cpp bodypartformatter.cpp bodypartformatter_impl.cpp bodypartformatterbasefactory.cpp htmlutils.cpp mailcrypto.cpp messageparser.cpp - mimetreeparser_debug.cpp objecttreeparser.cpp partmodel.cpp ) if (COMPILE_WITH_UNITY_CMAKE_SUPPORT) set_target_properties(KPim${KF_MAJOR_VERSION}MimeTreeParserCore PROPERTIES UNITY_BUILD ON) endif() generate_export_header(KPim${KF_MAJOR_VERSION}MimeTreeParserCore BASE_NAME mimetreeparser_core) target_include_directories(KPim${KF_MAJOR_VERSION}MimeTreeParserCore INTERFACE "$") -target_include_directories(KPim${KF_MAJOR_VERSION}MimeTreeParserCore PUBLIC - "$") target_link_libraries(KPim${KF_MAJOR_VERSION}MimeTreeParserCore PUBLIC KPim${KF_MAJOR_VERSION}::Mime KF${KF_MAJOR_VERSION}::I18n Qt${KF_MAJOR_VERSION}::Gui PRIVATE mimetreeparserprivate ) set_target_properties(KPim${KF_MAJOR_VERSION}MimeTreeParserCore PROPERTIES VERSION ${MIMETREEPARSERNG_VERSION} SOVERSION ${MIMETREEPARSERNG_SOVERSION} EXPORT_NAME MimeTreeParserCore ) ecm_generate_pri_file(BASE_NAME MimeTreeParserCore LIB_NAME KPim${KF_MAJOR_VERSION}MimeTreeParserCore DEPS "MimeTreeParserCore" FILENAME_VAR PRI_FILENAME ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) install(TARGETS KPim${KF_MAJOR_VERSION}MimeTreeParserCore EXPORT KPim${KF_MAJOR_VERSION}MimeTreeParserCoreTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ) ecm_generate_headers(MimeTreeParserCore_CamelCase_HEADERS HEADER_NAMES AttachmentModel ObjectTreeParser MessageParser PartModel REQUIRED_HEADERS MimeTreeParserCore_HEADERS PREFIX MimeTreeParserCore ) install(FILES ${MimeTreeParserCore_CamelCase_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/MimeTreeParserCore/MimeTreeParserCore COMPONENT Devel ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_core_export.h ${MimeTreeParserCore_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/MimeTreeParserCore/mimetreeparsercore COMPONENT Devel ) if (BUILD_QCH) ecm_add_qch( KPim${KF_MAJOR_VERSION}MimeTreeParserCore_QCH NAME MimeTreeParserCore BASE_NAME KPim${KF_MAJOR_VERSION}MimeTreeParserCore VERSION ${PIM_VERSION} ORG_DOMAIN org.kde # using only public headers, to cover only public API SOURCES ${MimeTreeParser_HEADERS} MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md" LINK_QCHS Qt${QT_MAJOR_VERSION}Core_QCH INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} BLANK_MACROS MIMETREEPARSERCORE_EXPORT TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} COMPONENT Devel ) endif() ########### CMake Config Files ########### set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCore") if (BUILD_QCH) ecm_install_qch_export( TARGETS KPim${KF_MAJOR_VERSION}MimeTreeParserCore_QCH FILE KPim${KF_MAJOR_VERSION}MimeTreeParserCoreQchTargets.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCoreQchTargets.cmake\")") endif() configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KPimMimeTreeParserCoreConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCoreConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCoreConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserCoreConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KPim${KF_MAJOR_VERSION}MimeTreeParserCoreTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KPim${KF_MAJOR_VERSION}MimeTreeParserCoreTargets.cmake NAMESPACE KPim${KF_MAJOR_VERSION}:: ) if (BUILD_TESTING) add_subdirectory(autotests) endif() diff --git a/src/core/bodypartformatterbasefactory.cpp b/src/core/bodypartformatterbasefactory.cpp index 566ee3c..dc3adae 100644 --- a/src/core/bodypartformatterbasefactory.cpp +++ b/src/core/bodypartformatterbasefactory.cpp @@ -1,87 +1,87 @@ // SPDX-FileCopyrightText: 2004 Marc Mutz // SPDX-FileCopyrightText: 2004 Ingo Kloecker // SPDX-License-Identifier: GPL-2.0-or-later #include "bodypartformatterbasefactory.h" #include "bodypartformatter.h" #include "bodypartformatterbasefactory_p.h" -#include "mimetreeparser_debug.h" +#include "mimetreeparser_core_debug.h" #include using namespace MimeTreeParser; BodyPartFormatterBaseFactoryPrivate::BodyPartFormatterBaseFactoryPrivate(BodyPartFormatterBaseFactory *factory) : q(factory) { } BodyPartFormatterBaseFactoryPrivate::~BodyPartFormatterBaseFactoryPrivate() { } void BodyPartFormatterBaseFactoryPrivate::setup() { if (!all) { all = std::make_optional(); messageviewer_create_builtin_bodypart_formatters(); } } void BodyPartFormatterBaseFactoryPrivate::insert(const char *type, const char *subtype, Interface::BodyPartFormatter *formatter) { if (!type || !*type || !subtype || !*subtype || !formatter || !all) { return; } TypeRegistry::iterator type_it = all->find(type); if (type_it == all->end()) { type_it = all->insert(std::make_pair(type, SubtypeRegistry())).first; assert(type_it != all->end()); } SubtypeRegistry &subtype_reg = type_it->second; subtype_reg.insert(std::make_pair(subtype, formatter)); } BodyPartFormatterBaseFactory::BodyPartFormatterBaseFactory() : d(std::make_unique(this)) { } BodyPartFormatterBaseFactory::~BodyPartFormatterBaseFactory() = default; void BodyPartFormatterBaseFactory::insert(const char *type, const char *subtype, Interface::BodyPartFormatter *formatter) { d->insert(type, subtype, formatter); } const SubtypeRegistry &BodyPartFormatterBaseFactory::subtypeRegistry(const char *type) const { if (!type || !*type) { type = "*"; // krazy:exclude=doublequote_chars } d->setup(); assert(d->all); static SubtypeRegistry emptyRegistry; if (d->all->empty()) { return emptyRegistry; } TypeRegistry::const_iterator type_it = d->all->find(type); if (type_it == d->all->end()) { type_it = d->all->find("*"); } if (type_it == d->all->end()) { return emptyRegistry; } const SubtypeRegistry &subtype_reg = type_it->second; if (subtype_reg.empty()) { return emptyRegistry; } return subtype_reg; } diff --git a/src/quick/mimetreeparserplugin.cpp b/src/quick/mimetreeparserplugin.cpp index 48f581e..dcda064 100644 --- a/src/quick/mimetreeparserplugin.cpp +++ b/src/quick/mimetreeparserplugin.cpp @@ -1,25 +1,20 @@ // SPDX-FileCopyrightText: 2022 Carl Schwan // SPDX-License-Identifier: LGPL-2.0-or-later #include "mimetreeparserplugin.h" #include #include #include #include void MimeTreeParserPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QByteArray("org.kde.pim.mimetreeparser")); qmlRegisterModule(uri, 1, 0); qmlRegisterType(uri, 1, 0, "MessageParser"); qRegisterMetaType("PartModel::Types"); qmlRegisterUncreatableType(uri, 1, 0, "PartModel", QStringLiteral("not instanciated")); qmlRegisterUncreatableType(uri, 1, 0, "AttachmentModel", QStringLiteral("not instanciated")); } - -void MimeTreeParserPlugin::initializeEngine(QQmlEngine *engine, const char *uri) -{ - Q_UNUSED(uri); -} diff --git a/src/quick/mimetreeparserplugin.h b/src/quick/mimetreeparserplugin.h index b652ba4..0d1e798 100644 --- a/src/quick/mimetreeparserplugin.h +++ b/src/quick/mimetreeparserplugin.h @@ -1,16 +1,15 @@ // SPDX-FileCopyrightText: 2022 Carl Schwan // SPDX-License-Identifier: LGPL-2.0-or-later #pragma once #include class MimeTreeParserPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override; - void initializeEngine(QQmlEngine *engine, const char *uri) override; }; diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index f3ab571..d2ff548 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -1,146 +1,146 @@ # SPDX-FileCopyrightText: 2023 Carl Schwan # SPDX-License-Identifier: BSD-3-Clause ecm_setup_version(PROJECT VARIABLE_PREFIX MIMETREEPARSER_WIDGETS VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_widgets_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsConfigVersion.cmake" SOVERSION 5 ) add_library(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets) add_library(KPim${KF_MAJOR_VERSION}::MimeTreeParserWidgets ALIAS KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets) target_sources(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PRIVATE messageviewer.h messageviewer.cpp attachmentview_p.h attachmentview.cpp ) ecm_qt_declare_logging_category(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets HEADER mimetreeparser_widgets_debug.h IDENTIFIER MIMETREEPARSER_WIDGET_LOG CATEGORY_NAME org.kde.pim.mimetreeparser.widgets DESCRIPTION "mimetreeparser (pim lib)" EXPORT MIMETREEPARSER ) if (COMPILE_WITH_UNITY_CMAKE_SUPPORT) set_target_properties(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PROPERTIES UNITY_BUILD ON) endif() generate_export_header(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets BASE_NAME mimetreeparser_widgets) target_include_directories(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets INTERFACE "$") -target_include_directories(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PUBLIC "$") +target_include_directories(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PUBLIC "$") target_link_libraries(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PUBLIC Qt${KF_MAJOR_VERSION}::Widgets KPim${KF_MAJOR_VERSION}::MimeTreeParserCore PRIVATE KF${KF_MAJOR_VERSION}::Codecs KF${KF_MAJOR_VERSION}::I18n KF${KF_MAJOR_VERSION}::CalendarCore Gpgme::Gpgme ) set_target_properties(KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets PROPERTIES VERSION ${MIMETREEPARSER_VERSION} SOVERSION ${MIMETREEPARSER_SOVERSION} EXPORT_NAME MimeTreeParserWidgets ) ecm_generate_pri_file(BASE_NAME MimeTreeParserWidgets LIB_NAME KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets DEPS "MimeTreeParserWidgets" FILENAME_VAR PRI_FILENAME ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) install(TARGETS KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets EXPORT KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ) ecm_generate_headers(MimeTreeParserWidgets_CamelCase_HEADERS HEADER_NAMES MessageViewer REQUIRED_HEADERS MimeTreeParserWidgets_HEADERS PREFIX MimeTreeParserWidgets ) install(FILES ${MimeTreeParserWidgets_CamelCase_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/MimeTreeParserWidgets/MimeTreeParserWidgets COMPONENT Devel ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_widgets_export.h ${MimeTreeParserWidgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/MimeTreeParserWidgets/mimetreeparserwidgets COMPONENT Devel ) if (BUILD_QCH) ecm_add_qch( KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets_QCH NAME MimeTreeParserWidgets BASE_NAME KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets VERSION ${PIM_VERSION} ORG_DOMAIN org.kde # using only public headers, to cover only public API SOURCES ${MimeTreeParserWidget_HEADERS} MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md" LINK_QCHS Qt${QT_MAJOR_VERSION}Core_QCH INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} BLANK_MACROS MIMETREEPARSER_WIDGETS_EXPORT TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} COMPONENT Devel ) endif() ########### CMake Config Files ########### set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets") if (BUILD_QCH) ecm_install_qch_export( TARGETS KPim${KF_MAJOR_VERSION}MimeTreeParserWidgets_QCH FILE KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsQchTargets.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserQchTargets.cmake\")") endif() configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KPimMimeTreeParserWidgetsConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KPim${KF_MAJOR_VERSION}MimeTreeParserWidgetsTargets.cmake NAMESPACE KPim${KF_MAJOR_VERSION}:: ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_widgets_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim${KF_MAJOR_VERSION}/MimeTreeParserWidgets COMPONENT Devel )