Incorporated changes from bus project.
[ptas] / src / route_p.cpp
1 #include "route_p.h"
2 #include "location.h"
3 #include "xmlparser.h"
4
5 #include <QXmlStreamReader>
6 #include <QDebug>
7 #include <QList>
8 #include <QFile>
9 #include <QStringList>
10 #include <QMaemo5InformationBox>
11
12 RoutePrivate::RoutePrivate(QObject *parent) :
13     m_fromValid(false),
14     m_toValid(false),
15     m_fromLocation(0),
16     m_toLocation(0)
17 {
18     Q_UNUSED(parent)
19 }
20
21 RoutePrivate::~RoutePrivate()
22 {
23 }
24
25 QList<RouteData> RoutePrivate::parseReply(const QByteArray &reply)
26 {
27     qDebug() << "parsing route/" << reply;
28
29     XmlParser parser;
30     QList<RouteData> retVal = parser.parseRouteData(reply);
31
32     if (retVal.isEmpty()) {
33         qDebug() << "no routes found";
34         QMaemo5InformationBox::information(0, "no routes found");
35     }
36
37     return retVal;
38 }
39
40 void RoutePrivate::setFromLocation(Location *location)
41 {
42     m_fromLocation = location;
43     m_fromValid = true;
44 }
45
46 Location *RoutePrivate::fromLocation() const
47 {
48     return m_fromLocation;
49 }
50
51 void RoutePrivate::setToLocation(Location *toLocation)
52 {
53     m_toLocation = toLocation;
54     m_toValid = true;
55 }
56
57 Location *RoutePrivate::toLocation() const
58 {
59     return m_toLocation;
60 }
61
62 bool RoutePrivate::fromValid()
63 {
64     return m_fromValid;
65 }
66
67 bool RoutePrivate::toValid()
68 {
69     return m_toValid;
70 }