Attica

remoteaccountparser.cpp
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2010 Sebastian Kügler <sebas@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "remoteaccountparser.h"
10#include <qdebug.h>
11
12using namespace Attica;
13
14RemoteAccount RemoteAccount::Parser::parseXml(QXmlStreamReader &xml)
15{
17
18 // For specs about the XML provided, see here:
19 // http://www.freedesktop.org/wiki/Specifications/open-collaboration-services-draft#RemoteAccounts
20 while (!xml.atEnd()) {
21 // qCDebug(ATTICA) << "XML returned:" << xml.text().toString();
22 xml.readNext();
23
24 if (xml.isStartElement()) {
25 if (xml.name() == QLatin1String("id")) {
26 remoteaccount.setId(xml.readElementText());
27 } else if (xml.name() == QLatin1String("type")) {
28 remoteaccount.setType(xml.readElementText());
29 } else if (xml.name() == QLatin1String("typeid")) { // FIXME: change to remoteserviceid sometime soon (OCS API change pending
30 remoteaccount.setRemoteServiceId(xml.readElementText());
31 } else if (xml.name() == QLatin1String("data")) {
32 remoteaccount.setData(xml.readElementText());
33 } else if (xml.name() == QLatin1String("login")) {
34 remoteaccount.setLogin(xml.readElementText());
35 } else if (xml.name() == QLatin1String("password")) {
36 remoteaccount.setPassword(xml.readElementText());
37 }
38 } else if (xml.isEndElement() && (xml.name() == QLatin1String("remoteaccount") || xml.name() == QLatin1String("user"))) {
39 break;
40 }
41 }
42 return remoteaccount;
43}
44
45QStringList RemoteAccount::Parser::xmlElement() const
46{
47 return QStringList(QStringLiteral("remoteaccount")) << QStringLiteral("user");
48}
Represents an item post job.
Definition itemjob.h:66
Represents a remote account.
The Attica namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.