diff --git a/containments/panel/CMakeLists.txt b/containments/panel/CMakeLists.txt index 48da9790..8d0fde3f 100644 --- a/containments/panel/CMakeLists.txt +++ b/containments/panel/CMakeLists.txt @@ -15,7 +15,10 @@ target_link_libraries(plasma_applet_phonepanel Qt::DBus KF5::Plasma KF5::I18n - KF5::Notifications) + KF5::Notifications + KF5::KIOGui + KF5::Service + ) install(TARGETS plasma_applet_phonepanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets) #install(FILES plasma-phonepanel-default.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/containments/panel/package/contents/ui/IndicatorsRow.qml b/containments/panel/package/contents/ui/IndicatorsRow.qml index 1ef7f2cb..93e407d8 100644 --- a/containments/panel/package/contents/ui/IndicatorsRow.qml +++ b/containments/panel/package/contents/ui/IndicatorsRow.qml @@ -119,6 +119,12 @@ Item { horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter font.pixelSize: height / 2 + + TapHandler { + onTapped: { + plasmoid.nativeInterface.launchApp("org.kde.kclock"); + } + } } RowLayout { diff --git a/containments/panel/phonepanel.cpp b/containments/panel/phonepanel.cpp index 79c7c657..828f69a2 100644 --- a/containments/panel/phonepanel.cpp +++ b/containments/panel/phonepanel.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -202,6 +203,17 @@ bool PhonePanel::isSystem24HourFormat() return timeFormat == QStringLiteral(FORMAT24H); } +void PhonePanel::launchApp(const QString &app) +{ + const KService::Ptr appService = KService::serviceByDesktopName(app); + if (!appService) { + qWarning() << "Could not find" << app; + return; + } + auto job = new KIO::ApplicationLauncherJob(appService, this); + job->start(); +} + K_PLUGIN_CLASS_WITH_JSON(PhonePanel, "metadata.json") #include "phonepanel.moc" diff --git a/containments/panel/phonepanel.h b/containments/panel/phonepanel.h index 59b9351c..435c0dfd 100644 --- a/containments/panel/phonepanel.h +++ b/containments/panel/phonepanel.h @@ -28,6 +28,7 @@ public: public Q_SLOTS: void executeCommand(const QString &command); + void launchApp(const QString &app); void toggleTorch(); void takeScreenshot();