From 65e9da282fc79f590e58825f177adc33891280bc Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 20 Oct 2014 17:18:41 +0200 Subject: [PATCH] AnalyzerBase: Fix opening links with Windows drive letters Change-Id: Iba365f9abeff2573296295e50a6100cc480374b4 Reviewed-by: hjk --- src/plugins/analyzerbase/detailederrorview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/analyzerbase/detailederrorview.cpp b/src/plugins/analyzerbase/detailederrorview.cpp index ce781b9fbff..6b2eba80e09 100644 --- a/src/plugins/analyzerbase/detailederrorview.cpp +++ b/src/plugins/analyzerbase/detailederrorview.cpp @@ -203,11 +203,13 @@ void DetailedErrorDelegate::onVerticalScroll() // Expects "file://some/path[:line[:column]]" - the line/column part is optional void DetailedErrorDelegate::openLinkInEditor(const QString &link) { - const QString pathLineColumn = link.mid(int(sizeof("file://")) - 1); + const QString linkWithoutPrefix = link.mid(strlen("file://")); const QChar separator = QLatin1Char(':'); - const QString path = pathLineColumn.section(separator, 0, 0); - const int line = pathLineColumn.section(separator, 1, 1).toInt(); - const int column = pathLineColumn.section(separator, 2, 2).toInt(); + const int lineColon = linkWithoutPrefix.indexOf(separator, /*after drive letter + colon =*/ 2); + const QString path = linkWithoutPrefix.left(lineColon); + const QString lineColumn = linkWithoutPrefix.mid(lineColon + 1); + const int line = lineColumn.section(separator, 0, 0).toInt(); + const int column = lineColumn.section(separator, 1, 1).toInt(); Core::EditorManager::openEditorAt(path, qMax(line, 0), qMax(column, 0)); }