Attica

folderparser.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2008 Cornelius Schumacher <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #include "folderparser.h"
10 
11 using namespace Attica;
12 
13 Folder Folder::Parser::parseXml(QXmlStreamReader &xml)
14 {
15  Folder folder;
16 
17  while (!xml.atEnd()) {
18  xml.readNext();
19 
20  if (xml.isStartElement()) {
21  if (xml.name() == QLatin1String("id")) {
22  folder.setId(xml.readElementText());
23  } else if (xml.name() == QLatin1String("name")) {
24  folder.setName(xml.readElementText());
25  } else if (xml.name() == QLatin1String("messagecount")) {
26  folder.setMessageCount(xml.readElementText().toInt());
27  } else if (xml.name() == QLatin1String("type")) {
28  folder.setType(xml.readElementText());
29  }
30  } else if (xml.isEndElement() && xml.name() == QLatin1String("folder")) {
31  break;
32  }
33  }
34 
35  return folder;
36 }
37 
38 QStringList Folder::Parser::xmlElement() const
39 {
40  return QStringList(QStringLiteral("folder"));
41 }
bool atEnd() const const
void setId(const QString &id)
Sets the id of the Folder.
Definition: folder.cpp:47
void setMessageCount(int messageCount)
Sets the number of messages in the Folder.
Definition: folder.cpp:67
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
void setType(const QString &type)
Sets the type of the folder.
Definition: folder.cpp:77
int toInt(bool *ok, int base) const const
QXmlStreamReader::TokenType readNext()
bool isStartElement() const const
void setName(const QString &name)
Sets the name of the Folder.
Definition: folder.cpp:57
QStringRef name() const const
Represents a single mail folder.
Definition: folder.h:23
bool isEndElement() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.