From 0baecfcdb57d03cb812b4dd2ad953127e11354cd Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 18 Oct 2013 15:56:24 +0200 Subject: [PATCH] a toggleActivityManager action still a stub, will be completely managed in qml --- .../desktop/contents/views/Desktop.qml | 5 +++++ src/shell/shellcorona.cpp | 20 +++++++++++++++++++ src/shell/shellcorona.h | 9 +++++---- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/shell/qmlpackages/desktop/contents/views/Desktop.qml b/src/shell/qmlpackages/desktop/contents/views/Desktop.qml index c6773e819..9f7b5bae0 100644 --- a/src/shell/qmlpackages/desktop/contents/views/Desktop.qml +++ b/src/shell/qmlpackages/desktop/contents/views/Desktop.qml @@ -30,6 +30,11 @@ Rectangle { property Item containment + function toggleActivityManager() { + console.log("Activity manger toggled") + } + + onContainmentChanged: { print("New Containment: " + containment); print("Old Containment: " + internal.oldContainment); diff --git a/src/shell/shellcorona.cpp b/src/shell/shellcorona.cpp index 751b8aa41..b67254a29 100644 --- a/src/shell/shellcorona.cpp +++ b/src/shell/shellcorona.cpp @@ -117,6 +117,14 @@ ShellCorona::ShellCorona(QObject *parent) //Activity stuff + QAction *activityAction = actions()->addAction("manage activities"); + connect(activityAction, &QAction::triggered, + this, &ShellCorona::toggleActivityManager); + activityAction->setText(i18n("Activities...")); + activityAction->setIcon(QIcon::fromTheme("preferences-activities")); + activityAction->setData(Plasma::Types::ConfigureAction); + activityAction->setShortcut(QKeySequence("alt+d, alt+a")); + activityAction->setShortcutContext(Qt::ApplicationShortcut); connect(this, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SLOT(updateImmutability(Plasma::ImmutabilityType))); @@ -455,6 +463,18 @@ void ShellCorona::showWidgetExplorer() d->widgetExplorerView->show(); } +void ShellCorona::toggleActivityManager() +{ + QPoint cursorPos = QCursor::pos(); + foreach (DesktopView *view, d->views) { + if (view->screen()->geometry().contains(cursorPos)) { + //The view QML has to provide something to display the activity explorer + view->rootObject()->metaObject()->invokeMethod(view->rootObject(), "toggleActivityManager"); + return; + } + } +} + void ShellCorona::syncAppConfig() { qDebug() << "Syncing plasma-shellrc config"; diff --git a/src/shell/shellcorona.h b/src/shell/shellcorona.h index f2e29642f..326421a68 100644 --- a/src/shell/shellcorona.h +++ b/src/shell/shellcorona.h @@ -72,6 +72,10 @@ public: PanelView *panelView(Plasma::Containment *containment) const; + Activity* activity(const QString &id); + + KActivities::Controller *activityController(); + public Q_SLOTS: /** * Request saving applicationConfig on disk, it's event compressed, not immediate @@ -119,14 +123,11 @@ protected Q_SLOTS: */ void processUpdateScripts(); - Activity* activity(const QString &id); - - KActivities::Controller *activityController(); - private Q_SLOTS: void checkLoadingDesktopsComplete(); void handleContainmentAdded(Plasma::Containment *c); void showWidgetExplorer(); + void toggleActivityManager(); void syncAppConfig(); void setDashboardShown(bool show); void checkActivities();