mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +00:00
homescreens/folio: Port to new app launch method
This commit is contained in:
parent
3e47bbd584
commit
5a9099bd84
4 changed files with 2 additions and 28 deletions
|
|
@ -182,31 +182,6 @@ int ApplicationListModel::rowCount(const QModelIndex &parent) const
|
||||||
return m_applicationList.count();
|
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)
|
void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= m_applicationList.count()) {
|
if (row < 0 || row >= m_applicationList.count()) {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ public:
|
||||||
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
|
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
Q_INVOKABLE virtual void load();
|
Q_INVOKABLE virtual void load();
|
||||||
Q_INVOKABLE void runApplication(const QString &storageId);
|
|
||||||
|
|
||||||
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
|
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
|
||||||
Q_INVOKABLE void unsetMinimizedDelegate(int row, QQuickItem *delegate);
|
Q_INVOKABLE void unsetMinimizedDelegate(int row, QQuickItem *delegate);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ AbstractAppDrawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
|
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
|
||||||
HomeScreenLib.ApplicationListModel.runApplication(storageId);
|
MobileShell.ShellUtil.launchApp(storageId);
|
||||||
root.launched();
|
root.launched();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ AbstractAppDrawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
|
HomeScreenLib.ApplicationListModel.setMinimizedDelegate(index, delegate);
|
||||||
HomeScreenLib.ApplicationListModel.runApplication(storageId);
|
MobileShell.ShellUtil.launchApp(storageId);
|
||||||
root.launched();
|
root.launched();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue