escape pango markup formatted strings
To make sure string contents don't get interpreted as markup.
Change-Id: I0463014b43bd327865983d86b48d966c34cb7cbd
Tuleap: #705
diff --git a/src/historyview.cpp b/src/historyview.cpp
index 00b9e28..da1d88e 100644
--- a/src/historyview.cpp
+++ b/src/historyview.cpp
@@ -302,7 +302,7 @@
QVariant var = idx.data(Qt::DisplayRole);
if (depth == 1) {
/* category */
- text = g_strdup_printf("<b>%s</b>", var.value<QString>().toUtf8().constData());
+ text = g_markup_printf_escaped("<b>%s</b>", var.value<QString>().toUtf8().constData());
} else if (depth == 2) {
/* call item */
QVariant var_name = idx.data(static_cast<int>(Call::Role::Name));
@@ -311,13 +311,13 @@
/* we want the color of the status text to be the default color if this iter is
* selected so that the treeview is able to invert it against the selection color */
if (is_selected) {
- text = g_strdup_printf("%s\n %s",
- var_name.value<QString>().toUtf8().constData(),
- var_number.value<QString>().toUtf8().constData());
+ text = g_markup_printf_escaped("%s\n %s",
+ var_name.value<QString>().toUtf8().constData(),
+ var_number.value<QString>().toUtf8().constData());
} else {
- text = g_strdup_printf("%s\n <span fgcolor=\"gray\">%s</span>",
- var_name.value<QString>().toUtf8().constData(),
- var_number.value<QString>().toUtf8().constData());
+ text = g_markup_printf_escaped("%s\n <span fgcolor=\"gray\">%s</span>",
+ var_name.value<QString>().toUtf8().constData(),
+ var_number.value<QString>().toUtf8().constData());
}
}
}
@@ -350,14 +350,14 @@
/* we want the color of the text to be the default color if this iter is
* selected so that the treeview is able to invert it against the selection color */
if (is_selected) {
- text = g_strdup_printf("%s\n%s",
- date_time.time().toString().toUtf8().constData(),
- date_time.date().toString().toUtf8().constData()
+ text = g_markup_printf_escaped("%s\n%s",
+ date_time.time().toString().toUtf8().constData(),
+ date_time.date().toString().toUtf8().constData()
);
} else {
- text = g_strdup_printf("%s\n<span fgcolor=\"gray\">%s</span>",
- date_time.time().toString().toUtf8().constData(),
- date_time.date().toString().toUtf8().constData()
+ text = g_markup_printf_escaped("%s\n<span fgcolor=\"gray\">%s</span>",
+ date_time.time().toString().toUtf8().constData(),
+ date_time.date().toString().toUtf8().constData()
);
}
}