From 3fc96fbc25d7d7b773dc7fc9cd3945bcc69c1db8 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 13 Sep 2021 14:22:47 +0200 Subject: [PATCH] Close the application started notification when the job failed to open So far, we leave the splash on which is confusing. https://invent.kde.org/teams/plasma-mobile/issues/-/issues/70 --- .../mobilehomescreencomponents/applicationlistmodel.cpp | 6 ++++++ .../mobilehomescreencomponents/applicationlistmodel.h | 1 + components/mobilehomescreencomponents/qml/AppDrawer.qml | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/components/mobilehomescreencomponents/applicationlistmodel.cpp b/components/mobilehomescreencomponents/applicationlistmodel.cpp index 00335d5b..9db77ef0 100644 --- a/components/mobilehomescreencomponents/applicationlistmodel.cpp +++ b/components/mobilehomescreencomponents/applicationlistmodel.cpp @@ -399,6 +399,12 @@ void ApplicationListModel::runApplication(const QString &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()); + } + }); } int ApplicationListModel::maxFavoriteCount() const diff --git a/components/mobilehomescreencomponents/applicationlistmodel.h b/components/mobilehomescreencomponents/applicationlistmodel.h index 326ed6d0..94f66da5 100644 --- a/components/mobilehomescreencomponents/applicationlistmodel.h +++ b/components/mobilehomescreencomponents/applicationlistmodel.h @@ -116,6 +116,7 @@ Q_SIGNALS: void favoriteCountChanged(); void maxFavoriteCountChanged(); void appletChanged(); + void launchError(const QString &msg); protected: void initWayland(); diff --git a/components/mobilehomescreencomponents/qml/AppDrawer.qml b/components/mobilehomescreencomponents/qml/AppDrawer.qml index a45b0815..e96f7a98 100644 --- a/components/mobilehomescreencomponents/qml/AppDrawer.qml +++ b/components/mobilehomescreencomponents/qml/AppDrawer.qml @@ -204,6 +204,11 @@ Item { // boundsBehavior: Flickable.StopAtBounds + Connections { + target: HomeScreenComponents.ApplicationListModel + onLaunchError: NanoShell.StartupFeedback.close() + } + model: HomeScreenComponents.ApplicationListModel header: Rectangle {