From 5236bfd845d7e3276d339f645bf4cf615b0f54b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 20 Feb 2018 13:40:10 +0100 Subject: [PATCH] GUI: load xml => set check path to file path if that seems to match --- gui/resultsview.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 8dd13b64d..cdc9b957e 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -346,18 +346,21 @@ void ResultsView::readErrorsXml(const QString &filename) } delete report; report = NULL; - } else { - QMessageBox msgBox; - msgBox.setText(tr("Failed to read the report.")); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); } ErrorItem item; foreach (item, errors) { mUI.mTree->addErrorItem(item); } - mUI.mTree->setCheckDirectory(QString()); + + QString dir; + if (!errors.isEmpty() && !errors[0].errorPath.isEmpty()) { + QString relativePath = QFileInfo(filename).canonicalPath(); + if (QFileInfo(relativePath + '/' + errors[0].errorPath[0].file).exists()) + dir = relativePath; + } + + mUI.mTree->setCheckDirectory(dir); } void ResultsView::updateDetails(const QModelIndex &index)