From 5a9099bd84c4c3a6eae74d383de9f263b29a06f1 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Wed, 12 Oct 2022 17:33:30 -0400 Subject: [PATCH] homescreens/folio: Port to new app launch method --- .../folio/applicationlistmodel.cpp | 25 ------------------- .../homescreens/folio/applicationlistmodel.h | 1 - .../ui/appdrawer/GridViewAppDrawer.qml | 2 +- .../ui/appdrawer/ListViewAppDrawer.qml | 2 +- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/containments/homescreens/folio/applicationlistmodel.cpp b/containments/homescreens/folio/applicationlistmodel.cpp index c09aaca5..80c7a6d5 100644 --- a/containments/homescreens/folio/applicationlistmodel.cpp +++ b/containments/homescreens/folio/applicationlistmodel.cpp @@ -182,31 +182,6 @@ int ApplicationListModel::rowCount(const QModelIndex &parent) const return m_applicationList.count(); } -void ApplicationListModel::runApplication(const QString &storageId) -{ - if (storageId.isEmpty()) { - return; - } - - for (auto i = m_applicationList.begin(); i != m_applicationList.end(); i++) { - if ((*i).window && (*i).storageId == storageId) { - (*i).window->requestActivate(); - return; - } - } - - KService::Ptr service = KService::serviceByStorageId(storageId); - KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service); - job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled)); - job->start(); - connect(job, &KJob::finished, this, [this, job] { - if (job->error()) { - qWarning() << "error launching" << job->error() << job->errorString(); - Q_EMIT launchError(job->errorString()); - } - }); -} - void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate) { if (row < 0 || row >= m_applicationList.count()) { diff --git a/containments/homescreens/folio/applicationlistmodel.h b/containments/homescreens/folio/applicationlistmodel.h index c3f7dc26..505d79fe 100644 --- a/containments/homescreens/folio/applicationlistmodel.h +++ b/containments/homescreens/folio/applicationlistmodel.h @@ -59,7 +59,6 @@ public: QHash roleNames() const Q_DECL_OVERRIDE; Q_INVOKABLE virtual void load(); - Q_INVOKABLE void runApplication(const QString &storageId); Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate); Q_INVOKABLE void unsetMinimizedDelegate(int row, QQuickItem *delegate); diff --git a/containments/homescreens/folio/package/contents/ui/appdrawer/GridViewAppDrawer.qml b/containments/homescreens/folio/package/contents/ui/appdrawer/GridViewAppDrawer.qml index 7a0fc4d2..23b736de 100644 --- a/containments/homescreens/folio/package/contents/ui/appdrawer/GridViewAppDrawer.qml +++ b/containments/homescreens/folio/package/contents/ui/appdrawer/GridViewAppDrawer.qml @@ -78,7 +78,7 @@ AbstractAppDrawer { } HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate); - HomeScreenLib.ApplicationListModel.runApplication(storageId); + MobileShell.ShellUtil.launchApp(storageId); root.launched(); } } diff --git a/containments/homescreens/folio/package/contents/ui/appdrawer/ListViewAppDrawer.qml b/containments/homescreens/folio/package/contents/ui/appdrawer/ListViewAppDrawer.qml index 6b886e67..8684fdb3 100644 --- a/containments/homescreens/folio/package/contents/ui/appdrawer/ListViewAppDrawer.qml +++ b/containments/homescreens/folio/package/contents/ui/appdrawer/ListViewAppDrawer.qml @@ -65,7 +65,7 @@ AbstractAppDrawer { } HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate); - HomeScreenLib.ApplicationListModel.runApplication(storageId); + MobileShell.ShellUtil.launchApp(storageId); root.launched(); } }