diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt
index ed85bcfd0..db0e56985 100644
--- a/src/shell/CMakeLists.txt
+++ b/src/shell/CMakeLists.txt
@@ -11,12 +11,14 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)
+find_package(Qt5DBus REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(KF5CoreAddons REQUIRED)
find_package(KF5Crash REQUIRED)
find_package(KF5Solid REQUIRED)
find_package(KF5Activities REQUIRED)
+
set(scripting_SRC
scripting/appinterface.cpp
scripting/applet.cpp
@@ -31,6 +33,9 @@ set(scripting_SRC
scripting/widget.cpp
)
+set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml)
+qt5_add_dbus_adaptor(scripting_SRC ${plasmashell_dbusXML} shellcorona.h ShellCorona plasmashelladaptor)
+
add_executable(plasma-shell
activity.cpp
main.cpp
@@ -52,6 +57,7 @@ add_executable(plasma-shell
target_link_libraries(plasma-shell
Qt5::Quick
Qt5::Qml
+ Qt5::DBus
KF5::KIOCore
KF5::WindowSystem
KF5::CoreAddons
@@ -77,5 +83,6 @@ endif()
install(TARGETS plasma-shell ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES plasma-shell.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
+install( FILES dbus/org.kde.PlasmaShell.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
add_subdirectory(widgetexplorer)
diff --git a/src/shell/dbus/org.kde.PlasmaShell.xml b/src/shell/dbus/org.kde.PlasmaShell.xml
new file mode 100644
index 000000000..0b2652680
--- /dev/null
+++ b/src/shell/dbus/org.kde.PlasmaShell.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/shell/desktopview.cpp b/src/shell/desktopview.cpp
index 203f71813..e2e075d2f 100644
--- a/src/shell/desktopview.cpp
+++ b/src/shell/desktopview.cpp
@@ -32,7 +32,8 @@
DesktopView::DesktopView(ShellCorona *corona, QScreen *screen)
: PlasmaQuick::View(corona, 0),
m_stayBehind(false),
- m_fillScreen(false)
+ m_fillScreen(false),
+ m_dashboardShown(false)
{
setScreen(screen);
engine()->rootContext()->setContextProperty("desktop", this);
@@ -116,6 +117,13 @@ void DesktopView::setDashboardShown(bool shown)
wpGraphicObject->setProperty("opacity", 1);
}
}
+
+ m_dashboardShown = shown;
+}
+
+bool DesktopView::isDashboardShown() const
+{
+ return m_dashboardShown;
}
diff --git a/src/shell/desktopview.h b/src/shell/desktopview.h
index 21848fca8..01d81b4ef 100644
--- a/src/shell/desktopview.h
+++ b/src/shell/desktopview.h
@@ -43,6 +43,7 @@ public:
void setFillScreen(bool fillScreen);
void setDashboardShown(bool shown);
+ bool isDashboardShown() const;
protected Q_SLOTS:
/**
@@ -58,6 +59,7 @@ private:
QPointer m_configView;
bool m_stayBehind : 1;
bool m_fillScreen : 1;
+ bool m_dashboardShown : 1;
};
#endif // DESKTOVIEW_H
diff --git a/src/shell/shellcorona.cpp b/src/shell/shellcorona.cpp
index 6e4b8a6b0..e84e0bf20 100644
--- a/src/shell/shellcorona.cpp
+++ b/src/shell/shellcorona.cpp
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
@@ -48,6 +49,8 @@
#include "shellpluginloader.h"
#include "osd.h"
+#include "plasmashelladaptor.h"
+
static const int s_configSyncDelay = 10000; // 10 seconds
class ShellCorona::Private {
@@ -99,6 +102,14 @@ ShellCorona::ShellCorona(QObject *parent)
{
d->desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
+ //new PlasmaShellAdaptor(this);
+
+ new PlasmaShellAdaptor(this);
+
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.registerObject(QStringLiteral("/PlasmaShell"), this);
+
+
// Look for theme config in plasmarc, if it isn't configured, take the theme from the
// LookAndFeel package, if either is set, change the default theme
@@ -456,6 +467,23 @@ void ShellCorona::setDashboardShown(bool show)
}
}
+void ShellCorona::toggleDashboard()
+{
+ foreach (DesktopView *view, d->views) {
+ view->setDashboardShown(!view->isDashboardShown());
+ }
+}
+
+void ShellCorona::showInteractiveConsole()
+{
+
+}
+
+void ShellCorona::loadScriptInInteractiveConsole(const QString &script)
+{
+
+}
+
void ShellCorona::checkActivities()
{
KActivities::Consumer::ServiceStatus status = d->activityController->serviceStatus();
diff --git a/src/shell/shellcorona.h b/src/shell/shellcorona.h
index 2094733f8..1e89c5385 100644
--- a/src/shell/shellcorona.h
+++ b/src/shell/shellcorona.h
@@ -45,6 +45,7 @@ class ShellCorona : public Plasma::Corona
{
Q_OBJECT
Q_PROPERTY(QString shell READ shell WRITE setShell)
+ Q_CLASSINFO("D-Bus Interface", "org.kde.PlasmaShell")
public:
explicit ShellCorona(QObject * parent = 0);
@@ -84,6 +85,12 @@ public Q_SLOTS:
*/
QString shell() const;
+ ///DBUS methods
+ void toggleDashboard();
+ void setDashboardShown(bool show);
+ void showInteractiveConsole();
+ void loadScriptInInteractiveConsole(const QString &script);
+
protected Q_SLOTS:
void screenAdded(QScreen *screen);
void screenRemoved(QObject *screen);
@@ -116,7 +123,6 @@ private Q_SLOTS:
void toggleWidgetExplorer();
void toggleActivityManager();
void syncAppConfig();
- void setDashboardShown(bool show);
void checkActivities();
void currentActivityChanged(const QString &newActivity);
void activityAdded(const QString &id);