Enable Daemon Option, submit for testing
[googlelatitude] / latitudeqml.h
index 13c8b27..c868551 100644 (file)
@@ -3,6 +3,10 @@
 
 #include <QObject>
 #include <QtDeclarative/QDeclarativeView>
+#include <QtCore/QProcess>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
 #include "googlelatitude.h"
 #include "gpscontrol.h"
 
@@ -14,12 +18,45 @@ public:
 signals:
 
 public slots:
+    bool demonio_status() {
+        qDebug() << "LatitudeQML::demonio_status";
+        if (system("killall -0 LatitudeUpdaterDaemon 2> /dev/null" )) {
+            return false;
+        }
+        return true;
+    }
+    bool demonio_start() {
+        qDebug() << "LatitudeQML::demonio_start";
+        if (demonioOpt.exists()) {
+            qDebug() << "LatitudeQML:: demonio opt";
+            cli.startDetached(demonioOpt.fileName());
+            return true;
+        }
+        if (demonioSdk.exists()) {
+            qDebug() << "LatitudeQML:: demonio sdk";
+            cli.startDetached(demonioSdk.fileName());
+            return true;
+        }
+        qDebug() << "LatitudeQML:: demonio none";
+        return false;
+    }
+    bool demonio_stop() {
+        qDebug() << "LatitudeQML::demonio_stop";
+        if (demonioOpt.exists() || demonioSdk.exists() ) {
+            qDebug() << "LatitudeQML:: demonio kill" << system("killall LatitudeUpdaterDaemon 2> /dev/null");
+            return true;
+        }
+        return false;
+    }
 
 private slots:
 
 private:
     GoogleLatitude latitude;
     GpsControl gps;
+    QFile demonioOpt;
+    QFile demonioSdk;
+    QProcess cli;
 };
 
 #endif // LatitudeQML_H