[rkward-cvs] SF.net SVN: rkward-code:[4836] trunk/rkward/rkward/plugin/ rkcomponentproperties.cpp
tfry at users.sf.net
tfry at users.sf.net
Fri Sep 19 15:41:25 UTC 2014
Revision: 4836
http://sourceforge.net/p/rkward/code/4836
Author: tfry
Date: 2014-09-19 15:41:24 +0000 (Fri, 19 Sep 2014)
Log Message:
-----------
Don't do over-eager escaping, when converting from StringList to String
Modified Paths:
--------------
trunk/rkward/rkward/plugin/rkcomponentproperties.cpp
Modified: trunk/rkward/rkward/plugin/rkcomponentproperties.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentproperties.cpp 2014-09-18 16:06:26 UTC (rev 4835)
+++ trunk/rkward/rkward/plugin/rkcomponentproperties.cpp 2014-09-19 15:41:24 UTC (rev 4836)
@@ -218,6 +218,20 @@
RK_TRACE (PLUGIN);
}
+// escapes only newlines, so we can join strings by newline. Does duplicate backslashes, so the string can safely be passed through RKCommonFunction::unescape().
+QString escapeNewlines (const QString &in) {
+ QString out;
+
+ for (int i = 0; i < in.size (); ++i) {
+ QChar c = in[i];
+ if (c == '\\') out.append ("\\\\");
+ else if (c == '\n') out.append ("\\n");
+ else out.append (c);
+ }
+
+ return out;
+}
+
QVariant RKComponentPropertyStringList::value (const QString &modifier) {
RK_TRACE (PLUGIN);
@@ -227,7 +241,7 @@
if (_value.isNull ()) {
for (int i = 0; i < storage.size (); ++i) {
if (!_value.isEmpty ()) _value.append (sep);
- _value.append (RKCommonFunctions::escape (storage[i])); // _value acts as a cache for joined string
+ _value.append (escapeNewlines (storage[i])); // _value acts as a cache for joined string
}
}
return _value;
More information about the rkward-tracker
mailing list