[X2Go-Commits] [x2goclient] 07/08: x2goutils: add fixup_resources() to fix "broken" resource URI's.
git-admin at x2go.org
git-admin at x2go.org
Sun Feb 15 00:00:04 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 e56ade08b004fe775145cccc05ca79e2e6854587
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 734a7fc..9233265 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -197,6 +197,7 @@ x2goclient (4.0.3.2-0x2go1) UNRELEASED; 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.
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Thu, 27 Nov 2014 12:01:43 +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/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list