File indexing completed on 2025-02-09 04:18:53
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 "privatedataparser.h" 0010 0011 using namespace Attica; 0012 0013 PrivateData PrivateData::Parser::parseXml(QXmlStreamReader &xml) 0014 { 0015 PrivateData data; 0016 QString key; 0017 0018 // TODO: when we get internet and some documentation 0019 while (!xml.atEnd()) { 0020 xml.readNext(); 0021 0022 if (xml.isStartElement()) { 0023 if (xml.name() == QLatin1String("key")) { 0024 key = xml.readElementText(); 0025 } else if (xml.name() == QLatin1String("value")) { 0026 data.setAttribute(key, xml.readElementText()); 0027 } else if (xml.name() == QLatin1String("timestamp")) { 0028 data.setTimestamp(key, QDateTime::fromString(xml.readElementText(), Qt::ISODate)); 0029 } 0030 } else if (xml.isEndElement() && (xml.name() == QLatin1String("data") || xml.name() == QLatin1String("user"))) { 0031 break; 0032 } 0033 } 0034 0035 return data; 0036 } 0037 0038 QStringList PrivateData::Parser::xmlElement() const 0039 { 0040 return QStringList(QStringLiteral("privatedata")); 0041 }