Initial drop of the GCS code.
[meego-garage:garage-client-services.git] / src / garageclientservices.cpp
1 #include "garageclientservices.h"
2 #include <QTimer>
3
4 using namespace MeeGoGarage;
5
6 QNetworkAccessManager* GarageClientServices::networkAccessManager = NULL;
7
8 QNetworkAccessManager *GarageClientServices::getNetworkAccessManager()
9 {
10     if (networkAccessManager == NULL)
11         networkAccessManager = new QNetworkAccessManager();
12
13     return networkAccessManager;
14 }
15
16 void GarageClientServices::releaseNetworkAccessManager()
17 {
18     if (networkAccessManager != NULL)
19         delete networkAccessManager;
20 }
21
22 GarageClientServices::GarageClientServices()
23 {
24     webclient = new WebClient();
25     //TODO: start GCS initialization. Check repo and garage update from WebServer
26
27     QTimer *timer = new QTimer(this);
28     timer->setSingleShot(TRUE);
29     connect(timer, SIGNAL(timeout()), SLOT(testTimeout()));
30     timer->start(1000);
31 }
32
33 Catalog *GarageClientServices::getCatalog()
34 {
35     return catalog;
36 }
37
38 void GarageClientServices::testTimeout()
39 {
40     //Initialization done, we are able to create catalog
41     catalog = new Catalog();
42
43     emit garageClientServicesInitialized(0);
44 }