refs #846, support message as HTML

This commit is contained in:
Klaus Basan
2016-12-29 00:35:46 +01:00
committed by Mathew Sutcliffe
parent eed9910e75
commit 8341da2310
3 changed files with 7 additions and 3 deletions

View File

@@ -420,6 +420,8 @@ namespace BlackMisc
return CVariant::from(this->getHumanReadablePattern()); return CVariant::from(this->getHumanReadablePattern());
case IndexCategoryHumanReadableOrTechnicalAsString: case IndexCategoryHumanReadableOrTechnicalAsString:
return CVariant::from(this->getHumanOrTechnicalCategoriesAsString()); return CVariant::from(this->getHumanOrTechnicalCategoriesAsString());
case IndexMessageAsHtml:
return CVariant::from(this->toHtml());
default: default:
return CValueObject::propertyByIndex(index); return CValueObject::propertyByIndex(index);
} }
@@ -455,6 +457,7 @@ namespace BlackMisc
ColumnIndex i = index.frontCasted<ColumnIndex>(); ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexMessageAsHtml:
case IndexMessage: case IndexMessage:
return this->getMessage().compare(compareValue.getMessage()); return this->getMessage().compare(compareValue.getMessage());
case IndexSeverity: case IndexSeverity:
@@ -494,7 +497,7 @@ namespace BlackMisc
break; break;
} }
html.append(this->getMessage()); html.append(this->getMessage());
if (this->getSeverity() == SeverityInfo) return html; if (this->getSeverity() == SeverityInfo) { return html; }
html.append("</font>"); html.append("</font>");
return html; return html;
} }

View File

@@ -150,7 +150,8 @@ namespace BlackMisc
IndexCategoryHumanReadableOrTechnicalAsString, IndexCategoryHumanReadableOrTechnicalAsString,
IndexSeverity, IndexSeverity,
IndexSeverityAsString, IndexSeverityAsString,
IndexMessage IndexMessage,
IndexMessageAsHtml
}; };
//! Construct a message with some specific category. //! Construct a message with some specific category.

View File

@@ -183,7 +183,7 @@ namespace BlackMisc
for (const CPropertyIndex &index : usedIndexes) for (const CPropertyIndex &index : usedIndexes)
{ {
rowHtml += "<td>" + statusMessage.propertyByIndex(index).toQString(true) + "</td>"; rowHtml += "<td>" + statusMessage.propertyByIndex(index).toQString(true).toHtmlEscaped() + "</td>";
} }
rowHtml = "<tr class=\"%1\">" + rowHtml + "</tr>"; rowHtml = "<tr class=\"%1\">" + rowHtml + "</tr>";