1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2010 Intel Corporation |
5 | SPDX-FileContributor: Mateu Batle Sastre <mbatle@collabora.co.uk> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
8 | */ |
9 | |
10 | #include "homepagetypeparser.h" |
11 | |
12 | using namespace Attica; |
13 | |
14 | QStringList HomePageType::Parser::xmlElement() const |
15 | { |
16 | return QStringList(QStringLiteral("homepagetype" )); |
17 | } |
18 | |
19 | HomePageType HomePageType::Parser::parseXml(QXmlStreamReader &xml) |
20 | { |
21 | HomePageType item; |
22 | |
23 | while (!xml.atEnd()) { |
24 | xml.readNext(); |
25 | if (xml.isStartElement()) { |
26 | if (xml.name() == QLatin1String("id" )) { |
27 | item.setId(xml.readElementText().toInt()); |
28 | } else if (xml.name() == QLatin1String("name" )) { |
29 | item.setName(xml.readElementText()); |
30 | } |
31 | } |
32 | if (xml.isEndElement() && xml.name() == QLatin1String("homepagetype" )) { |
33 | break; |
34 | } |
35 | } |
36 | return item; |
37 | } |
38 | |