File indexing completed on 2024-04-21 14:52:17

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #include "folderparser.h"
0010 
0011 using namespace Attica;
0012 
0013 Folder Folder::Parser::parseXml(QXmlStreamReader &xml)
0014 {
0015     Folder folder;
0016 
0017     while (!xml.atEnd()) {
0018         xml.readNext();
0019 
0020         if (xml.isStartElement()) {
0021             if (xml.name() == QLatin1String("id")) {
0022                 folder.setId(xml.readElementText());
0023             } else if (xml.name() == QLatin1String("name")) {
0024                 folder.setName(xml.readElementText());
0025             } else if (xml.name() == QLatin1String("messagecount")) {
0026                 folder.setMessageCount(xml.readElementText().toInt());
0027             } else if (xml.name() == QLatin1String("type")) {
0028                 folder.setType(xml.readElementText());
0029             }
0030         } else if (xml.isEndElement() && xml.name() == QLatin1String("folder")) {
0031             break;
0032         }
0033     }
0034 
0035     return folder;
0036 }
0037 
0038 QStringList Folder::Parser::xmlElement() const
0039 {
0040     return QStringList(QStringLiteral("folder"));
0041 }