[X2Go-Commits] [x2goclient] 61/87: x2goutils: add fixup_resources() to fix "broken" resource URI's.

git-admin at x2go.org git-admin at x2go.org
Wed Mar 4 22:14:49 CET 2015


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

x2go pushed a commit to branch feature/cleanup
in repository x2goclient.

commit 523844a068b2ac95ba23b52a0de38ff1ca8b52dd
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Feb 14 23:54:50 2015 +0100

    x2goutils: add fixup_resources() to fix "broken" resource URI's.
---
 debian/changelog  |    1 +
 src/x2goutils.cpp |   16 +++++++++++++++-
 src/x2goutils.h   |    1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index dabefba..35b4bd0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -223,6 +223,7 @@ x2goclient (4.0.3.2-0x2go1) unstable; urgency=medium
       path is being used as a pixmap (user photo/session icon.)
     - Add myself to copyright section in the x2goutils headers.
     - Change four spaces per indentation level to two spaces in x2goutils.cpp.
+    - Add fixup_resources() to x2goutils to fix "broken" resource URI's.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Thu, 19 Feb 2015 12:49:22 +0100
 
diff --git a/src/x2goutils.cpp b/src/x2goutils.cpp
index d1ad13d..a41fdf2 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -30,6 +30,18 @@ QString expandHome( QString path )
   return path;
 }
 
+QString fixup_resources (const QString res_path) {
+  QString ret (res_path);
+
+  if (!(res_path.isEmpty ())) {
+    if (ret.at (1) != '/') {
+      ret.insert (1, '/');
+    }
+  }
+
+  return (ret);
+}
+
 QString wrap_legacy_resources (const QString res_path) {
   QString ret (res_path);
 
@@ -39,12 +51,14 @@ QString wrap_legacy_resources (const QString res_path) {
     legacy_locations.push_back (QString (":/png/"));
     legacy_locations.push_back (QString (":/svg/"));
 
+    ret = fixup_resources (ret);
+
     bool detected = false;
 
     /* This would be so much easier with C++ and lambdas... */
     std::vector<QString>::const_iterator it = legacy_locations.begin ();
     while (it != legacy_locations.end ()) {
-      if (res_path.startsWith (*(it++))) {
+      if (ret.startsWith (*(it++))) {
         detected = true;
         break;
       }
diff --git a/src/x2goutils.h b/src/x2goutils.h
index 0ff2e8e..cc6bc38 100644
--- a/src/x2goutils.h
+++ b/src/x2goutils.h
@@ -22,6 +22,7 @@
 #include <QString>
 
 QString expandHome( QString path );
+QString fixup_resources (const QString res_path);
 QString wrap_legacy_resources (const QString res_path);
 
 #endif

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//../..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list