a KRun based way to launch apps

needs the duplicate for now in order to test without breaking
the image
This commit is contained in:
Marco Martin 2015-06-18 16:58:11 -07:00
parent c94b6c348c
commit e75c8005d3
4 changed files with 17 additions and 1 deletions

View file

@ -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

View file

@ -13,6 +13,7 @@ target_link_libraries(plasma_containment_phone_homescreen
Qt5::Qml
KF5::I18n
KF5::Service
KF5::KIOWidgets
)

View file

@ -33,6 +33,7 @@
#include <KSharedConfig>
#include <KSycoca>
#include <KSycocaEntry>
#include <KIOWidgets/KRun>
#include <QDebug>
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<QUrl>(), 0);
}
QStringList ApplicationListModel::appOrder() const
{
return m_appOrder;

View file

@ -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: