summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-08 12:13:26 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-08 12:13:26 (GMT)
commit97b53f7d690aa1ced7ee7c0e94ae78e7a43d519a (patch)
tree445788347d26291097c7146fb2b30b5ea00a0b92
parent168d05f6e2d257eaf58a9d7ccf80cd7ab5ef377c (diff)
Now we use ksyntaxhightlighting
-rw-r--r--CMakeLists.txt9
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/config-kpimtextedit.h.cmake1
-rw-r--r--src/inserthtmldialog.h2
-rw-r--r--src/inserthtmleditor.cpp8
-rw-r--r--src/inserthtmleditor.h4
-rw-r--r--tests/CMakeLists.txt5
7 files changed, 3 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d835832..3895071 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,7 @@ find_package(KF5Sonnet ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
+find_package(KF5SyntaxHighlighting ${KF5_VERSION} CONFIG REQUIRED)
if (Qt5Designer_FOUND)
find_package(KF5DesignerPlugin ${KF5_VERSION} CONFIG REQUIRED)
@@ -76,15 +77,7 @@ else()
endif()
endif()
-option(KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT "Enable this feature if you want to use new kf5 syntax highlighting module." TRUE)
-if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
- find_package(KF5SyntaxHighlighting ${KF5_VERSION})
- if (KF5SyntaxHighlighting_FOUND)
- MESSAGE(STATUS "found KF5SyntaxHighlighting")
- set(KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT true)
- endif()
-endif()
########### Targets ###########
add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 42923d2..3ed69c1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -88,16 +88,13 @@ target_link_libraries(KF5PimTextEdit
Grantlee5::TextDocument
KF5::XmlGui
KF5::I18n
+ KF5::SyntaxHighlighting
)
if(KPIMTEXTEDIT_HAVE_TEXTTOSPEECH)
target_link_libraries(KF5PimTextEdit PRIVATE Qt5::TextToSpeech)
endif()
-if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
- target_link_libraries(KF5PimTextEdit PRIVATE KF5::SyntaxHighlighting)
-endif()
-
set_target_properties(KF5PimTextEdit PROPERTIES
VERSION ${KPIMTEXTEDIT_VERSION_STRING}
SOVERSION ${KPIMTEXTEDIT_SOVERSION}
diff --git a/src/config-kpimtextedit.h.cmake b/src/config-kpimtextedit.h.cmake
index fd8a0be..fadbc68 100644
--- a/src/config-kpimtextedit.h.cmake
+++ b/src/config-kpimtextedit.h.cmake
@@ -1,4 +1,3 @@
/* config-kpimtextedit.h. Generated by cmake from config-kpimtextedit.h.cmake */
#cmakedefine01 KPIMTEXTEDIT_HAVE_TEXTTOSPEECH
-#cmakedefine KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT 1
diff --git a/src/inserthtmldialog.h b/src/inserthtmldialog.h
index b98e7e2..8d41838 100644
--- a/src/inserthtmldialog.h
+++ b/src/inserthtmldialog.h
@@ -26,9 +26,7 @@
#include "kpimtextedit_export.h"
#include "kpimtextedit/plaintexteditor.h"
-#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <KSyntaxHighlighting/Repository>
-#endif
namespace KPIMTextEdit
{
diff --git a/src/inserthtmleditor.cpp b/src/inserthtmleditor.cpp
index 80b3b57..729f3e9 100644
--- a/src/inserthtmleditor.cpp
+++ b/src/inserthtmleditor.cpp
@@ -21,13 +21,9 @@
#include "inserthtmleditor.h"
#include "texteditorcompleter.h"
-#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <KSyntaxHighlighting/SyntaxHighlighter>
#include <KSyntaxHighlighting/Definition>
#include <KSyntaxHighlighting/Theme>
-#else
-#include "htmlhighlighter.h"
-#endif
#include <QStringList>
#include <QCompleter>
@@ -38,7 +34,6 @@ using namespace KPIMTextEdit;
InsertHtmlEditor::InsertHtmlEditor(QWidget *parent)
: KPIMTextEdit::PlainTextEditor(parent)
{
-#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
KSyntaxHighlighting::Definition def;
def = mRepo.definitionForName(QStringLiteral("HTML"));
@@ -47,9 +42,6 @@ InsertHtmlEditor::InsertHtmlEditor(QWidget *parent)
? mRepo.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme)
: mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
hl->setDefinition(def);
-#else
- new KPIMTextEdit::HtmlHighlighter(document());
-#endif
setFocus();
mTextEditorCompleter = new KPIMTextEdit::TextEditorCompleter(this, this);
QStringList completerList;
diff --git a/src/inserthtmleditor.h b/src/inserthtmleditor.h
index f9cb415..7fe851f 100644
--- a/src/inserthtmleditor.h
+++ b/src/inserthtmleditor.h
@@ -25,9 +25,7 @@
#include <QWidget>
#include "kpimtextedit/plaintexteditor.h"
-#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
#include <KSyntaxHighlighting/Repository>
-#endif
namespace KPIMTextEdit
{
@@ -42,9 +40,7 @@ protected:
void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
private:
KPIMTextEdit::TextEditorCompleter *mTextEditorCompleter;
-#ifdef KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT
KSyntaxHighlighting::Repository mRepo;
-#endif
};
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3767b78..5b1479c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,10 +1,7 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/../src)
add_executable(inserthtmldialog_demo inserthtmldialog_demo.cpp)
-set(inserthtmldialog_demo_LIBS KF5PimTextEdit Qt5::Widgets)
-if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
- set(inserthtmldialog_demo_LIBS ${inserthtmldialog_demo_LIBS} KF5::SyntaxHighlighting)
-endif()
+set(inserthtmldialog_demo_LIBS KF5PimTextEdit Qt5::Widgets KF5::SyntaxHighlighting)
target_link_libraries(inserthtmldialog_demo ${inserthtmldialog_demo_LIBS})
set(slidecontainer_gui_SRCS slidecontainer_gui.cpp)