ShortcutArea: use the launcher to verify if the app is running sandbox/mvlad/agl-compositor-old
authorMarius Vlad <marius.vlad@collabora.com>
Thu, 9 Apr 2020 14:09:34 +0000 (17:09 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Fri, 10 Apr 2020 16:43:41 +0000 (19:43 +0300)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic583786b64a19bd5fd59a230d39dc4bc2cbe4603

homescreen/qml/ShortcutArea.qml
homescreen/src/applicationlauncher.cpp
homescreen/src/applicationlauncher.h

index a638d87..2bde841 100644 (file)
@@ -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
index cb9c9b3..917ecaf 100644 (file)
@@ -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;
index e6ac183..10ea2ee 100644 (file)
@@ -44,6 +44,7 @@ signals:
 
 public slots:
     int launch(const QString &application);
+    bool is_running(const QString &application);
     void setCurrent(const QString &current);
 
 private: