Commit 84ec8019 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

KF5 Porting, Exposing KTextEditor

Export KTextEditor so that it can be imported by other projects (such as
KDevelop :D).
Do some porting away from KDE4Support

REVIEW: 114462
parent 0d476b45
......@@ -26,6 +26,7 @@ include(KDECompilerSettings)
include(ECMOptionalAddSubdirectory)
include(ECMInstallIcons)
include(ECMSetupVersion)
find_package(Qt5Core REQUIRED NO_MODULE)
find_package(Qt5DBus REQUIRED NO_MODULE)
......@@ -37,7 +38,7 @@ find_package(Qt5Script REQUIRED NO_MODULE)
find_package(KF5 CONFIG REQUIRED
IdleTime ItemModels WidgetsAddons WindowSystem Codecs Archive CoreAddons Solid ThreadWeaver
Config Auth JS Wallet DBusAddons Sonnet
I18n GuiAddons Service ConfigWidgets ItemViews Notifications IconThemes Style Completion JobWidgets TextWidgets XmlGui Crash
I18n GuiAddons Service ConfigWidgets ItemViews Notifications IconThemes Style Completion JobWidgets TextWidgets GlobalAccel XmlGui Crash
Bookmarks UnitConversion KIO KCMUtils Parts NotifyConfig PrintUtils Su DocTools NewStuff )
find_package(KF5Declarative REQUIRED NO_MODULE)
......
......@@ -29,6 +29,7 @@
#include <kaboutdata.h>
#include <KStandardDirs>
#include <ktexteditor/view.h>
#include <ksharedconfig.h>
#include <kdebug.h>
#include <klineedit.h>
#include <kfiledialog.h>
......@@ -104,7 +105,7 @@ void KateBtBrowserPlugin::startIndexer()
indexer.cancel();
indexer.wait();
}
KConfigGroup cg(KGlobal::config(), "backtracebrowser");
KConfigGroup cg(KSharedConfig::config(), "backtracebrowser");
indexer.setSearchPaths(cg.readEntry("search-folders", QStringList()));
indexer.setFilter(cg.readEntry("file-extensions", fileExtensions));
indexer.start();
......
ecm_setup_version(5.0.0 VARIABLE_PREFIX KTEXTEDITOR
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ktexteditor_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KTextEditorConfigVersion.cmake")
# KTextEditor interface header
set(KTEXTEDITOR_PUBLIC_HEADERS
ktexteditor_export.h
......@@ -62,20 +66,45 @@ set(ktexteditor_LIB_SRCS
add_library (ktexteditor SHARED ${ktexteditor_LIB_SRCS} ${KTEXTEDITOR_PUBLIC_HEADERS})
target_link_libraries(ktexteditor
KF5::Parts
KF5::KDE4Support
)
target_link_libraries(ktexteditor LINK_PUBLIC KF5::Parts
LINK_PRIVATE KF5::I18n KF5::KDE4Support)
target_include_directories(ktexteditor INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>")
set_target_properties(ktexteditor
PROPERTIES VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
install(TARGETS ktexteditor EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS ktexteditor EXPORT KTextEditor ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install( FILES ${KTEXTEDITOR_PUBLIC_HEADERS}
DESTINATION ${INCLUDE_INSTALL_DIR}/ktexteditor COMPONENT Devel)
install( FILES ktexteditor.desktop ktexteditorplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
########### export targets ##############
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KTextEditor")
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KTextEditorConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KTextEditorConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KTextEditorConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KTextEditorConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KTextEditor DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KTextEditorTargets.cmake NAMESPACE KTextEditor:: )
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/ktexteditor_version.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
)
@PACKAGE_INIT@
find_dependency(KF5Parts "@KF5_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KTextEditorTargets.cmake")
......@@ -22,8 +22,9 @@
#define KDELIBS_KTEXTEDITOR_FACTORY_H
#include <ktexteditor/ktexteditor_export.h>
#include <kpluginfactory.h>
// our main baseclass of the KTextEditor::Document
#include <kparts/factory.h>
/**
* Namespace for the KDE Text Editor Interfaces.
......
......@@ -19,8 +19,6 @@
#include <QtDBus/QtDBus>
#include <KGlobal>
#include "cursor.h"
#include "configpage.h"
......@@ -50,7 +48,6 @@
#include "modeinterface.h"
#include <kparts/factory.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
......@@ -123,14 +120,22 @@ struct KTextEditorFactorySet : public QSet<KPluginFactory*>
KTextEditorFactorySet();
~KTextEditorFactorySet();
};
K_GLOBAL_STATIC(KTextEditorFactorySet, s_factories)
Q_GLOBAL_STATIC(KTextEditorFactorySet, s_factories)
static void cleanupFactories()
{
qDeleteAll(*s_factories);
s_factories->clear();
}
KTextEditorFactorySet::KTextEditorFactorySet() {
// K_GLOBAL_STATIC is cleaned up *after* Q(Core)Application is gone
// but we have to cleanup before -> use qAddPostRoutine
qAddPostRoutine(s_factories.destroy);
qAddPostRoutine(cleanupFactories);
}
KTextEditorFactorySet::~KTextEditorFactorySet() {
qRemovePostRoutine(s_factories.destroy); // post routine is installed!
qRemovePostRoutine(cleanupFactories); // post routine is installed!
qDeleteAll(*this);
}
......
......@@ -28,7 +28,7 @@
#include <kcalendarsystem.h>
#include <unistd.h>
#include <klibrary.h>
#include <KLocalizedString>
#include <klocalizedstring.h>
#define DUMMY_VALUE "!KTE:TEMPLATEHANDLER_DUMMY_VALUE!"
......
......@@ -25,6 +25,7 @@ Boston, MA 02110-1301, USA.
#include <QFileInfo>
#include <QTextCodec>
#include <KDebug>
#include <KGlobal>
#include <QLoggingCategory>
......
......@@ -29,6 +29,7 @@
#include <kiconloader.h>
#include <ktextedit.h>
#include "kcolorutils.h"
#include <kdebug.h>
#include "expandingdelegate.h"
#include "katepartdebug.h"
......
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