diff --git a/CMakeLists.txt b/CMakeLists.txt index 43fedba..e8ba374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,91 +1,90 @@ cmake_minimum_required(VERSION 3.5) set(PIM_VERSION "5.11.42") project(pimcommon VERSION ${PIM_VERSION}) set(KF5_MIN_VERSION "5.57.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(LIBRARY_NAMELINK) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) include(ECMInstallIcons) set(PIMCOMMON_LIB_VERSION ${PIM_VERSION}) set(AKONADICONTACT_LIB_VERSION "5.11.40") set(LIBKDEPIM_LIB_VERSION "5.11.40") set(QT_REQUIRED_VERSION "5.10.0") set(KMIME_LIB_VERSION "5.11.40") set(KIMAP_LIB_VERSION "5.11.40") set(KCONTACTS_LIB_VERSION "5.11.40") set(KPIMTEXTEDIT_LIB_VERSION "5.11.40") set(AKONADI_VERSION "5.11.40") find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets DBus Network Test Xml PrintSupport) find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Codecs ${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(KF5CoreAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5JobWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5NewStuff ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IMAP ${KIMAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) -find_package(Grantlee5 "5.1" CONFIG REQUIRED) find_package(KF5Purpose ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DesignerPlugin ${KF5_MIN_VERSION} CONFIG) set_package_properties(KF5DesignerPlugin PROPERTIES DESCRIPTION "KF5 designer plugin" TYPE OPTIONAL) find_package(Xsltproc) set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces for all Akonadi resources.") if(BUILD_TESTING) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) add_definitions(-DBUILD_TESTING) endif(BUILD_TESTING) ########### Targets ########### # workaround for https://bugreports.qt.io/browse/QTBUG-74665 (bug in qt5.13 reevaluate it) if (${Qt5Widgets_VERSION} STREQUAL "5.13.0") MESSAGE(STATUS "Qt version: ${Qt5Widgets_VERSION} DISABLE compile without deprecated methods. bug QTBUG-74665") else() add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() add_definitions(-DQT_NO_FOREACH) add_subdirectory(src) install( FILES pimcommon.renamecategories pimcommon.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/pimcommon/CMakeLists.txt b/src/pimcommon/CMakeLists.txt index d49118e..af46044 100644 --- a/src/pimcommon/CMakeLists.txt +++ b/src/pimcommon/CMakeLists.txt @@ -1,440 +1,424 @@ set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5PimCommon") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5PimCommonConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5PimCommonConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ecm_setup_version(PROJECT VARIABLE_PREFIX PIMCOMMON VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/pimcommon_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PimCommonConfigVersion.cmake" SOVERSION 5 ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5PimCommonConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5PimCommonConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5PimCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5PimCommonTargets.cmake NAMESPACE KF5::) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pimcommon_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) set(libpimcommon_autocorrection_SRCS autocorrection/autocorrection.cpp autocorrection/autocorrectionwidget.cpp autocorrection/autocorrectionlistwidget.cpp autocorrection/autocorrectiontreewidget.cpp autocorrection/autocorrectionlanguage.cpp autocorrection/import/importlibreofficeautocorrection.cpp autocorrection/import/importkmailautocorrection.cpp autocorrection/import/importabstractautocorrection.cpp autocorrection/widgets/lineeditwithautocorrection.cpp autocorrection/widgets/richtexteditwithautocorrection.cpp ) set(libpimcommon_generericplugin_SRCS genericplugins/pluginutil.cpp genericplugins/genericpluginmanager.cpp genericplugins/genericplugin.cpp genericplugins/abstractgenericplugin.cpp genericplugins/abstractgenericplugininterface.cpp ) set(libpimcommon_configure_plugins_SRCS configureplugins/configurepluginslistwidget.cpp configureplugins/configurepluginswidget.cpp configureplugins/configureplugindialog.cpp ) set(libpimcommon_translator_SRCS translator/translatorutil.cpp translator/translatorwidget.cpp translator/translatordebugdialog.cpp translator/googletranslator.cpp ) set(libpimcommon_templatewidgets_SRCS templatewidgets/templatelistwidget.cpp templatewidgets/templateeditdialog.cpp templatewidgets/templatemanager.cpp ) set(libpimcommon_widgets_SRCS widgets/renamefiledialog.cpp widgets/simplestringlisteditor.cpp widgets/customtreeview.cpp widgets/configureimmutablewidgetutils.cpp widgets/kactionmenuchangecase.cpp widgets/spellchecklineedit.cpp widgets/kpimprintpreviewdialog.cpp widgets/lineeditwithcompleterng.cpp widgets/purposemenuwidget.cpp ) set(libpimcommon_customtools_SRCS customtools/customtoolsplugin.cpp customtools/customtoolspluginmanager.cpp customtools/customtoolswidgetng.cpp customtools/customtoolsviewinterface.cpp ) set(libpimcommon_util_SRCS util/pimutil.cpp util/networkutil.cpp ) set(libpimcommon_migrate_SRCS migration/migrateapplicationfiles.cpp migration/migratefileinfo.cpp ) set(libpimcommon_shareserviceurl_SRCS shareserviceurl/shareserviceurlmanager.cpp ) set(libpimcommon_logactivities_SRCS logactivities/logactivitiesmanager.cpp logactivities/logactivitiesdialog.cpp logactivities/logactivitieswidget.cpp logactivities/logactivitiespurposemenuwidget.cpp ) -set(libpimcommon_genericgrantlee_SRCS - genericgrantlee/genericgrantleeformatter.cpp - ) - set(libpimcommon_networkmanager_SRCS network/networkmanager.cpp ) set(libpimcommon_SRCS settings/pimcommonsettings.cpp ${libpimcommon_configure_plugins_SRCS} ${libpimcommon_networkmanager_SRCS} ${libpimcommon_configure_plugins_SRCS} - ${libpimcommon_genericgrantlee_SRCS} ${libpimcommon_shareserviceurl_SRCS} ${libpimcommon_migrate_SRCS} ${libpimcommon_util_SRCS} ${libpimcommon_texteditor_SRCS} ${libpimcommon_storageservice_SRCS} ${libpimcommon_autocorrection_SRCS} ${libpimcommon_translator_SRCS} ${libpimcommon_templatewidgets_SRCS} ${libpimcommon_widgets_SRCS} ${libpimcommon_customtools_SRCS} ${libpimcommon_logactivities_SRCS} ${libpimcommon_generericplugin_SRCS} ) qt5_add_resources(libpimcommon_SRCS widgets/icons.qrc) ecm_qt_declare_logging_category(libpimcommon_SRCS HEADER pimcommon_debug.h IDENTIFIER PIMCOMMON_LOG CATEGORY_NAME org.kde.pim.pimcommon) ki18n_wrap_ui(libpimcommon_SRCS autocorrection/ui/autocorrectionwidget.ui ) macro(add_resource_iface _kcfgFile _ifaceName _className _fileName) kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${_ifaceName}) qt5_add_dbus_interface(libpimcommon_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${_ifaceName}.xml ${_fileName} ${_className} ) endmacro() add_resource_iface(util/imapresource.kcfg org.kde.Akonadi.Imap.Settings ImapSettings imapresourcesettings) kconfig_add_kcfg_files(libpimcommon_SRCS settings/pimcommonsetting_base.kcfgc ) add_library(KF5PimCommon ${libpimcommon_SRCS}) generate_export_header(KF5PimCommon BASE_NAME pimcommon) add_library(KF5::PimCommon ALIAS KF5PimCommon) target_link_libraries(KF5PimCommon PUBLIC Qt5::Network KF5::KIOCore KF5::ConfigWidgets PRIVATE KF5::I18n KF5::Libkdepim KF5::Archive KF5::NewStuff KF5::PimTextEdit KF5::XmlGui KF5::PimTextEdit KF5::IconThemes KF5::Completion KF5::KIOWidgets Qt5::PrintSupport - Grantlee5::Templates KF5::Purpose KF5::PurposeWidgets ) target_include_directories(KF5PimCommon INTERFACE "$") target_include_directories(KF5PimCommon PUBLIC "$") set_target_properties(KF5PimCommon PROPERTIES VERSION ${PIMCOMMON_VERSION_STRING} SOVERSION ${PIMCOMMON_SOVERSION} EXPORT_NAME PimCommon ) install(TARGETS KF5PimCommon EXPORT KF5PimCommonTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) if (BUILD_TESTING) add_subdirectory(translator/autotests) add_subdirectory(autocorrection/autotests) add_subdirectory(widgets/autotests) add_subdirectory(migration/autotests) add_subdirectory(util/autotests) add_subdirectory(shareserviceurl/autotests) add_subdirectory(translator/tests) add_subdirectory(widgets/tests) add_subdirectory(autocorrection/tests) add_subdirectory(customtools/autotests) add_subdirectory(autotests) add_subdirectory(logactivities/autotests) add_subdirectory(logactivities/tests) add_subdirectory(configureplugins/autotests) add_subdirectory(genericplugins/autotests) endif() ecm_generate_headers(PimCommon_CamelCasegenericplugins_HEADERS HEADER_NAMES PluginUtil GenericPluginManager GenericPlugin AbstractGenericPlugin AbstractGenericPluginInterface REQUIRED_HEADERS PimCommon_genericplugins_HEADERS PREFIX PimCommon RELATIVE genericplugins ) -ecm_generate_headers(PimCommon_CamelCasegenericgrantlee_HEADERS - HEADER_NAMES - GenericGrantleeFormatter - REQUIRED_HEADERS PimCommon_genericgrantlee_HEADERS - PREFIX PimCommon - RELATIVE genericgrantlee - ) - ecm_generate_headers(PimCommon_CamelCasenetworkmanager_HEADERS HEADER_NAMES NetworkManager REQUIRED_HEADERS PimCommon_networkmanager_HEADERS PREFIX PimCommon RELATIVE network ) ecm_generate_headers(PimCommon_CamelCase_HEADERS HEADER_NAMES PimUtil NetworkUtil REQUIRED_HEADERS PimCommon_HEADERS PREFIX PimCommon RELATIVE util ) ecm_generate_headers(PimCommon_Camelcasesettings_HEADERS HEADER_NAMES PimCommonSettings REQUIRED_HEADERS PimCommon_settings_HEADERS PREFIX PimCommon RELATIVE settings ) ecm_generate_headers(PimCommon_Camelcaselogactivities_HEADERS HEADER_NAMES LogActivitiesManager REQUIRED_HEADERS PimCommon_logactivities_HEADERS PREFIX PimCommon RELATIVE logactivities ) ecm_generate_headers(PimCommon_Camelcaseshareserviceurl_HEADERS HEADER_NAMES ShareServiceUrlManager REQUIRED_HEADERS PimCommon_shareserviceurl_HEADERS PREFIX PimCommon RELATIVE shareserviceurl ) ecm_generate_headers(PimCommon_Camelcasetranslator_HEADERS HEADER_NAMES TranslatorWidget REQUIRED_HEADERS PimCommon_translator_HEADERS PREFIX PimCommon RELATIVE translator ) ecm_generate_headers(PimCommon_Camelcasecustomtools_HEADERS HEADER_NAMES CustomToolsWidgetng CustomToolsPlugin CustomToolsViewInterface CustomToolsPluginManager REQUIRED_HEADERS PimCommon_customtools_HEADERS PREFIX PimCommon RELATIVE customtools ) ecm_generate_headers(PimCommon_Camelcasemigrate_HEADERS HEADER_NAMES MigrateApplicationFiles MigrateFileInfo REQUIRED_HEADERS PimCommon_migrate_HEADERS PREFIX PimCommon RELATIVE migration ) ecm_generate_headers(PimCommon_Camelcaseautocorrectionwidgets_HEADERS HEADER_NAMES RichTexteditWithAutoCorrection LineEditWithAutoCorrection REQUIRED_HEADERS PimCommon_autocorrectionwidgets_HEADERS PREFIX PimCommon RELATIVE autocorrection/widgets/ ) ecm_generate_headers(PimCommon_Camelcaseautocorrection_HEADERS HEADER_NAMES AutoCorrectionWidget AutoCorrectionLanguage AutoCorrection REQUIRED_HEADERS PimCommon_autocorrection_HEADERS PREFIX PimCommon RELATIVE autocorrection/ ) ecm_generate_headers(PimCommon_Camelcasetemplatelist_HEADERS HEADER_NAMES TemplateListWidget TemplateManager REQUIRED_HEADERS PimCommon_templatelist_HEADERS PREFIX PimCommon RELATIVE templatewidgets ) ecm_generate_headers(PimCommon_Camelcasewidgets_HEADERS HEADER_NAMES CustomTreeView SpellCheckLineEdit ConfigureImmutableWidgetUtils RenameFileDialog SimpleStringListEditor KActionMenuChangeCase KPimPrintPreviewDialog LineEditWithCompleterNg PurposeMenuWidget REQUIRED_HEADERS PimCommon_widgets_HEADERS PREFIX PimCommon RELATIVE widgets ) ecm_generate_headers(PimCommon_Camelcaseconfigureplugins_HEADERS HEADER_NAMES ConfigurePluginsListWidget ConfigurePluginsWidget ConfigurePluginDialog REQUIRED_HEADERS PimCommon_configureplugins_HEADERS PREFIX PimCommon RELATIVE configureplugins ) ecm_generate_pri_file(BASE_NAME PimCommon LIB_NAME KF5PimCommon DEPS "Network KIOCore ConfigWidgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/PimCommon ) install(FILES ${PimCommon_Camelcaseconfigureplugins_HEADERS} ${PimCommon_CamelCasegenericplugins_HEADERS} ${PimCommon_Camelcaselogactivities_HEADERS} ${PimCommon_CamelCasenetworkmanager_HEADERS} ${PimCommon_CamelCase_HEADERS} - ${PimCommon_CamelCasegenericgrantlee_HEADERS} ${PimCommon_CamelCasejob_HEADERS} ${PimCommon_Camelcaseautocorrection_HEADERS} ${PimCommon_Camelcaseautocorrectionwidgets_HEADERS} ${PimCommon_Camelcasecustomtools_HEADERS} ${PimCommon_Camelcasemanagerserversidesubscription_HEADERS} ${PimCommon_Camelcasemigrate_HEADERS} ${PimCommon_Camelcaseplaintexteditor_HEADERS} ${PimCommon_Camelcaserichtexteditor_HEADERS} ${PimCommon_Camelcasescript_HEADERS} ${PimCommon_Camelcasesettings_HEADERS} ${PimCommon_Camelcaseshareserviceurl_HEADERS} ${PimCommon_Camelcasestorageservice_HEADERS} ${PimCommon_Camelcasestorageservicedialog_HEADERS} ${PimCommon_Camelcasestorageserviceinterface_HEADERS} ${PimCommon_Camelcasestorageservicesettings_HEADERS} ${PimCommon_Camelcasestorageservicewidgets_HEADERS} ${PimCommon_Camelcasetemplatelist_HEADERS} ${PimCommon_Camelcasetexteditor_commonwidget_HEADERS} ${PimCommon_Camelcasetranslator_HEADERS} ${PimCommon_Camelcasewidgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/PimCommon COMPONENT Devel ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/imapresourcesettings.h ${CMAKE_CURRENT_BINARY_DIR}/pimcommon_export.h ${CMAKE_CURRENT_BINARY_DIR}/pimcommonsetting_base.h ${PimCommon_HEADERS} ${PimCommon_genericplugins_HEADERS} ${PimCommon_configureplugins_HEADERS} ${PimCommon_networkmanager_HEADERS} ${PimCommon_autocorrection_HEADERS} ${PimCommon_autocorrectionwidgets_HEADERS} ${PimCommon_customtools_HEADERS} - ${PimCommon_genericgrantlee_HEADERS} ${PimCommon_job_HEADERS} ${PimCommon_managerserversidesubscription_HEADERS} ${PimCommon_migrate_HEADERS} ${PimCommon_plaintexteditor_HEADERS} ${PimCommon_richtexteditor_HEADERS} ${PimCommon_settings_HEADERS} ${PimCommon_shareserviceurl_HEADERS} ${PimCommon_storageservice_HEADERS} ${PimCommon_storageservicedialog_HEADERS} ${PimCommon_storageserviceinterface_HEADERS} ${PimCommon_storageservicesettings_HEADERS} ${PimCommon_storageservicewidgets_HEADERS} ${PimCommon_templatelist_HEADERS} ${PimCommon_texteditor_commonwidget_HEADERS} ${PimCommon_translator_HEADERS} ${PimCommon_widgets_HEADERS} ${PimCommon_logactivities_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/pimcommon COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) add_subdirectory(designer) diff --git a/src/pimcommon/genericgrantlee/genericgrantleeformatter.cpp b/src/pimcommon/genericgrantlee/genericgrantleeformatter.cpp deleted file mode 100644 index b5644b1..0000000 --- a/src/pimcommon/genericgrantlee/genericgrantleeformatter.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (c) 2016-2019 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "genericgrantleeformatter.h" - -#include - -using namespace PimCommon; - -class PimCommon::GenericGrantleeFormatterPrivate -{ -public: - GenericGrantleeFormatterPrivate() - : mEngine(new Grantlee::Engine) - { - } - - QString mThemePath; - QString mDefaultMainFile; - std::unique_ptr mEngine; - QString mErrorMessage; - QSharedPointer mTemplateLoader; - Grantlee::Template mTemplate; -}; - - -GenericGrantleeFormatter::GenericGrantleeFormatter(const QString &defaultHtmlMain, const QString &themePath, QObject *parent) - : QObject(parent) - , d(new PimCommon::GenericGrantleeFormatterPrivate) -{ - d->mThemePath = themePath; - d->mDefaultMainFile = defaultHtmlMain; - changeGrantleePath(d->mThemePath); -} - -GenericGrantleeFormatter::GenericGrantleeFormatter(QObject *parent) - : QObject(parent) - , d(new PimCommon::GenericGrantleeFormatterPrivate) -{ -} - -GenericGrantleeFormatter::~GenericGrantleeFormatter() = default; - -void GenericGrantleeFormatter::setDefaultHtmlMainFile(const QString &name) -{ - if (d->mDefaultMainFile != name) { - d->mDefaultMainFile = name; - refreshTemplate(); - } -} - -void GenericGrantleeFormatter::changeGrantleePath(const QString &path) -{ - if (!d->mTemplateLoader) { - d->mTemplateLoader.reset(new Grantlee::FileSystemTemplateLoader); - } - d->mTemplateLoader->setTemplateDirs(QStringList() << path); - d->mEngine->addTemplateLoader(d->mTemplateLoader); - - refreshTemplate(); -} - -QString GenericGrantleeFormatter::errorMessage() const -{ - return d->mErrorMessage; -} - -QString GenericGrantleeFormatter::render(const QVariantHash &mapping) const -{ - Grantlee::Context context(mapping); - const QString contentHtml = d->mTemplate->render(&context); - return contentHtml; -} - -void GenericGrantleeFormatter::setContent(const QString &content) -{ - d->mTemplate = d->mEngine->newTemplate(content, QStringLiteral("content")); - if (d->mTemplate->error()) { - d->mErrorMessage = d->mTemplate->errorString() + QLatin1String("
"); - } -} - -void GenericGrantleeFormatter::refreshTemplate() -{ - d->mTemplate = d->mEngine->loadByName(d->mDefaultMainFile); - if (d->mTemplate->error()) { - d->mErrorMessage += d->mTemplate->errorString() + QLatin1String("
"); - } -} diff --git a/src/pimcommon/genericgrantlee/genericgrantleeformatter.h b/src/pimcommon/genericgrantlee/genericgrantleeformatter.h deleted file mode 100644 index ae4806c..0000000 --- a/src/pimcommon/genericgrantlee/genericgrantleeformatter.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2016-2019 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef GENERICGRANTLEEFORMATTER_H -#define GENERICGRANTLEEFORMATTER_H - -#include "pimcommon_export.h" -#include -#include - -#include - -namespace PimCommon { -class GenericGrantleeFormatterPrivate; -class PIMCOMMON_EXPORT GenericGrantleeFormatter : public QObject -{ - Q_OBJECT -public: - explicit GenericGrantleeFormatter(QObject *parent = nullptr); - explicit GenericGrantleeFormatter(const QString &defaultHtmlMain, const QString &themePath, QObject *parent = nullptr); - ~GenericGrantleeFormatter(); - - void setDefaultHtmlMainFile(const QString &name); - - void changeGrantleePath(const QString &path); - Q_REQUIRED_RESULT QString errorMessage() const; - - Q_REQUIRED_RESULT QString render(const QVariantHash &mapping) const; - - //For debug - void setContent(const QString &content); - void refreshTemplate(); -private: - std::unique_ptr const d; -}; -} -#endif // GENERICGRANTLEEFORMATTER_H