Warning, file /frameworks/attica/src/messageparser.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 "messageparser.h" 0010 0011 using namespace Attica; 0012 0013 Message Message::Parser::parseXml(QXmlStreamReader &xml) 0014 { 0015 Message message; 0016 0017 while (!xml.atEnd()) { 0018 xml.readNext(); 0019 0020 if (xml.isStartElement()) { 0021 if (xml.name() == QLatin1String("id")) { 0022 message.setId(xml.readElementText()); 0023 } else if (xml.name() == QLatin1String("messagefrom")) { 0024 message.setFrom(xml.readElementText()); 0025 } else if (xml.name() == QLatin1String("messageto")) { 0026 message.setTo(xml.readElementText()); 0027 } else if (xml.name() == QLatin1String("senddate")) { 0028 message.setSent(QDateTime::fromString(xml.readElementText(), Qt::ISODate)); 0029 } else if (xml.name() == QLatin1String("status")) { 0030 message.setStatus(Message::Status(xml.readElementText().toInt())); 0031 } else if (xml.name() == QLatin1String("subject")) { 0032 message.setSubject(xml.readElementText()); 0033 } else if (xml.name() == QLatin1String("body")) { 0034 message.setBody(xml.readElementText()); 0035 } 0036 } 0037 0038 if (xml.isEndElement() && xml.name() == QLatin1String("message")) { 0039 break; 0040 } 0041 } 0042 0043 return message; 0044 } 0045 0046 QStringList Message::Parser::xmlElement() const 0047 { 0048 return QStringList(QStringLiteral("message")); 0049 }