Added dialogs to change home and work locations.
[ptas] / zouba / locations.cpp
1 #include "locations.h"
2
3 #include <QDebug>
4
5 QHash<QString,Location *> Locations::locationHash;
6
7 Locations::Locations()
8 {
9 }
10
11 Locations::~Locations()
12 {
13 }
14
15 bool Locations::addLocation( Location *location )
16 {
17   bool succeeded=false;
18
19   if ( !locationHash.contains( location->label() ) ) {
20     qDebug() << "Adding location" << location->label();
21     locationHash[ location->label() ] = location;
22     succeeded = true;
23   }
24
25   return succeeded;
26 }
27
28 Location *Locations::location( const QString &label )
29 {
30   Location *retVal = 0;
31
32   if ( locationHash.contains( label ) ) {
33     retVal = locationHash[ label ];
34   }
35
36   return retVal;
37 }