diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 35605b6cc..d36f2a386 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -1,6 +1,49 @@ -install(DIRECTORY qml/ DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/workspace/components) +project(plasmashellprivateplugin) + +add_definitions(-DTRANSLATION_DOMAIN=\"widgetexplorer\") -add_subdirectory(interactiveconsole) if (KF5TextEditor_FOUND) -add_subdirectory(widgetexplorer) -endif() + set(interactiveconsole_SRCS + interactiveconsole/interactiveconsole.cpp + ) +endif (KF5TextEditor_FOUND) + + +set(plasmashellprivateplugin_SRCS + widgetexplorer/kcategorizeditemsviewmodels.cpp + widgetexplorer/plasmaappletitemmodel.cpp + widgetexplorer/openwidgetassistant.cpp + widgetexplorer/widgetexplorer.cpp + shellprivateplugin.cpp + ${interactiveconsole_SRCS} +) + +add_library(plasmashellprivateplugin SHARED ${plasmashellprivateplugin_SRCS}) +target_link_libraries(plasmashellprivateplugin + Qt5::Core + Qt5::Quick + Qt5::Qml + Qt5::Gui + Qt5::Widgets + Qt5::Quick + Qt5::Qml + KF5::Plasma + KF5::PlasmaQuick + KF5::I18n + KF5::Service + KF5::NewStuff + KF5::KIOFileWidgets + KF5::WindowSystem +) + +if (KF5TextEditor_FOUND) + target_link_libraries(plasmashellprivateplugin + KF5::TextEditor) +endif (KF5TextEditor_FOUND) + +install(TARGETS plasmashellprivateplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell) +install(FILES widgetexplorer/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) + +install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell) +install(DIRECTORY qml/ DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/workspace/components) + diff --git a/components/interactiveconsole/CMakeLists.txt b/components/interactiveconsole/CMakeLists.txt deleted file mode 100644 index f33ee4d23..000000000 --- a/components/interactiveconsole/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -project(plasmainteractiveconsole) - -add_definitions(-DTRANSLATION_DOMAIN=\"interactiveconsole\") - -set(interactiveconsole_SRC - interactiveconsole.cpp - interactiveconsoleplugin.cpp -) - -add_library(plasmainteractiveconsole SHARED ${interactiveconsole_SRC}) -target_link_libraries(plasmainteractiveconsole - Qt5::Quick - Qt5::Script - Qt5::Widgets - KF5::Plasma - KF5::I18n - KF5::TextEditor) - -install(TARGETS plasmainteractiveconsole DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell) - diff --git a/components/interactiveconsole/interactiveconsole.h b/components/interactiveconsole/interactiveconsole.h index ba4d63c3d..a76afd74a 100644 --- a/components/interactiveconsole/interactiveconsole.h +++ b/components/interactiveconsole/interactiveconsole.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/components/interactiveconsole/interactiveconsoleplugin.cpp b/components/interactiveconsole/interactiveconsoleplugin.cpp deleted file mode 100644 index 7188e64bd..000000000 --- a/components/interactiveconsole/interactiveconsoleplugin.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2014 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "interactiveconsoleplugin.h" - -#include - -#include "interactiveconsole.h" - -void InteractiveConsolePlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.shell")); - qmlRegisterType(uri, 2, 0, "InteractiveConsole"); -} diff --git a/components/interactiveconsole/interactiveconsoleplugin.h b/components/interactiveconsole/interactiveconsoleplugin.h deleted file mode 100644 index 65ebda82b..000000000 --- a/components/interactiveconsole/interactiveconsoleplugin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2014 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef INTERACTIVECONSOLEPLUGIN -#define INTERACTIVECONSOLEPLUGIN - -#include - -class InteractiveConsolePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.kde.plasmashell.interactiveconsole") - -public: - void registerTypes(const char *uri); -}; - -#endif diff --git a/components/widgetexplorer/qmldir b/components/qmldir similarity index 51% rename from components/widgetexplorer/qmldir rename to components/qmldir index d808b18cf..6bdee3523 100644 --- a/components/widgetexplorer/qmldir +++ b/components/qmldir @@ -1,2 +1,2 @@ module org.kde.plasma.private.shell -plugin plasmawidgetexplorerplugin +plugin plasmashellprivateplugin diff --git a/components/widgetexplorer/widgetexplorerplugin.cpp b/components/shellprivateplugin.cpp similarity index 83% rename from components/widgetexplorer/widgetexplorerplugin.cpp rename to components/shellprivateplugin.cpp index f21178beb..c7b6166e9 100644 --- a/components/widgetexplorer/widgetexplorerplugin.cpp +++ b/components/shellprivateplugin.cpp @@ -20,17 +20,19 @@ THE SOFTWARE. */ -#include "widgetexplorerplugin.h" +#include "shellprivateplugin.h" #include -#include "widgetexplorer.h" +#include "widgetexplorer/widgetexplorer.h" +#include "interactiveconsole/interactiveconsole.h" #include -void WidgetExplorerPlugin::registerTypes(const char *uri) +void PlasmaShellPrivatePlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.shell")); qmlRegisterType(); qmlRegisterType(uri, 2, 0, "WidgetExplorer"); + qmlRegisterType(uri, 2, 0, "InteractiveConsoleWindow"); } diff --git a/components/widgetexplorer/widgetexplorerplugin.h b/components/shellprivateplugin.h similarity index 95% rename from components/widgetexplorer/widgetexplorerplugin.h rename to components/shellprivateplugin.h index 3ee262e52..9f9bf3da9 100644 --- a/components/widgetexplorer/widgetexplorerplugin.h +++ b/components/shellprivateplugin.h @@ -25,7 +25,7 @@ #include -class WidgetExplorerPlugin : public QQmlExtensionPlugin +class PlasmaShellPrivatePlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") diff --git a/components/widgetexplorer/CMakeLists.txt b/components/widgetexplorer/CMakeLists.txt deleted file mode 100644 index dd0ea9704..000000000 --- a/components/widgetexplorer/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -project(plasmawidgetexplorerplugin) - -add_definitions(-DTRANSLATION_DOMAIN=\"widgetexplorer\") - -set(widgetexplorer_SRC - kcategorizeditemsviewmodels.cpp - plasmaappletitemmodel.cpp - openwidgetassistant.cpp - widgetexplorer.cpp - widgetexplorerplugin.cpp -) - -add_library(plasmawidgetexplorerplugin SHARED ${widgetexplorer_SRC}) -target_link_libraries(plasmawidgetexplorerplugin - Qt5::Core - Qt5::Quick - Qt5::Qml - Qt5::Gui - Qt5::Widgets - Qt5::Quick - Qt5::Qml - KF5::Plasma - KF5::PlasmaQuick - KF5::I18n - KF5::Service - KF5::NewStuff - KF5::KIOFileWidgets - KF5::WindowSystem -) - -install(TARGETS plasmawidgetexplorerplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell) -install(FILES plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) - -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell) diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 81244946c..287dcefae 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -982,18 +982,27 @@ void ShellCorona::showInteractiveConsole() return; } + qDebug() << "GOT OUR CONSOLE!" << consoleQML; d->interactiveConsole = new KDeclarative::QmlObject(this); d->interactiveConsole->setInitializationDelayed(true); d->interactiveConsole->setSource(QUrl::fromLocalFile(consoleQML)); - d->interactiveConsole->completeInitialization(); - connect(d->interactiveConsole->rootObject(), SIGNAL(visibleChanged(bool)), - this, SLOT(interactiveConsoleVisibilityChanged(bool))); + QObject *engine = new WorkspaceScripting::ScriptEngine(this, d->interactiveConsole); d->interactiveConsole->engine()->rootContext()->setContextProperty("scriptEngine", engine); + + d->interactiveConsole->completeInitialization(); + if (d->interactiveConsole->rootObject()) { + connect(d->interactiveConsole->rootObject(), SIGNAL(visibleChanged(bool)), + this, SLOT(interactiveConsoleVisibilityChanged(bool))); + } } - d->interactiveConsole->rootObject()->setProperty("mode", "Desktop"); - d->interactiveConsole->rootObject()->setProperty("visible", true); + qDebug() << "Going in..." << d->interactiveConsole << d->interactiveConsole->rootObject(); + + if (d->interactiveConsole->rootObject()) { + d->interactiveConsole->rootObject()->setProperty("mode", "desktop"); + d->interactiveConsole->rootObject()->setProperty("visible", true); + } } void ShellCorona::loadScriptInInteractiveConsole(const QString &script)