Warning, file /frameworks/attica/src/remoteaccountparser.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: 2010 Sebastian K├╝gler <sebas@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 "remoteaccountparser.h"
0010 #include <qdebug.h>
0011 
0012 using namespace Attica;
0013 
0014 RemoteAccount RemoteAccount::Parser::parseXml(QXmlStreamReader &xml)
0015 {
0016     RemoteAccount remoteaccount;
0017 
0018     // For specs about the XML provided, see here:
0019     // http://www.freedesktop.org/wiki/Specifications/open-collaboration-services-draft#RemoteAccounts
0020     while (!xml.atEnd()) {
0021         // qCDebug(ATTICA) << "XML returned:" << xml.text().toString();
0022         xml.readNext();
0023 
0024         if (xml.isStartElement()) {
0025             if (xml.name() == QLatin1String("id")) {
0026                 remoteaccount.setId(xml.readElementText());
0027             } else if (xml.name() == QLatin1String("type")) {
0028                 remoteaccount.setType(xml.readElementText());
0029             } else if (xml.name() == QLatin1String("typeid")) { // FIXME: change to remoteserviceid sometime soon (OCS API change pending
0030                 remoteaccount.setRemoteServiceId(xml.readElementText());
0031             } else if (xml.name() == QLatin1String("data")) {
0032                 remoteaccount.setData(xml.readElementText());
0033             } else if (xml.name() == QLatin1String("login")) {
0034                 remoteaccount.setLogin(xml.readElementText());
0035             } else if (xml.name() == QLatin1String("password")) {
0036                 remoteaccount.setPassword(xml.readElementText());
0037             }
0038         } else if (xml.isEndElement() && (xml.name() == QLatin1String("remoteaccount") || xml.name() == QLatin1String("user"))) {
0039             break;
0040         }
0041     }
0042     return remoteaccount;
0043 }
0044 
0045 QStringList RemoteAccount::Parser::xmlElement() const
0046 {
0047     return QStringList(QStringLiteral("remoteaccount")) << QStringLiteral("user");
0048 }