File indexing completed on 2024-12-08 03:37:10
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2012 Laszlo Papp <lpapp@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 "cloudparser.h" 0010 #include "atticautils.h" 0011 0012 using namespace Attica; 0013 0014 Cloud Cloud::Parser::parseXml(QXmlStreamReader &xml) 0015 { 0016 Cloud cloud; 0017 0018 while (!xml.atEnd()) { 0019 xml.readNext(); 0020 0021 if (xml.isStartElement()) { 0022 if (xml.name() == QLatin1String("name")) { 0023 cloud.setName(xml.readElementText()); 0024 } else if (xml.name() == QLatin1String("url")) { 0025 cloud.setUrl(xml.readElementText()); 0026 // TODO: there should be usage for the attica icon class 0027 } else if (xml.name() == QLatin1String("icon")) { 0028 cloud.setIcon(QUrl(xml.readElementText())); 0029 } else if (xml.name() == QLatin1String("quota")) { 0030 cloud.setQuota(xml.readElementText().toULongLong()); 0031 } else if (xml.name() == QLatin1String("free")) { 0032 cloud.setFree(xml.readElementText().toULongLong()); 0033 } else if (xml.name() == QLatin1String("used")) { 0034 cloud.setUsed(xml.readElementText().toULongLong()); 0035 } else if (xml.name() == QLatin1String("relative")) { 0036 cloud.setRelative(xml.readElementText().toFloat()); 0037 } else if (xml.name() == QLatin1String("key")) { 0038 cloud.setKey(xml.readElementText()); 0039 } 0040 } else if (xml.isEndElement() && xml.name() == QLatin1String("cloud")) { 0041 break; 0042 } 0043 } 0044 0045 return cloud; 0046 } 0047 0048 QStringList Cloud::Parser::xmlElement() const 0049 { 0050 return QStringList(QLatin1String("cloud")); 0051 }