| 37 | |
| 38 | namespace { |
| 39 | QString descriptionFromProblem(IProblem::Ptr problem) |
| 40 | { |
| 41 | QString text; |
| 42 | const auto location = problem->finalLocation(); |
| 43 | if (location.isValid()) { |
| 44 | text += location.document.toUrl() |
| 45 | .adjusted(QUrl::NormalizePathSegments) |
| 46 | .toDisplayString(QUrl::PreferLocalFile); |
| 47 | if (location.start().line() >= 0) { |
| 48 | text += QLatin1Char(':') + QString::number(location.start().line() + 1); |
| 49 | if (location.start().column() >= 0) { |
| 50 | text += QLatin1Char(':') + QString::number(location.start().column() + 1); |
| 51 | } |
| 52 | } |
| 53 | text += QLatin1String(": "); |
| 54 | } |
| 55 | text += problem->description(); |
| 56 | if (!problem->explanation().isEmpty()) { |
| 57 | text += QLatin1Char('\n') + problem->explanation(); |
| 58 | } |
| 59 | return text; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | namespace KDevelop |
no test coverage detected