X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Flatitude.cpp;h=1aaae620a612b92ebb2703c555d8cfa6fb86f584;hp=33e87194fce3d9bdf353fa11337b7b17582f0eea;hb=38d7be1cf5dfdc33866134f12389c11c0b5b73ea;hpb=4fe4a04458ce7f275738bff27f00565dc500e4fc diff --git a/src/latitude.cpp b/src/latitude.cpp index 33e8719..1aaae62 100644 --- a/src/latitude.cpp +++ b/src/latitude.cpp @@ -17,6 +17,15 @@ LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) { menuBar()->addAction(tr("&Buzz"), this, SLOT(mode_buzz())); menuBar()->addAction(tr("&Config"), this, SLOT(config())); + demonio = new QAction(this); + if ( system("killall -0 GoogleLatitudeDaemon 2> /dev/null" ) ) { + demonio->setText(tr("&Start Daemon")); + } else { + demonio->setText(tr("&Stop Daemon")); + } + connect(demonio, SIGNAL(triggered()), this, SLOT(mode_demonio())); + menuBar()->addAction(demonio); + // updater glatitude = new GoogleLatitude(this); gps = new GpsMaemo5(this); @@ -107,3 +116,17 @@ void LatitudeGUI::maps_login() { maps->page()->mainFrame()->evaluateJavaScript("document.getElementById('gaia_loginform').submit();"); } } + +void LatitudeGUI::mode_demonio() { + if ( ! system("killall -0 GoogleLatitudeDaemon 2> /dev/null" ) ) { + system("killall GoogleLatitudeDaemon 2> /dev/null"); + demonio->setText(tr("&Start Daemon")); + } else { + QProcess *cli = new QProcess(this); + cli->start(QCoreApplication::applicationDirPath()+QDir::separator()+"GoogleLatitudeDaemon"); + qDebug() << "LatitudeGUI: demonio" << QCoreApplication::applicationDirPath()+"/GoogleLatitudeDaemon"; + if ( ! system("killall -0 GoogleLatitudeDaemon 2> /dev/null" ) ) { + demonio->setText(tr("&Stop Daemon")); + } + } +}