Make ktexteditor an optional dependency
This commit is contained in:
parent
4152a12390
commit
4f784339b6
@ -17,7 +17,11 @@ find_package(KF5CoreAddons REQUIRED)
|
||||
find_package(KF5Crash REQUIRED)
|
||||
find_package(KF5Solid REQUIRED)
|
||||
find_package(KF5Activities REQUIRED)
|
||||
find_package(KF5TextEditor REQUIRED)
|
||||
find_package(KF5TextEditor) # not part of KF5.0
|
||||
|
||||
set(HAVE_KTEXTEDITOR ${KF5TextEditor_FOUND})
|
||||
|
||||
configure_file(config-ktexteditor.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ktexteditor.h )
|
||||
|
||||
|
||||
set(scripting_SRC
|
||||
@ -36,13 +40,12 @@ set(scripting_SRC
|
||||
set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml)
|
||||
qt5_add_dbus_adaptor(scripting_SRC ${plasmashell_dbusXML} shellcorona.h ShellCorona plasmashelladaptor)
|
||||
|
||||
add_executable(plasma-shell
|
||||
set (plasma_shell_SRCS
|
||||
activity.cpp
|
||||
main.cpp
|
||||
containmentconfigview.cpp
|
||||
currentcontainmentactionsmodel.cpp
|
||||
desktopview.cpp
|
||||
interactiveconsole.cpp
|
||||
kidenticongenerator.cpp
|
||||
panelview.cpp
|
||||
panelconfigview.cpp
|
||||
@ -54,6 +57,14 @@ add_executable(plasma-shell
|
||||
osd.cpp
|
||||
${scripting_SRC}
|
||||
)
|
||||
if (KF5TextEditor_FOUND)
|
||||
set (plasma_shell_SRCS ${plasma_shell_SRCS}
|
||||
interactiveconsole.cpp
|
||||
)
|
||||
endif()
|
||||
add_executable(plasma-shell
|
||||
${plasma_shell_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(plasma-shell
|
||||
Qt5::Quick
|
||||
@ -74,8 +85,10 @@ target_link_libraries(plasma-shell
|
||||
KF5::Activities
|
||||
KF5::GlobalAccel
|
||||
KF5::DBusAddons
|
||||
KF5::TextEditor
|
||||
)
|
||||
if (TARGET KF5::TextEditor)
|
||||
target_link_libraries(plasma-shell KF5::TextEditor)
|
||||
endif()
|
||||
target_include_directories(plasma-shell PRIVATE "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(HAVE_X11)
|
||||
|
2
src/shell/config-ktexteditor.h.cmake
Normal file
2
src/shell/config-ktexteditor.h.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
#cmakedefine01 HAVE_KTEXTEDITOR
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include <KAuthorized>
|
||||
#include <KWindowSystem>
|
||||
|
||||
#include "config-ktexteditor.h" // HAVE_KTEXTEDITOR
|
||||
|
||||
|
||||
#include "activity.h"
|
||||
#include "desktopview.h"
|
||||
@ -50,7 +52,9 @@
|
||||
#include "configview.h"
|
||||
#include "shellpluginloader.h"
|
||||
#include "osd.h"
|
||||
#if HAVE_KTEXTEDITOR
|
||||
#include "interactiveconsole.h"
|
||||
#endif
|
||||
|
||||
#include "plasmashelladaptor.h"
|
||||
|
||||
@ -88,7 +92,9 @@ public:
|
||||
QAction *addPanelAction;
|
||||
QMenu *addPanelsMenu;
|
||||
Plasma::Package lookNFeelPackage;
|
||||
#if HAVE_KTEXTEDITOR
|
||||
QWeakPointer<InteractiveConsole> console;
|
||||
#endif
|
||||
|
||||
QTimer waitingPanelsTimer;
|
||||
QTimer appConfigSyncTimer;
|
||||
@ -482,6 +488,7 @@ void ShellCorona::showInteractiveConsole()
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_KTEXTEDITOR
|
||||
InteractiveConsole *console = d->console.data();
|
||||
if (!console) {
|
||||
d->console = console = new InteractiveConsole(this);
|
||||
@ -492,14 +499,17 @@ void ShellCorona::showInteractiveConsole()
|
||||
console->show();
|
||||
console->raise();
|
||||
KWindowSystem::forceActiveWindow(console->winId());
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShellCorona::loadScriptInInteractiveConsole(const QString &script)
|
||||
{
|
||||
#if HAVE_KTEXTEDITOR
|
||||
showInteractiveConsole();
|
||||
if (d->console) {
|
||||
d->console.data()->loadScript(script);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShellCorona::checkActivities()
|
||||
|
Loading…
Reference in New Issue
Block a user