Initial checkin
[opensuse:qtobs.git] / userxmlreader.cpp
1 /*
2  *  Qt OBS - A Qt based OBS client
3  *
4  *  Copyright (C) 2010 Novell Inc, Klaas Freitag <freitag@suse.de>
5  *
6  *  This program is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 2 of the License, or
9  *  (at your option) version 3.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *  --
20  *  Written by Klaas Freitag <freitag@suse.de>
21  *  Contributors:
22  */
23
24 #include <QDebug>
25
26 #include "userxmlreader.h"
27
28 UserXmlReader::UserXmlReader()
29     :OBSXmlReader()
30 {
31
32 }
33
34 bool UserXmlReader::read( QIODevice* dev )
35 {
36   setDevice( dev );
37
38   while (!atEnd()) {
39     readNext();
40
41     if( isStartElement() ) {
42       qDebug() << "XML name: " << name();
43       if( name() == "login" ) {
44         mLogin = readElementText();
45       } else if( name() == "email" ) {
46         mEmail = readElementText();
47       } else if( name() == "realname" ) {
48         mRealname = readElementText();
49       }
50     }
51   }
52   return !error();
53 }
54
55 QString UserXmlReader::login() const
56 {
57   return mLogin;
58 }
59
60 QString UserXmlReader::email() const
61 {
62   return mEmail;
63 }
64
65 QString UserXmlReader::realName() const
66 {
67   return mRealname;
68 }
69
70