From 745f1d9e86e8cbd83c5ae84aba2513341da5ad7a Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 9 Apr 2020 17:09:34 +0300 Subject: ShortcutArea: use the launcher to verify if the app is running Signed-off-by: Marius Vlad Change-Id: Ic583786b64a19bd5fd59a230d39dc4bc2cbe4603 --- homescreen/qml/ShortcutArea.qml | 14 ++++++++++++-- homescreen/src/applicationlauncher.cpp | 6 ++++++ homescreen/src/applicationlauncher.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml index a638d87..2bde841 100644 --- a/homescreen/qml/ShortcutArea.qml +++ b/homescreen/qml/ShortcutArea.qml @@ -54,18 +54,28 @@ Item { property variant applications: {'' : -1} + function find_app_with_launcher(app_id) { + if (launcher.is_running(app_id)) + return true + + return false + } + function find_app(app, apps) { for (var x in apps) { if (apps[x] == -1) continue - if (x === app) - return true + if (x === app) { + if (find_app_with_launcher(x)) + return true + } } return false } + function set_current_window_app(appid, window) { current_appid = appid current_window = window diff --git a/homescreen/src/applicationlauncher.cpp b/homescreen/src/applicationlauncher.cpp index cb9c9b3..917ecaf 100644 --- a/homescreen/src/applicationlauncher.cpp +++ b/homescreen/src/applicationlauncher.cpp @@ -65,6 +65,12 @@ int ApplicationLauncher::launch(const QString &application) return result; } +bool ApplicationLauncher::is_running(const QString &application) +{ + if (m_launcher->connection_is_set()) + return m_launcher->is_running(application); +} + bool ApplicationLauncher::isLaunching() const { return m_launching; diff --git a/homescreen/src/applicationlauncher.h b/homescreen/src/applicationlauncher.h index e6ac183..10ea2ee 100644 --- a/homescreen/src/applicationlauncher.h +++ b/homescreen/src/applicationlauncher.h @@ -44,6 +44,7 @@ signals: public slots: int launch(const QString &application); + bool is_running(const QString &application); void setCurrent(const QString ¤t); private: -- cgit 1.2.3-korg