Backport of QGeo*InfoSourceMaemo5 and others fixes
[googlelatitude] / latitudeqml.h
1 #ifndef LatitudeQML_H
2 #define LatitudeQML_H
3
4 #include <QObject>
5 #include <QtDeclarative/QDeclarativeView>
6 #include <QtCore/QProcess>
7 #include <QtCore/QCoreApplication>
8 #include <QtCore/QDir>
9 #include <QtCore/QFile>
10 #include "googlelatitude.h"
11 #include "gpscontrol.h"
12
13 class LatitudeQML : public QDeclarativeView {
14     Q_OBJECT
15 public:
16     LatitudeQML(QDeclarativeView *parent = 0);
17
18 signals:
19
20 public slots:
21     bool demonio_status() {
22         qDebug() << "LatitudeQML::demonio_status";
23         if (system("killall -0 LatitudeUpdaterDaemon 2> /dev/null" )) {
24             return false;
25         }
26         return true;
27     }
28     bool demonio_start() {
29         qDebug() << "LatitudeQML::demonio_start";
30         if (demonioOpt.exists()) {
31             qDebug() << "LatitudeQML:: demonio opt";
32             cli.startDetached(demonioOpt.fileName());
33             return true;
34         }
35         if (demonioSdk.exists()) {
36             qDebug() << "LatitudeQML:: demonio sdk";
37             cli.startDetached(demonioSdk.fileName());
38             return true;
39         }
40         qDebug() << "LatitudeQML:: demonio none";
41         return false;
42     }
43     bool demonio_stop() {
44         qDebug() << "LatitudeQML::demonio_stop";
45         if (demonioOpt.exists() || demonioSdk.exists() ) {
46             qDebug() << "LatitudeQML:: demonio kill" << system("killall LatitudeUpdaterDaemon 2> /dev/null");
47             return true;
48         }
49         return false;
50     }
51
52 private slots:
53
54 private:
55     GoogleLatitude latitude;
56     GpsControl gps;
57     QFile demonioOpt;
58     QFile demonioSdk;
59     QProcess cli;
60 };
61
62 #endif // LatitudeQML_H