homescreens/folio: Port to new app launch method

This commit is contained in:
Devin Lin 2022-10-12 17:33:30 -04:00
parent 3e47bbd584
commit 5a9099bd84
4 changed files with 2 additions and 28 deletions

View file

@ -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()) {

View file

@ -59,7 +59,6 @@ public:
QHash<int, QByteArray> 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);

View file

@ -78,7 +78,7 @@ AbstractAppDrawer {
}
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
HomeScreenLib.ApplicationListModel.runApplication(storageId);
MobileShell.ShellUtil.launchApp(storageId);
root.launched();
}
}

View file

@ -65,7 +65,7 @@ AbstractAppDrawer {
}
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
HomeScreenLib.ApplicationListModel.runApplication(storageId);
MobileShell.ShellUtil.launchApp(storageId);
root.launched();
}
}