committing work in progress
[ptas] / zouba / src / journey_p.cpp
1 #include "locations.h"
2 #include "location.h"
3
4 #include "journey_p.h"
5
6 JourneyPrivate::JourneyPrivate():
7   m_from(),
8   m_to(),
9   m_label()
10 {
11 }
12
13 JourneyPrivate::~JourneyPrivate()
14 {
15 }
16
17 void JourneyPrivate::setFrom( const QString &from )
18 {
19   m_from = from;
20
21   setValid( fromAndToAreValid() );
22 }
23
24 QString JourneyPrivate::from() const
25 {
26   return m_from;
27 }
28
29 void JourneyPrivate::setTo( const QString &to )
30 {
31   m_to = to;
32
33   setValid( fromAndToAreValid() );
34 }
35
36 QString JourneyPrivate::to() const
37 {
38   return m_to;
39 }
40
41 void JourneyPrivate::setLabel( const QString &label )
42 {
43   m_label = label;
44 }
45
46 QString JourneyPrivate::label() const
47 {
48   return m_label;
49 }
50
51 void JourneyPrivate::setValid( bool valid )
52 {
53   m_valid = valid;
54 }
55
56 bool JourneyPrivate::isValid() const
57 {
58   return m_valid;
59 }
60
61 bool JourneyPrivate::fromAndToAreValid() const
62 {
63   bool retVal = false;
64
65   Locations locations;
66   Location *fromLocation = locations.location( m_from );
67   Location *toLocation   = locations.location( m_to );
68
69   retVal = fromLocation==0 && fromLocation->isValid() &&
70            toLocation==0   && toLocation->isValid();
71   
72   return retVal;
73 }