restore dbus interface for dashboard

restore old feature from plasma1
This commit is contained in:
Marco Martin 2014-02-25 17:48:10 +01:00
parent 449e659ded
commit 359dd09c5d
6 changed files with 68 additions and 2 deletions

View File

@ -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)

View File

@ -0,0 +1,15 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.PlasmaShell">
<method name="toggleDashboard">
</method>
<method name="setDashboardShown">
<arg name="show" type="b" direction="in"/>
</method>
<method name="showInteractiveConsole">
</method>
<method name="loadScriptInInteractiveConsole">
<arg name="script" type="s" direction="in"/>
</method>
</interface>
</node>

View File

@ -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;
}

View File

@ -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<PlasmaQuick::ConfigView> m_configView;
bool m_stayBehind : 1;
bool m_fillScreen : 1;
bool m_dashboardShown : 1;
};
#endif // DESKTOVIEW_H

View File

@ -27,6 +27,7 @@
#include <QDesktopWidget>
#include <QQmlContext>
#include <QTimer>
#include <QDBusConnection>
#include <kactioncollection.h>
#include <klocalizedstring.h>
@ -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();

View File

@ -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);