Commit 2847f399 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add code from syntax-highlighting but it crashs for the moment. I need to investigate it

parent 48af0c03
......@@ -241,6 +241,9 @@ if (WIN32)
else()
target_link_libraries(KF5MessageViewer PUBLIC KF5::Gpgmepp-pthread)
endif()
if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
target_link_libraries(KF5MessageViewer PRIVATE KF5::SyntaxHighlighting)
endif()
set_target_properties(KF5MessageViewer PROPERTIES
VERSION ${MESSAGEVIEWER_VERSION_STRING}
......
......@@ -26,6 +26,14 @@ using namespace MessageViewer;
#include "findbar/findbarsourceview.h"
#include <kpimtextedit/htmlhighlighter.h>
#include "kpimtextedit/slidecontainer.h"
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <SyntaxHighlighting/Repository>
#include <SyntaxHighlighting/SyntaxHighlighter>
#include <SyntaxHighlighting/Definition>
#include <SyntaxHighlighting/Theme>
#endif
#include "PimCommon/PimUtil"
#include <kiconloader.h>
#include <KLocalizedString>
......@@ -62,7 +70,23 @@ 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"));
#if 0 //Disable for the moment.
#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
SyntaxHighlighting::Repository repo;
SyntaxHighlighting::Definition def;
def = repo.definitionForName(QStringLiteral("HTML"));
SyntaxHighlighting::SyntaxHighlighter *hl = new SyntaxHighlighting::SyntaxHighlighter(mHtmlBrowser->textBrowser()->document());
hl->setTheme((palette().color(QPalette::Base).lightness() < 128)
? repo.theme(QLatin1String("Breeze Dark"))
: repo.theme(QLatin1String("Default")));
hl->setDefinition(def);
#else
new KPIMTextEdit::HtmlHighlighter(mHtmlBrowser->textBrowser()->document());
#endif
#else
new KPIMTextEdit::HtmlHighlighter(mHtmlBrowser->textBrowser()->document());
#endif
mTabWidget->setCurrentIndex(0);
#else
......
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