diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-11-14 16:32:36 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-11-25 12:42:20 +0200 |
commit | 25d521003919c047d33f3a264a3dd3a34d9918df (patch) | |
tree | b691b7fcb15b08ca298809c3eb56198c95748e3d | |
parent | 30b77eb0325669fa39331b1aef261c94c22a4c73 (diff) |
Use QString::toHtmlEscaped() for GUI text
Otherwise diagnostics mentioning the '<<' operator might be interpreted
strangely.
Task-number: QCE-21
Change-Id: Ifc55335a6639020c143edd5f8b02158f8c8ab651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
-rw-r--r-- | plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp | 7 | ||||
-rw-r--r-- | plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp | 12 |
2 files changed, 12 insertions, 7 deletions
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 2318c50c05..2b21765331 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -58,19 +58,20 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) if (!diagnostic.category.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Category:"), - diagnostic.category); + diagnostic.category.toHtmlEscaped()); } if (!diagnostic.type.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Type:"), - diagnostic.type); + diagnostic.type.toHtmlEscaped()); } if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Context:"), - diagnostic.issueContextKind + QLatin1Char(' ') + diagnostic.issueContext); + diagnostic.issueContextKind.toHtmlEscaped() + QLatin1Char(' ') + + diagnostic.issueContext.toHtmlEscaped()); } lines << qMakePair( diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 0c0a872de3..84c619d5d7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -63,7 +63,9 @@ QString createSummaryText(const ClangStaticAnalyzer::Internal::Diagnostic &diagn const QString location = fileName + QLatin1Char(' ') + QString::number(diagnostic.location.line); return QString::fromLatin1("%1 <span %3>%2</span>") - .arg(diagnostic.description, location, linkStyle); + .arg(diagnostic.description.toHtmlEscaped(), + location, + linkStyle); } QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic) @@ -136,12 +138,12 @@ QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::E if (!step.message.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"), - step.message); + step.message.toHtmlEscaped()); } if (!step.extendedMessage.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"), - step.extendedMessage); + step.extendedMessage.toHtmlEscaped()); } lines << qMakePair( @@ -170,7 +172,9 @@ QString createExplainingStepString( { return createExplainingStepNumberString(number, withMarkup) + QLatin1Char(' ') - + explainingStep.extendedMessage + + (withMarkup + ? explainingStep.extendedMessage.toHtmlEscaped() + : explainingStep.extendedMessage) + QLatin1Char(' ') + createLocationString(explainingStep.location, withMarkup, withAbsolutePath); } |