shift-shell/containments/taskpanel/taskpanel.cpp
Devin Lin 5e3fa11be7 panel & taskpanel: Port to use plasma_add_applet
Use plasma_add_applet to deploy the applets as a module: https://invent.kde.org/plasma/libplasma/-/merge_requests/1116

We eventually need to do this for Halcyon and Folio homescreens too, but
they also have a bunch of C++ classes to be ported to declarative type
registration.
2025-06-26 20:46:48 -04:00

34 lines
988 B
C++

/*
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "taskpanel.h"
#include <QDBusConnection>
#include <QDBusPendingReply>
#include <QDebug>
#include <QGuiApplication>
K_PLUGIN_CLASS_WITH_JSON(TaskPanel, "metadata.json")
// register type for Keyboards.KWinVirtualKeyboard.forceActivate();
Q_DECLARE_METATYPE(QDBusPendingReply<>)
TaskPanel::TaskPanel(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Containment(parent, data, args)
{
}
void TaskPanel::triggerTaskSwitcher() const
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kglobalaccel", "/component/kwin", "org.kde.kglobalaccel.Component", "invokeShortcut");
message.setArguments({QStringLiteral("Mobile Task Switcher")});
// this does not block, so it won't necessarily be called before the method returns
QDBusConnection::sessionBus().send(message);
}
#include "taskpanel.moc"