[X2Go-Commits] [x2goclient] 01/01: Fix loading session icon to system tray when using broker.

git-admin at x2go.org git-admin at x2go.org
Thu Sep 16 15:50:16 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 456a43f4ca1c583a56f99d78b26be6d0c5c52f98
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Thu Sep 16 15:49:22 2021 +0200

    Fix loading session icon to system tray when using broker.
---
 debian/changelog     |  1 +
 src/onmainwindow.cpp | 25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 388983b..1148578 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
       event.
     - Don't exit if connection to HTTP broker is failed when sync sessions.
     - Support for HTTP(S) urls in the session icons when using http broker.
+    - Fix loading session icon to system tray when using broker.
 
   [ Ryan Schmidt ]
   * New upstream version (4.1.2.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 6a63108..7918a26 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -4943,8 +4943,29 @@ void ONMainWindow::setTrayIconToSessionIcon(QString info) {
             sid="embedded";
 
         if (!keepTrayIcon) {
-            QString imagePath = wrap_legacy_resource_URIs (expandHome(st->setting()->value(sid + "/icon", (QVariant) QString(iconsPath("/128x128/x2go.png"))).toString()));
-            trayIcon->setIcon(QIcon (imagePath));
+            QString sessIcon = wrap_legacy_resource_URIs (expandHome(st->setting()->value(sid + "/icon",
+                                        (QVariant) QString(iconsPath("/128x128/x2go.png"))).toString()));
+            if (!brokerMode || sessIcon == iconsPath("/128x128/x2gosession.png"))
+            {
+                trayIcon->setIcon(QIcon (sessIcon));
+            }
+            else
+            {
+                QPixmap pix;
+                if(sessIcon.indexOf("file://")!=-1)
+                {
+                    //load icon from file URL
+                    pix.load(sessIcon.replace("file://",""));
+                }
+                else
+                    pix.loadFromData(QByteArray::fromBase64(sessIcon.toLatin1()));
+                if(pix.isNull())
+                {
+                    //loading icon has failed, load default icon
+                    pix.load(iconsPath("/128x128/x2gosession.png"));
+                }
+                trayIcon->setIcon(QIcon (pix));
+            }
         }
 
         QString name=st->setting()->value ( sid +"/name").toString() ;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list