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.
This commit is contained in:
Devin Lin 2025-06-25 20:13:02 -04:00
parent 1d3ceb5801
commit 5e3fa11be7
9 changed files with 19 additions and 28 deletions

View file

@ -3,22 +3,17 @@
# SPDX-FileCopyrightText: 2020-2021 Nicolas Fella <nicolas.fella@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
set(phonepanel_SRCS
phonepanel.cpp
plasma_add_applet(org.kde.plasma.mobile.panel
QML_SOURCES
qml/main.qml
CPP_SOURCES
phonepanel.cpp
)
add_library(org.kde.plasma.mobile.panel MODULE ${phonepanel_SRCS})
target_link_libraries(org.kde.plasma.mobile.panel
target_link_libraries(org.kde.plasma.mobile.panel PRIVATE
Qt::Gui
Qt::DBus
Plasma::Plasma
KF6::I18n
KF6::Service
)
install(TARGETS org.kde.plasma.mobile.panel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
#install(FILES plasma-phonepanel-default.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
plasma_install_package(package org.kde.plasma.mobile.panel)

View file

@ -1,5 +1,4 @@
{
"KPackageStructure": "Plasma/Applet",
"KPlugin": {
"Authors": [
{
@ -83,7 +82,6 @@
"Description[x-test]": "xxTop panel for Plasma Mobilexx",
"Description[zh_CN]": "Plasma Mobile 的顶部面板",
"Description[zh_TW]": "Plasma 行動的頂部面板",
"Id": "org.kde.plasma.mobile.panel",
"License": "GPLv2+",
"Name": "Phone Panel",
"Name[ar]": "لوحة الهاتف",

View file

@ -7,6 +7,8 @@
#include "phonepanel.h"
K_PLUGIN_CLASS_WITH_JSON(PhonePanel, "metadata.json")
PhonePanel::PhonePanel(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Containment(parent, data, args)
{
@ -14,6 +16,4 @@ PhonePanel::PhonePanel(QObject *parent, const KPluginMetaData &data, const QVari
PhonePanel::~PhonePanel() = default;
K_PLUGIN_CLASS(PhonePanel)
#include "phonepanel.moc"

View file

@ -3,9 +3,15 @@
# SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
add_library(org.kde.plasma.mobile.taskpanel MODULE taskpanel.cpp ${DBUS_SRCS})
plasma_add_applet(org.kde.plasma.mobile.taskpanel
QML_SOURCES
qml/main.qml
qml/NavigationPanelComponent.qml
CPP_SOURCES
taskpanel.cpp
)
target_link_libraries(org.kde.plasma.mobile.taskpanel
target_link_libraries(org.kde.plasma.mobile.taskpanel PRIVATE
Qt::Gui
Qt::DBus
Qt::Qml
@ -13,10 +19,4 @@ target_link_libraries(org.kde.plasma.mobile.taskpanel
Qt::Sensors
Plasma::Plasma
KF6::Screen
)
install(TARGETS org.kde.plasma.mobile.taskpanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
plasma_install_package(package org.kde.plasma.mobile.taskpanel)
)

View file

@ -1,5 +1,4 @@
{
"KPackageStructure": "Plasma/Applet",
"KPlugin": {
"Authors": [
{
@ -83,7 +82,6 @@
"Description[x-test]": "xxNavigation panel for Plasma Mobilexx",
"Description[zh_CN]": "Plasma 移动版导航面板",
"Description[zh_TW]": "Plasma 行動的導覽面板",
"Id": "org.kde.plasma.mobile.taskpanel",
"License": "GPLv2+",
"Name": "Phone Task panel",
"Name[ar]": "لوحة مهمة الهاتف",

View file

@ -11,6 +11,8 @@
#include <QDebug>
#include <QGuiApplication>
K_PLUGIN_CLASS_WITH_JSON(TaskPanel, "metadata.json")
// register type for Keyboards.KWinVirtualKeyboard.forceActivate();
Q_DECLARE_METATYPE(QDBusPendingReply<>)
@ -29,6 +31,4 @@ void TaskPanel::triggerTaskSwitcher() const
QDBusConnection::sessionBus().send(message);
}
K_PLUGIN_CLASS(TaskPanel)
#include "taskpanel.moc"