diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 6088ea9a5..381d7d9c0 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -190,7 +190,9 @@ ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader) */ ErrorItem item; - if (reader->name().toString() == ErrorElementName) + + // Read error element from inside errors element + if (mXmlReader->name() == ErrorElementName) { QXmlStreamAttributes attribs = reader->attributes(); item.id = attribs.value("", IdAttribute).toString(); @@ -199,23 +201,17 @@ ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader) item.summary = XmlReport::unquoteMessage(summary); const QString message = attribs.value("", VerboseAttribute).toString(); item.message = XmlReport::unquoteMessage(message); - - ReadLocations(item); } - return item; -} -void XmlReportV2::ReadLocations(ErrorItem &item) -{ - QList errors; - bool allRead = false; - while (!allRead && !mXmlReader->atEnd()) + bool errorRead = false; + while (!errorRead && !mXmlReader->atEnd()) { switch (mXmlReader->readNext()) { case QXmlStreamReader::StartElement: - if (mXmlReader->name() != LocationElementName) - continue; // Skip other than location elements + + // Read location element from inside error element + if (mXmlReader->name() == LocationElementName) { QXmlStreamAttributes attribs = mXmlReader->attributes(); QString file = attribs.value("", FilenameAttribute).toString(); @@ -229,8 +225,8 @@ void XmlReportV2::ReadLocations(ErrorItem &item) break; case QXmlStreamReader::EndElement: - if (mXmlReader->name() == LocationElementName) - allRead = true; + if (mXmlReader->name() == ErrorElementName) + errorRead = true; break; // Not handled @@ -246,4 +242,5 @@ void XmlReportV2::ReadLocations(ErrorItem &item) break; } } + return item; } diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index d60b71126..6b1a2841c 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -81,12 +81,6 @@ protected: */ ErrorItem ReadError(QXmlStreamReader *reader); - /** - * @brief Read and parse error items location elements from XML stream. - * @param item ErrorItem to write the location data. - */ - void ReadLocations(ErrorItem &item); - private: /** * @brief XML stream reader for reading the report in XML format.