X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Flatitude.cpp;h=12ccf5c334099875b9d68695f9a6303746487925;hp=33e87194fce3d9bdf353fa11337b7b17582f0eea;hb=dafb08cf2b5b0081bec9f0d4ae293367fffd0af2;hpb=5a837906fe9cee9952da7c38e0987857b214d63d;ds=sidebyside diff --git a/src/latitude.cpp b/src/latitude.cpp index 33e8719..12ccf5c 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()+"/GoogleLatitudeDaemon"); + qDebug() << "LatitudeGUI: demonio " << QCoreApplication::applicationDirPath()+"/GoogleLatitudeDaemon"; + if ( ! system("killall -0 GoogleLatitudeDaemon 2> /dev/null" ) ) { + demonio->setText(tr("&Stop Daemon")); + } + } +}