Subject: Bug#1162: proposed patch to add customization of icon in lower left corner of x2goclient main window

From: Seth Galitzer <[email-masked]>
Date: Mon, 20 Mar 2017 14:59:42 -0500

Package: x2goclient
Version: 4.1.0.1

Attached patch adds functionality to customize the icon in the lower 
left corner of the main window. On commandline invocation, user can 
provide path to an SVG file to replace the seal face icon with one of 
their own choosing. Mechanism is similar to how the --background flag is 
used. Same file format, pixel size, and color palette as the seal face 
icon is assumed for replacement image.

I respectfully ask this to be considered for inclusion in future releases.

Seth Galitzer

-- 
Seth Galitzer
Systems Coordinator
Computing and Information Sciences
Kansas State University
http://www.cis.ksu.edu/~sgsax
[email-masked]
785-532-7790
--- src/onmainwindow.cpp	2017-03-17 10:59:41.875102821 -0500
+++ src/onmainwindow.cpp.new	2017-03-17 15:22:51.251712544 -0500
@@ -359,8 +359,12 @@
     pl.setColor ( QPalette::Base, QColor ( 255,255,255,0 ) );
     pl.setColor ( QPalette::Window, QColor ( 255,255,255,0 ) );
     x2g->setPalette ( pl );
+    
+    if (OnFile.size())
+        on=new SVGFrame ( ( QString ) OnFile,false,fr );
+    else
+        on=new SVGFrame ( ( QString ) ":/img/svg/onlogo.svg",false,fr );
 
-    SVGFrame* on=new SVGFrame ( ( QString ) ":/img/svg/onlogo.svg",false,fr );
     on->setPalette ( pl );
 
     if ( !miniMode )
@@ -7545,6 +7549,17 @@
         portableDataPath=value;
         return true;
     }
+    if (setting == "--branding")
+    {
+        value = expandHome(value);
+        if (! QFile::exists(value))
+        {
+            printError( param + tr(" (file does not exist)"));
+            return false;
+        }
+        OnFile=value;
+        return true;
+    }
 
     printError ( param );
     return false;

--- src/onmainwindow.h	2017-03-17 15:15:54.145906712 -0500
+++ src/onmainwindow.h.new	2017-03-17 15:22:24.143595440 -0500
@@ -672,6 +672,7 @@
 
     IMGFrame* fr;
     SVGFrame *bgFrame;
+    SVGFrame *on;
     QLineEdit* uname;
     ClickLineEdit* pass;
     ClickLineEdit* login;
@@ -801,6 +802,7 @@
 
     QString supportMenuFile;
     QString BGFile;
+    QString OnFile;
     QString SPixFile;
 
     QString LDAPSndSys;

--- src/help.cpp	2017-03-17 15:47:27.990169955 -0500
+++ src/help.cpp.new	2017-03-17 16:10:20.680313266 -0500
@@ -154,6 +154,8 @@
   ADD_OPT ("--broker-ssh-key=<path to key>", QT_TRANSLATE_NOOP ("Help", "Sets the path to an SSH key to use for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."));
   ADD_OPT ("--broker-autologin", QT_TRANSLATE_NOOP ("Help", "Enables the use of the default SSH key or SSH agent for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."));
   ADD_OPT ("--broker-noauth", QT_TRANSLATE_NOOP ("Help", "Does not ask for user credentials during session broker authentication. This can be useful if you are using an HTTP(S) session broker without authentication. If you run an HTTP(S) server without authentication, but with user-specific profiles, then put the user name into the broker URL (refer to --broker-url.) The user name then will be extracted from the broker URL and be sent to the session broker. The client's behavior is undefined if this flag is used for non-HTTP(S) session brokers."));
+  ADD_OPT ("--background=<svg-file>", QT_TRANSLATE_NOOP ("Help", "Use a custom/branded background image (SVG format) for X2Go Client's main window"));
+  ADD_OPT ("--branding=<svg-file>", QT_TRANSLATE_NOOP ("Help", "Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of the X2Go Client's main window"));
 
 # undef NEWLINE
 # undef ADD_OPT

--- man/man1/x2goclient.1	2017-03-17 16:24:27.676072362 -0500
+++ man/man1/x2goclient.1.new	2017-03-17 16:21:00.787157296 -0500
@@ -97,6 +97,9 @@
 \*(T<\fB\-\-background=<svg-file>\fR\*(T>
 Use a custom/branded background image (SVG format) for X2Go Client's main window (i.e. replace the blue gradient area
 in X2Go Client by some background of your own (business/workgroup/project).
+.TP
+\*(T<\fB\-\-branding=<svg-file>\fR\*(T>
+Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of the X2Go Client's main window.
 
 .SH SESSION PROFILE DEFAULTS
 You can set certain defaults for session profiles via command line switches using the following options: