From e75c8005d314084d6f86f55dac1abde7eaa6ea1b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 18 Jun 2015 16:58:11 -0700 Subject: [PATCH] a KRun based way to launch apps needs the duplicate for now in order to test without breaking the image --- CMakeLists.txt | 2 +- containments/homescreen/CMakeLists.txt | 1 + containments/homescreen/applicationlistmodel.cpp | 13 +++++++++++++ containments/homescreen/applicationlistmodel.h | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c08b1212..0aa899ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Gui Widgets Qml Quick Test) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n) +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n KIO) find_package(KF5 REQUIRED COMPONENTS PlasmaQuick DBusAddons Notifications) find_package(KF5Wayland CONFIG) set_package_properties(KF5Wayland PROPERTIES diff --git a/containments/homescreen/CMakeLists.txt b/containments/homescreen/CMakeLists.txt index fe2649e2..8a4ffda4 100644 --- a/containments/homescreen/CMakeLists.txt +++ b/containments/homescreen/CMakeLists.txt @@ -13,6 +13,7 @@ target_link_libraries(plasma_containment_phone_homescreen Qt5::Qml KF5::I18n KF5::Service + KF5::KIOWidgets ) diff --git a/containments/homescreen/applicationlistmodel.cpp b/containments/homescreen/applicationlistmodel.cpp index 2dcee31a..cb35cc00 100644 --- a/containments/homescreen/applicationlistmodel.cpp +++ b/containments/homescreen/applicationlistmodel.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include ApplicationListModel::ApplicationListModel(QObject *parent) @@ -218,6 +219,7 @@ Q_INVOKABLE void ApplicationListModel::moveItem(int row, int destination) endMoveRows(); } +//TODO: the implementation of runApplicationKRun should be the only one remaining void ApplicationListModel::runApplication(const QString &storageId) { if (storageId.isEmpty()) { @@ -230,6 +232,17 @@ void ApplicationListModel::runApplication(const QString &storageId) QProcess::startDetached(service->exec().replace(QRegExp("%\\w"), "")); } +void ApplicationListModel::runApplicationKRun(const QString &storageId) +{ + if (storageId.isEmpty()) { + return; + } + + KService::Ptr service = KService::serviceByStorageId(storageId); + + KRun::run(*service, QList(), 0); +} + QStringList ApplicationListModel::appOrder() const { return m_appOrder; diff --git a/containments/homescreen/applicationlistmodel.h b/containments/homescreen/applicationlistmodel.h index a5094566..2d2da610 100644 --- a/containments/homescreen/applicationlistmodel.h +++ b/containments/homescreen/applicationlistmodel.h @@ -71,6 +71,8 @@ public: Q_INVOKABLE void runApplication(const QString &storageId); + Q_INVOKABLE void runApplicationKRun(const QString &storageId); + Q_INVOKABLE void loadApplications(); public Q_SLOTS: