Commit 0996f81c authored by Laurent Montel's avatar Laurent Montel 😁

Use ksyntaxhightling as default

parent 1da8e3e7
......@@ -4,7 +4,6 @@ project(Messagelib)
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_KF5SYNTAXHIGHLIGHTING_SUPPORT "Enable this feature if you want to use new kf5 syntax highlighting module." TRUE)
set(KF5_VERSION "5.28.0")
find_package(ECM ${KF5_VERSION} CONFIG REQUIRED)
......@@ -69,6 +68,7 @@ if (NOT ${MIMETREEPARSER_ONLY_BUILD})
find_package(KF5WidgetsAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5WindowSystem ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5SyntaxHighlighting ${KF5_VERSION} CONFIG REQUIRED)
find_package(Grantlee5 "5.1" CONFIG REQUIRED)
......@@ -91,15 +91,6 @@ if (NOT ${MIMETREEPARSER_ONLY_BUILD})
find_package(KF5AkonadiSearch "5.3.80" CONFIG REQUIRED)
set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi")
if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
find_package(KF5SyntaxHighlighting ${KF5_VERSION})
if (KF5SyntaxHighlighting_FOUND)
MESSAGE(STATUS "found KF5SyntaxHighlighting")
set(KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT true)
endif()
endif()
endif()
# Support for the GIT revision number in messagecomposer-version.h
......
......@@ -214,6 +214,7 @@ target_link_libraries(KF5MessageViewer
KF5::Libkleo
KF5::MimeTreeParser
PRIVATE
KF5::SyntaxHighlighting
KF5::ItemViews
Qt5::Network
Qt5::WebKitWidgets
......@@ -239,10 +240,6 @@ target_link_libraries(KF5MessageViewer
QGpgme
)
if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
target_link_libraries(KF5MessageViewer PRIVATE KF5::SyntaxHighlighting)
endif()
set_target_properties(KF5MessageViewer PROPERTIES
VERSION ${MESSAGEVIEWER_VERSION_STRING}
SOVERSION ${MESSAGEVIEWER_SOVERSION}
......
#cmakedefine HAVE_SYS_INOTIFY_H 1
#cmakedefine WEBENGINEVIEWER_PRINT_SUPPORT 1
#cmakedefine KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT 1
......@@ -26,13 +26,9 @@ using namespace MessageViewer;
#include "findbar/findbarsourceview.h"
#include "kpimtextedit/slidecontainer.h"
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <KSyntaxHighlighting/SyntaxHighlighter>
#include <KSyntaxHighlighting/Definition>
#include <KSyntaxHighlighting/Theme>
#else
#include <kpimtextedit/htmlhighlighter.h>
#endif
#include "PimCommon/PimUtil"
#include <kiconloader.h>
......@@ -70,7 +66,6 @@ MailSourceWebEngineViewer::MailSourceWebEngineViewer(QWidget *parent)
mHtmlBrowser = new MailSourceViewTextBrowserWidget(this);
mTabWidget->addTab(mHtmlBrowser, i18nc("Mail message as shown, in HTML format", "HTML Source"));
mTabWidget->setTabToolTip(1, i18n("HTML code for displaying the message to the user"));
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
KSyntaxHighlighting::Definition def;
def = mRepo.definitionForName(QStringLiteral("HTML"));
......@@ -79,9 +74,6 @@ MailSourceWebEngineViewer::MailSourceWebEngineViewer(QWidget *parent)
? mRepo.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme)
: mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
hl->setDefinition(def);
#else
new KPIMTextEdit::HtmlHighlighter(mHtmlBrowser->textBrowser()->document());
#endif
mTabWidget->setCurrentIndex(0);
#else
......
......@@ -25,9 +25,7 @@
class QTabWidget;
class QWebEnginePage;
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <KSyntaxHighlighting/Repository>
#endif
namespace MessageViewer
{
......@@ -44,9 +42,7 @@ public:
void setDisplayedSource(QWebEnginePage *page);
void setFixedFont();
private:
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
KSyntaxHighlighting::Repository mRepo;
#endif
MailSourceViewTextBrowserWidget *mRawBrowser;
FindBarSourceView *mFindBar;
#ifndef NDEBUG
......
Markdown is supported
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