From 26b02985c72432ad0927b4f69656106423d1ab58 Mon Sep 17 00:00:00 2001 From: Rodrigo Linfati Date: Sat, 22 Jan 2011 18:47:03 +0100 Subject: [PATCH] Revert "Changed the old code to work as a daemon" This reverts commit b68b97db1eef408a0ce84201311042c2c1619aff. --- data/glupdater | 12 -- data/googlelatitude.desktop | 2 +- data/libglsettingsplugin.desktop | 10 -- debian/changelog | 9 -- debian/googlelatitude.install | 6 +- googlelatitude.pro | 22 ++- src/common/dbusclient.cpp | 62 -------- src/common/dbusclient.h | 36 ----- src/daemon/customuseragentpage.h | 19 --- src/daemon/daemon.pro | 49 ------- src/daemon/dbusadaptor.cpp | 32 ----- src/daemon/dbusadaptor.h | 33 ----- src/daemon/glatitude.cpp | 76 ---------- src/daemon/glatitude.h | 45 ------ src/daemon/gps.cpp | 73 ---------- src/daemon/gps.h | 63 -------- src/daemon/latitude-backup.cpp | 101 ------------- src/daemon/latitude-backup.h | 39 ----- src/daemon/latitude.cpp | 161 --------------------- src/daemon/latitude.h | 52 ------- src/daemon/main.cpp | 42 ------ src/daemon/qwebviewselectionsuppressor.h | 110 -------------- src/glatitude.cpp | 72 ++++++++++ src/glatitude.h | 38 +++++ src/gps.cpp | 32 +++++ src/gps.h | 55 +++++++ src/latitude.cpp | 100 +++++++++++++ src/latitude.h | 39 +++++ src/main.cpp | 21 +++ src/settings/main.cpp | 25 ---- src/settings/settings.cpp | 217 ---------------------------- src/settings/settings.h | 55 ------- src/settings/settings.pro | 34 ----- src/settings/settings.ui | 206 -------------------------- src/settings/ui_settings.h | 230 ------------------------------ src/settingsplugin/.directory | 7 - src/settingsplugin/settingsplugin.c | 34 ----- src/settingsplugin/settingsplugin.pro | 31 ---- src/src.pro | 8 -- 39 files changed, 374 insertions(+), 1884 deletions(-) delete mode 100644 data/glupdater delete mode 100644 data/libglsettingsplugin.desktop delete mode 100644 src/common/dbusclient.cpp delete mode 100644 src/common/dbusclient.h delete mode 100644 src/daemon/customuseragentpage.h delete mode 100644 src/daemon/daemon.pro delete mode 100644 src/daemon/dbusadaptor.cpp delete mode 100644 src/daemon/dbusadaptor.h delete mode 100644 src/daemon/glatitude.cpp delete mode 100644 src/daemon/glatitude.h delete mode 100644 src/daemon/gps.cpp delete mode 100644 src/daemon/gps.h delete mode 100644 src/daemon/latitude-backup.cpp delete mode 100644 src/daemon/latitude-backup.h delete mode 100644 src/daemon/latitude.cpp delete mode 100644 src/daemon/latitude.h delete mode 100644 src/daemon/main.cpp delete mode 100644 src/daemon/qwebviewselectionsuppressor.h create mode 100644 src/glatitude.cpp create mode 100644 src/glatitude.h create mode 100644 src/gps.cpp create mode 100644 src/gps.h create mode 100644 src/latitude.cpp create mode 100644 src/latitude.h create mode 100644 src/main.cpp delete mode 100644 src/settings/main.cpp delete mode 100644 src/settings/settings.cpp delete mode 100644 src/settings/settings.h delete mode 100644 src/settings/settings.pro delete mode 100644 src/settings/settings.ui delete mode 100644 src/settings/ui_settings.h delete mode 100644 src/settingsplugin/.directory delete mode 100644 src/settingsplugin/settingsplugin.c delete mode 100644 src/settingsplugin/settingsplugin.pro delete mode 100644 src/src.pro diff --git a/data/glupdater b/data/glupdater deleted file mode 100644 index 54d7055..0000000 --- a/data/glupdater +++ /dev/null @@ -1,12 +0,0 @@ -author "Danilo Luvizotto " -description "Google Latitude Updater Daemon" - -start on started hildon-desktop - -console output - -post-stop script - killall -9 googlelatitude-daemon -end script - -exec /bin/su - user -c "/opt/linfati.com/googlelatitude-daemon -s" diff --git a/data/googlelatitude.desktop b/data/googlelatitude.desktop index 8879ef5..80f40a7 100644 --- a/data/googlelatitude.desktop +++ b/data/googlelatitude.desktop @@ -3,7 +3,7 @@ Encoding=UTF-8 Version=1.0 Type=Application Name=Google Latitude Update -Exec=/opt/linfati.com/googlelatitude-daemon +Exec=/opt/linfati.com/googlelatitude Icon=googlelatitude X-HildonDesk-ShowInToolbar=true X-Osso-Type=application/x-executable diff --git a/data/libglsettingsplugin.desktop b/data/libglsettingsplugin.desktop deleted file mode 100644 index dbd3f3a..0000000 --- a/data/libglsettingsplugin.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=Google Latitude Updater -Comment=Google Latitude Updater Settings -Type=HildonControlPanelPlugin -Icon=googlelatitude -X-control-panel-plugin=libglsettingsplugin.so -Categories=connectivity - diff --git a/debian/changelog b/debian/changelog index c2147d3..e8581be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,3 @@ -googlelatitude (0.5-0) unstable; urgency=low - - * Changed the old code to work as a daemon - * Implemented dbus (adaptor and client) - * Added a settings plugin to the system settings with various options - * Maybe more - - -- Danilo Luvizotto Thu, 06 Jan 2011 18:34:12 +0200 - googlelatitude (0.4-0) unstable; urgency=low * Bump version diff --git a/debian/googlelatitude.install b/debian/googlelatitude.install index 3d3c273..51f5a6a 100644 --- a/debian/googlelatitude.install +++ b/debian/googlelatitude.install @@ -1,7 +1,3 @@ data/googlelatitude.desktop usr/share/applications/hildon data/googlelatitude.png usr/share/icons/hicolor/64x64/apps -data/libglsettingsplugin.desktop usr/share/applications/hildon-control-panel -data/glupdater etc/event.d -src/daemon/build/googlelatitude-daemon opt/linfati.com -src/settings/build/googlelatitude-settings opt/linfati.com -src/settingsplugin/build/libglsettingsplugin.so usr/lib/hildon-control-panel +build/googlelatitude opt/linfati.com diff --git a/googlelatitude.pro b/googlelatitude.pro index d97061d..8eb75e0 100644 --- a/googlelatitude.pro +++ b/googlelatitude.pro @@ -1,8 +1,16 @@ -QMAKEVERSION = $$[QMAKE_VERSION] -ISQT4 = $$find(QMAKEVERSION, ^[2-9]) -isEmpty( ISQT4 ) { -error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"); -} +TARGET = googlelatitude +HEADERS += src/latitude.h src/glatitude.h src/gps.h +SOURCES += src/main.cpp src/latitude.cpp src/glatitude.cpp src/gps.cpp + +OBJECTS_DIR = build +MOC_DIR = build +DESTDIR = build -TEMPLATE = subdirs -SUBDIRS = src +TEMPLATE = app +QT += network webkit + +contains(QT_CONFIG, maemo5) { + QT += maemo5 + CONFIG += link_pkgconfig + PKGCONFIG += glib-2.0 liblocation +} diff --git a/src/common/dbusclient.cpp b/src/common/dbusclient.cpp deleted file mode 100644 index 870af53..0000000 --- a/src/common/dbusclient.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "dbusclient.h" - -#ifdef Q_WS_MAEMO_5 -#include -#include -#include - -QDBusConnection DBusClient::system_bus(QDBusConnection::systemBus()); -QDBusConnection DBusClient::session_bus(QDBusConnection::sessionBus()); -QDBusInterface* DBusClient::icd_interface = new QDBusInterface(ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_PATH, - ICD_DBUS_API_INTERFACE, - system_bus); -QDBusInterface* DBusClient::gl_interface = new QDBusInterface("com.linfati.GoogleLatitude", - "/", - "com.linfati.GoogleLatitude", - session_bus); - -DBusClient::DBusClient(QObject *parent) : - QObject(parent) -{ - QDBusConnection::systemBus().connect(ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_PATH, - ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_CONNECT_SIG, - this, - SLOT(networkStateChanged())); -} - -bool DBusClient::daemonRunning() -{ - return ((QDBusReply)gl_interface->call("running")).value(); -} - -bool DBusClient::networkConnected() -{ - QDBusReply reply = icd_interface->call(ICD_DBUS_API_STATE_REQ); - - return (reply.value() > 0) ? true : false; -} - -void DBusClient::networkStateChanged() -{ - networkConnected() ? emit sigNetworkConnected() : sigNetworkDisconnected(); -} - - -void DBusClient::quitDaemon() -{ - gl_interface->call("quit"); -} - -void DBusClient::reloadDaemonConfig() -{ - gl_interface->call("reparseConfiguration"); -} - -void DBusClient::showWindow() -{ - gl_interface->call("show"); -} -#endif diff --git a/src/common/dbusclient.h b/src/common/dbusclient.h deleted file mode 100644 index 5408554..0000000 --- a/src/common/dbusclient.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef DBUSCLIENT_H -#define DBUSCLIENT_H - - -#include -#ifdef Q_WS_MAEMO_5 -#include -#include - -class DBusClient : public QObject -{ - Q_OBJECT -public: - explicit DBusClient(QObject *parent = 0); - static bool daemonRunning(); - static bool networkConnected(); - static void quitDaemon(); - static void reloadDaemonConfig(); - static void showWindow(); - -signals: - void sigNetworkConnected(); - void sigNetworkDisconnected(); - -public slots: - void networkStateChanged(); - -private: - static QDBusConnection system_bus; - static QDBusConnection session_bus; - static QDBusInterface *icd_interface; - static QDBusInterface *gl_interface; -}; - -#endif //Q_WS_MAEMO_5 -#endif // DBUSCLIENT_H diff --git a/src/daemon/customuseragentpage.h b/src/daemon/customuseragentpage.h deleted file mode 100644 index 6dddd1d..0000000 --- a/src/daemon/customuseragentpage.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CUSTOMUSERAGENTPAGE_H -#define CUSTOMUSERAGENTPAGE_H - -#include - -class customUAPage : public QWebPage -{ - Q_OBJECT - -public: - customUAPage(QObject* parent = 0) : QWebPage(parent) {} - -protected: - QString userAgentForUrl(const QUrl &url ) const - {return QString("Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Mobile");} - -}; - -#endif // CUSTOMUSERAGENTPAGE_H diff --git a/src/daemon/daemon.pro b/src/daemon/daemon.pro deleted file mode 100644 index a31f517..0000000 --- a/src/daemon/daemon.pro +++ /dev/null @@ -1,49 +0,0 @@ -TARGET = googlelatitude-daemon -HEADERS += latitude.h glatitude.h gps.h \ - dbusadaptor.h ../common/dbusclient.h \ - qwebviewselectionsuppressor.h \ - customuseragentpage.h -SOURCES += main.cpp latitude.cpp glatitude.cpp gps.cpp \ - dbusadaptor.cpp ../common/dbusclient.cpp - -OBJECTS_DIR = build -MOC_DIR = build -DESTDIR = build - -TEMPLATE = app -QT += network webkit dbus - -contains(QT_CONFIG, maemo5) { - QT += maemo5 - CONFIG += link_pkgconfig - PKGCONFIG += glib-2.0 liblocation -} - -unix { - #VARIABLES - isEmpty(PREFIX) { - PREFIX = /usr - } - BINDIR = $$PREFIX/bin - DATADIR =$$PREFIX/share - - DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" - - #MAKE INSTALL - - INSTALLS += target desktop icon64 updater - target.path =$$BINDIR - - #service.path = $$DATADIR/dbus-1/services - #service.files += $${TARGET}.service - - desktop.path = $$DATADIR/applications/hildon - desktop.files += ../../data/googlelatitude.desktop - - icon64.path = $$DATADIR/icons/hicolor/64x64/apps - icon64.files += ../../data/googlelatitude.png - - updater.path = /etc/event.d - updater.files += ../../data/glupdater -} - diff --git a/src/daemon/dbusadaptor.cpp b/src/daemon/dbusadaptor.cpp deleted file mode 100644 index 159df5d..0000000 --- a/src/daemon/dbusadaptor.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "dbusadaptor.h" - -#include - -DBusAdaptor::DBusAdaptor(QApplication *application) : - QDBusAbstractAdaptor(application), app(application) -{} - -void DBusAdaptor::quit() -{ - exit(0); -} - -void DBusAdaptor::reparseConfiguration() -{ - daemon->reparseConfiguration(); -} - -bool DBusAdaptor::running() -{ - return true; -} - -void DBusAdaptor::setDaemon(LatitudeGUI* d) -{ - daemon = d; -} - -void DBusAdaptor::show() -{ - daemon->show(); -} diff --git a/src/daemon/dbusadaptor.h b/src/daemon/dbusadaptor.h deleted file mode 100644 index 5465015..0000000 --- a/src/daemon/dbusadaptor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef DBUSADAPTOR_H -#define DBUSADAPTOR_H - -#include -#include -#include -#include - -#include "latitude.h" - -class DBusAdaptor : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.linfati.GoogleLatitude") - -public: - explicit DBusAdaptor(QApplication *application); - void setDaemon(LatitudeGUI* d); - -signals: - -public slots: - Q_NOREPLY void quit(); - Q_NOREPLY void show(); - bool running(); - void reparseConfiguration(); - -private: - QApplication *app; - LatitudeGUI *daemon; -}; - -#endif // DBUSADAPTOR_H diff --git a/src/daemon/glatitude.cpp b/src/daemon/glatitude.cpp deleted file mode 100644 index 11dfd03..0000000 --- a/src/daemon/glatitude.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "glatitude.h" - -GoogleLatitude::GoogleLatitude(QObject *parent) : - QObject(parent) -{ - user = ""; - pass = ""; - latitude = 0.; - longitude = 0.; - accuracy = 0.; - - worker = new QNetworkAccessManager(); - connect(worker, SIGNAL(finished(QNetworkReply *)), this, SLOT(finishedreply(QNetworkReply *))); - - urllogin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview"); - urldologin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLoginAuth?service=friendview"); - urlupdate = QUrl::fromEncoded("http://maps.google.com/glm/mmap/mwmfr?hl=en"); - on = true; -} - -void GoogleLatitude::login(QString u, QString p) { - if ( !u.contains('@') ) u.append("@gmail.com"); - user = u; - pass = p; -} - -void GoogleLatitude::set(double la, double lo, double ac) { - latitude = la; - longitude = lo; - accuracy = ac; - - if (la*lo == 0) return; - if (!on) return; - worker->get(QNetworkRequest(urllogin)); -} - -void GoogleLatitude::finishedreply(QNetworkReply *r) { - if ( r->url() == urllogin ) { - QString aidis = r->readAll(); - QRegExp regexp ("type=\"hidden\".*name=\"GALX\".*value=\"(.*)\""); - regexp.setMinimal(1); - regexp.indexIn(aidis, 1); - QString googleGALX = regexp.capturedTexts().last(); - - QByteArray datalogin; - datalogin += "&service=friendview"; - datalogin += "&GALX=" + googleGALX; - datalogin += "&Email=" + user; - datalogin += "&Passwd=" + pass; - worker->post(QNetworkRequest(urldologin), datalogin); - } else if ( r->url() == urldologin ) { - QByteArray datagps; - datagps += "t=ul"; - datagps += "&lat=" + QString::number(latitude); - datagps += "&lng=" + QString::number(longitude); - datagps += "&accuracy=" + QString::number(accuracy); - - QNetworkRequest request(urlupdate); - request.setRawHeader("X-ManualHeader", QString("true").toAscii() ); - worker->post(request, datagps); - } else if ( r->url() == urlupdate ) { - QString output = r->readAll(); - QRegExp regexp ("Authentication required"); - if (regexp.indexIn(output, 1) != -1) { - emit ERROR(); - } else { - emit OK(); - } - qDebug() << output; - } else { - qDebug() << "Error"; - qDebug() << "url:" << r->url(); - qDebug() << r->rawHeaderList(); - qDebug() << r->readAll(); - } -} diff --git a/src/daemon/glatitude.h b/src/daemon/glatitude.h deleted file mode 100644 index 0085504..0000000 --- a/src/daemon/glatitude.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef GLATITUDE_H -#define GLATITUDE_H - -#include - -class GoogleLatitude : public QObject { - Q_OBJECT - -signals: - void OK(); - void ERROR(); - -public: - GoogleLatitude(QObject *parent = 0); - void login(QString username, QString password); - void set(double latitude, double longitude, double accuracy=1000.); - double get_lat() { return latitude; } - double get_lon() { return longitude; } - double get_acc() { return accuracy; } - -public slots: - void disableUpdates() { on = false; } - void enableUpdates() { on = true; } - void setUpdates(bool u) { on = u; } - -private slots: - void finishedreply(QNetworkReply *r); - -private: - // info - bool networkConnected(); - QString user; - QString pass; - double latitude; - double longitude; - double accuracy; - // stuff - QNetworkAccessManager *worker; - QUrl urllogin; - QUrl urldologin; - QUrl urlupdate; - bool on; -}; - -#endif // GLATITUDE_H diff --git a/src/daemon/gps.cpp b/src/daemon/gps.cpp deleted file mode 100644 index 0d28d98..0000000 --- a/src/daemon/gps.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "gps.h" - -#include - -#ifdef Q_WS_MAEMO_5 - -bool ValidQReal(qreal value); - -GpsMaemo5::GpsMaemo5(LocationGPSDControlInterval location_interval, - LocationGPSDControlMethod location_method, - QObject *parent) : - QObject(parent) -{ - latitude = 0; - longitude = 0; - accuracy = 0; - - control = location_gpsd_control_get_default(); - device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL); - - updateGPSConfig (location_interval, location_method); - - g_signal_connect(device, "changed", G_CALLBACK(GpsMaemo5_changed), this); -} - -void GpsMaemo5::enable() -{ - location_gpsd_control_start(control); -} -void GpsMaemo5::disable() -{ - location_gpsd_control_stop(control); -} - -void GpsMaemo5::updateGPSConfig (LocationGPSDControlInterval location_interval, - LocationGPSDControlMethod location_method) -{ - g_object_set(G_OBJECT(control), "preferred-interval", location_interval, NULL); - g_object_set(G_OBJECT(control), "preferred-method", location_method, NULL); - qDebug() << "preferred-interval: " << location_interval; - qDebug() << "preferred-method: " << location_method; -} - -void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) { - if (device->fix) { - if (device->fix->fields) { - if ( !ValidQReal(gps->device->fix->eph/100.) ) - return; - g_print("lat = %f, long = %f, eph = %f\n", gps->device->fix->latitude, gps->device->fix->longitude, gps->device->fix->eph/100.); - gps->latitude = gps->device->fix->latitude; - gps->longitude = gps->device->fix->longitude; - gps->accuracy = gps->device->fix->eph/100.; - emit gps->fix(); - } - } -} - -bool ValidQReal(qreal value) -{ - if (value != value){ - return false; - } - else if (value > std::numeric_limits::max()){ - return false; - } - else if (value < -std::numeric_limits::max()){ - return false; - } - else - return true; -} - -#endif // Q_WS_MAEMO_5 diff --git a/src/daemon/gps.h b/src/daemon/gps.h deleted file mode 100644 index e16c2fb..0000000 --- a/src/daemon/gps.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef GPS_H -#define GPS_H - -#include - -#ifdef Q_WS_MAEMO_5 - -extern "C" { -#include -#include -} - -class GpsMaemo5 : public QObject { - Q_OBJECT - -signals: - void fix(); - -public: - GpsMaemo5(LocationGPSDControlInterval location_interval, - LocationGPSDControlMethod location_method, - QObject *parent = 0); - double get_lat() { return latitude; } - double get_lon() { return longitude; } - double get_acc() { return accuracy; } - friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps); - void updateGPSConfig (LocationGPSDControlInterval interval, - LocationGPSDControlMethod method); - -public slots: - void enable(); - void disable(); - -private: - double latitude; - double longitude; - double accuracy; - - GMainLoop *loop; - LocationGPSDControl *control; - LocationGPSDevice *device; -}; - -void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps); - -#else // Q_WS_MAEMO_5 - -class GpsMaemo5 : public QObject { - Q_OBJECT - -signals: - void fix(); - -public: - GpsMaemo5(QObject *parent = 0) { Q_UNUSED(parent); } - double get_lat() { return 0; } - double get_lon() { return 0; } - double get_acc() { return 0; } -}; - -#endif // Q_WS_MAEMO_5 - -#endif // GPS_H diff --git a/src/daemon/latitude-backup.cpp b/src/daemon/latitude-backup.cpp deleted file mode 100644 index 40327a5..0000000 --- a/src/daemon/latitude-backup.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "latitude.h" - -LatitudeGUI::LatitudeGUI(QObject *parent) : QObject(parent) { -#ifdef Q_WS_MAEMO_5 - //setAttribute(Qt::WA_Maemo5AutoOrientation, true); -#endif - setting = new QSettings(); - - //TODO: move to settings - // login input - /* - QDialog *dialoglogin = new QDialog(); - QLineEdit *login_user = new QLineEdit(setting->value("user","my_username").toString()); - QLineEdit *login_pass = new QLineEdit(setting->value("pass","my_password").toString()); - login_pass->setEchoMode(QLineEdit::Password); - QFormLayout *layout_login = new QFormLayout(); - layout_login->addRow(tr("&Username"), login_user); - layout_login->addRow(tr("&Password"), login_pass); - connect(login_user, SIGNAL(textEdited(QString)), this, SLOT(save_user(QString))); - connect(login_pass, SIGNAL(textEdited(QString)), this, SLOT(save_pass(QString))); - connect(login_user, SIGNAL(returnPressed()), login_pass, SLOT(setFocus())); - connect(login_pass, SIGNAL(returnPressed()), dialoglogin, SLOT(accept())); - dialoglogin->setLayout(layout_login); - dialoglogin->exec(); - */ - - // GUI - url = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude"); - maps = new QWebView(); - maps->settings()->setAttribute(QWebSettings::PluginsEnabled, true); - connect(maps, SIGNAL(loadFinished(bool)), this, SLOT(maps_login())); - maps->load(url); - //menuBar()->addAction(tr("&Latitude"), this, SLOT(mode_latitude())); - //menuBar()->addAction(tr("&Buzz"), this, SLOT(mode_buzz())); - - // updater - glatitude = new GoogleLatitude(this); - gps = new GpsMaemo5(this); - connect(gps, SIGNAL(fix()), this, SLOT(set())); - connect(glatitude, SIGNAL(OK()), this, SLOT(latitude_OK())); - connect(glatitude, SIGNAL(ERROR()), this, SLOT(latitude_ERROR())); - - // show it - //setCentralWidget(maps); -} - -void LatitudeGUI::set() { -#ifdef Q_WS_MAEMO_5 - //QMaemo5InformationBox::information(this, "new position...", 1000); -#else - qDebug() << "new position..."; -#endif - glatitude->login(setting->value("user","my_username").toString(), - setting->value("pass","my_password").toString()); - glatitude->set(gps->get_lat(), - gps->get_lon(), - gps->get_acc()); -} - -void LatitudeGUI::latitude_OK() { -#ifdef Q_WS_MAEMO_5 - //QMaemo5InformationBox::information(this, "...location Sent!", 1000); -#else - qDebug() << "...location Sent!"; -#endif -} - -void LatitudeGUI::latitude_ERROR() { -#ifdef Q_WS_MAEMO_5 - //QMaemo5InformationBox::information(this, "Error in Authentification !", 3000); -#else - qDebug() << "Error in Authentification !"; -#endif -} - -void LatitudeGUI::save_user(QString _user) { - setting->setValue("user", _user); -} -void LatitudeGUI::save_pass(QString _pass) { - setting->setValue("pass", _pass); -} - -void LatitudeGUI::mode_buzz() { - maps->load(QUrl::fromEncoded("http://www.google.com/maps/m?l-view=map&l-lci=m,com.google.latitudepublicupdates&ac=f,s,l")); -} - -void LatitudeGUI::mode_latitude() { - maps->load(QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude")); -} - -void LatitudeGUI::maps_login() { - if ( maps->url() == url ) { - maps->page()->mainFrame()->evaluateJavaScript( - QString("document.getElementById('Email').value = \"%1\";").arg( - setting->value("user").toString())); - maps->page()->mainFrame()->evaluateJavaScript( - QString("document.getElementById('Passwd').value = \"%1\";").arg( - setting->value("pass").toString())); - maps->page()->mainFrame()->evaluateJavaScript("document.getElementById('gaia_loginform').submit();"); - } -} diff --git a/src/daemon/latitude-backup.h b/src/daemon/latitude-backup.h deleted file mode 100644 index 13aa6ea..0000000 --- a/src/daemon/latitude-backup.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef LATITUDE_H -#define LATITUDE_H - -#include -#include -#include "glatitude.h" -#include "gps.h" -#ifdef Q_WS_MAEMO_5 -#include -#endif - -class LatitudeGUI : public QObject { - Q_OBJECT - -signals: - void newpos(); - -public: - LatitudeGUI(QObject *parent = 0); - -private slots: - void set(); - void latitude_OK(); - void latitude_ERROR(); - void save_user(QString); - void save_pass(QString); - void maps_login(); - void mode_buzz(); - void mode_latitude(); - -private: - GoogleLatitude *glatitude; - GpsMaemo5 *gps; - QSettings *setting; - QWebView *maps; - QUrl url; -}; - -#endif // LATITUDE_H diff --git a/src/daemon/latitude.cpp b/src/daemon/latitude.cpp deleted file mode 100644 index dd1c6d7..0000000 --- a/src/daemon/latitude.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "latitude.h" -#include "qwebviewselectionsuppressor.h" -#include "../common/dbusclient.h" -#include "customuseragentpage.h" - -#include - -LatitudeGUI::LatitudeGUI(QSettings *set, QWidget *parent) : QMainWindow(parent) -{ -#ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5AutoOrientation, true); - DBusClient* dbcli = new DBusClient(this); -#endif - loginOk = false; - settings = set; - loadSettings(); - - // GUI - url = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude"); - maps = new QWebView(); - maps->setPage(new customUAPage(this)); - maps->settings()->enablePersistentStorage(); - maps->setZoomFactor(1.4); - maps->settings()->setAttribute(QWebSettings::PluginsEnabled, true); - maps->setContextMenuPolicy(Qt::NoContextMenu); - connect(maps, SIGNAL(loadFinished(bool)), this, SLOT(maps_login())); - maps->load(url); - new QWebViewSelectionSuppressor(maps); - menuBar()->addAction(tr("&Latitude"), this, SLOT(mode_latitude())); - menuBar()->addAction(tr("&Buzz"), this, SLOT(mode_buzz())); - - // updater - glatitude = new GoogleLatitude(this); -#ifdef Q_WS_MAEMO_5 - gps = new GpsMaemo5(location_interval, location_method, this); - enableServices(); - - connect(gps, SIGNAL(fix()), this, SLOT(set())); - connect(dbcli, SIGNAL(sigNetworkConnected()), - this, SLOT(enableServices())); - connect(dbcli, SIGNAL(sigNetworkDisconnected()), - this, SLOT(disableServices())); - -#endif - connect(glatitude, SIGNAL(OK()), this, SLOT(latitude_OK())); - connect(glatitude, SIGNAL(ERROR()), this, SLOT(latitude_ERROR())); - - // show it - setCentralWidget(maps); -} - -#ifdef Q_WS_MAEMO_5 -void LatitudeGUI::enableServices() { - if (!DBusClient::networkConnected()) - return; - - gps->enable(); - glatitude->enableUpdates(); -} -void LatitudeGUI::disableServices() { - gps->disable(); - glatitude->disableUpdates(); -} -#endif - -void LatitudeGUI::set() { -#ifdef Q_WS_MAEMO_5 - //QMaemo5InformationBox::information(this, "new position...", 1000); -#else - qDebug() << "new position..."; -#endif - glatitude->login(settings->value("user","my_username").toString(), - settings->value("pass","my_password").toString()); - glatitude->set(gps->get_lat(), - gps->get_lon(), - gps->get_acc()); - glatitude->disableUpdates(); -#ifdef Q_WS_MAEMO_5 - QTimer::singleShot(location_interval*100, glatitude, SLOT(enableUpdates())); -#endif -} - -void LatitudeGUI::latitude_OK() { - loginOk = true; //We could login at least once! - //TODO: REMOVE THIS - qDebug() << maps->url(); -#ifdef Q_WS_MAEMO_5 - //QMaemo5InformationBox::information(this, "...location Sent!", 1000); -#else - qDebug() << "...location Sent!"; -#endif -} - -void LatitudeGUI::latitude_ERROR() { - //Errors in authentication may occur frequently due to transmition or - //reception problems in low signal situations, so we will only alert the - //user if we can't login at least once - if (loginOk) - return; - -#ifdef Q_WS_MAEMO_5 - disableServices(); - QString error_message = tr("Error in Authentification!

") + - tr("Plese verify your login details
"); - QMaemo5InformationBox::information(this, error_message, - QMaemo5InformationBox::NoTimeout); - system("/usr/bin/googlelatitude-settings"); - enableServices(); -#else - qDebug() << "Error in Authentification!"; -#endif -} - -void LatitudeGUI::loadSettings() -{ - settings->sync(); -#ifdef Q_WS_MAEMO_5 - location_method = (LocationGPSDControlMethod) settings->value("location", LOCATION_METHOD_GNSS).toInt(); - location_interval = (LocationGPSDControlInterval) settings->value("interval", LOCATION_INTERVAL_20S).toUInt(); -#endif -} - -void LatitudeGUI::maps_login() { - if ( maps->url() == url ) { - maps->page()->mainFrame()->evaluateJavaScript( - QString("document.getElementById('Email').value = \"%1\";").arg( - settings->value("user").toString())); - maps->page()->mainFrame()->evaluateJavaScript( - QString("document.getElementById('Passwd').value = \"%1\";").arg( - settings->value("pass").toString())); - maps->page()->mainFrame()->evaluateJavaScript("document.getElementById('gaia_loginform').submit();"); - } -} - -void LatitudeGUI::mode_buzz() { - maps->load(QUrl::fromEncoded("http://www.google.com/maps/m?l-view=map&l-lci=m,com.google.latitudepublicupdates&ac=f,s,l")); -} - -void LatitudeGUI::mode_latitude() { - maps->load(QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude")); -} - -void LatitudeGUI::reparseConfiguration() -{ -#ifdef Q_WS_MAEMO_5 - disableServices(); - loadSettings(); - gps->updateGPSConfig(location_interval, location_method); - enableServices(); - QMaemo5InformationBox::information(this, - tr("Google Latitude daemon updated"), - 2000); -#endif -} - -void LatitudeGUI::save_user(QString _user) { - settings->setValue("user", _user); -} -void LatitudeGUI::save_pass(QString _pass) { - settings->setValue("pass", _pass); -} diff --git a/src/daemon/latitude.h b/src/daemon/latitude.h deleted file mode 100644 index cdc41d5..0000000 --- a/src/daemon/latitude.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef LATITUDE_H -#define LATITUDE_H - -#include -#include -#include "glatitude.h" -#include "gps.h" -#ifdef Q_WS_MAEMO_5 -#include -#endif - -class LatitudeGUI : public QMainWindow { - Q_OBJECT - -signals: - void newpos(); - -public: - LatitudeGUI(QSettings *set, QWidget *parent = 0); - void reparseConfiguration(); - -protected: - void loadSettings(); - -private slots: -#ifdef Q_WS_MAEMO_5 - void enableServices(); - void disableServices(); -#endif - void set(); - void latitude_OK(); - void latitude_ERROR(); - void save_user(QString); - void save_pass(QString); - void maps_login(); - void mode_buzz(); - void mode_latitude(); - -private: - GoogleLatitude *glatitude; - GpsMaemo5 *gps; - QSettings *settings; - QWebView *maps; - QUrl url; -#ifdef Q_WS_MAEMO_5 - LocationGPSDControlInterval location_interval; - LocationGPSDControlMethod location_method; -#endif - bool loginOk; -}; - -#endif // LATITUDE_H diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp deleted file mode 100644 index a45c48f..0000000 --- a/src/daemon/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "latitude.h" -#include "dbusadaptor.h" -#include "../common/dbusclient.h" - -#include -#include - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - DBusAdaptor* adaptor = new DBusAdaptor(&app); - QCoreApplication::setOrganizationName("linfati"); - QCoreApplication::setOrganizationDomain("linfati.com"); - QCoreApplication::setApplicationName("GoogleLatitude"); - if (!QDBusConnection::sessionBus().registerService("com.linfati.GoogleLatitude")) { -#ifdef Q_WS_MAEMO_5 - DBusClient::showWindow(); -#endif - return 0; //The application is already running - } - QDBusConnection::sessionBus().registerObject("/", &app); - - QSettings* settings = new QSettings(); - - if(app.arguments().contains(QString("-s")) || - app.arguments().contains(QString("--startup"))) - if (!settings->value("autolaunch",false).toBool()) - return 0; - - app.setQuitOnLastWindowClosed(false); - LatitudeGUI *gui = new LatitudeGUI(settings); - adaptor->setDaemon(gui); - - return app.exec(); -} - -/* - TODO: - on auth error -> stop gps - on new pos, only set it - send new pos every 120s, only if is diferent - no n900 -> por ip - */ diff --git a/src/daemon/qwebviewselectionsuppressor.h b/src/daemon/qwebviewselectionsuppressor.h deleted file mode 100644 index 7b96441..0000000 --- a/src/daemon/qwebviewselectionsuppressor.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWEBVIEWSELECTIONSUPPRESSOR_H -#define QWEBVIEWSELECTIONSUPPRESSOR_H - -#include -#include - -class QWebViewSelectionSuppressor : public QObject -{ - Q_OBJECT -public: - QWebViewSelectionSuppressor(QWebView *v) - : QObject(v), view(v), enabled(false), mousePressed(false) - { - Q_ASSERT(view); - enable(); - } - - inline void enable() - { - if (enabled) - return; - view->installEventFilter(this); - enabled = true; - } - - inline void disable() - { - if (!enabled) - return; - view->removeEventFilter(this); - enabled = false; - } - - inline bool isEnabled() const - { - return enabled; - } - -protected: - inline bool eventFilter(QObject *, QEvent *e); - -private: - QWebView *view; - bool enabled; - bool mousePressed; -}; - -bool QWebViewSelectionSuppressor::eventFilter(QObject *, QEvent *e) -{ - switch (e->type()) { - case QEvent::MouseButtonPress: - if (static_cast(e)->button() == Qt::LeftButton) - mousePressed = true; - break; - case QEvent::MouseButtonRelease: - if (static_cast(e)->button() == Qt::LeftButton) - mousePressed = false; - break; - case QEvent::MouseMove: - if (mousePressed) - return true; - break; - default: - break; - } - return false; -} - -#endif diff --git a/src/glatitude.cpp b/src/glatitude.cpp new file mode 100644 index 0000000..a00f7c9 --- /dev/null +++ b/src/glatitude.cpp @@ -0,0 +1,72 @@ +#include "glatitude.h" + +GoogleLatitude::GoogleLatitude(QObject *parent) : QObject(parent) { + user = ""; + pass = ""; + latitude = 0.; + longitude = 0.; + accuracy = 0.; + + worker = new QNetworkAccessManager(); + connect(worker, SIGNAL(finished(QNetworkReply *)), this, SLOT(finishedreply(QNetworkReply *))); + + urllogin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview"); + urldologin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLoginAuth?service=friendview"); + urlupdate = QUrl::fromEncoded("http://maps.google.com/glm/mmap/mwmfr?hl=en"); +} + +void GoogleLatitude::login(QString u, QString p) { + if ( !u.contains('@') ) u.append("@gmail.com"); + user = u; + pass = p; +} + +void GoogleLatitude::set(double la, double lo, double ac) { + latitude = la; + longitude = lo; + accuracy = ac; + + if (la*lo == 0) return; + worker->get(QNetworkRequest(urllogin)); +} + +void GoogleLatitude::finishedreply(QNetworkReply *r) { + if ( r->url() == urllogin ) { + QString aidis = r->readAll(); + QRegExp regexp ("type=\"hidden\".*name=\"GALX\".*value=\"(.*)\""); + regexp.setMinimal(1); + regexp.indexIn(aidis, 1); + QString googleGALX = regexp.capturedTexts().last(); + + QByteArray datalogin; + datalogin += "&service=friendview"; + datalogin += "&GALX=" + googleGALX; + datalogin += "&Email=" + user; + datalogin += "&Passwd=" + pass; + worker->post(QNetworkRequest(urldologin), datalogin); + } else if ( r->url() == urldologin ) { + QByteArray datagps; + datagps += "t=ul"; + datagps += "&lat=" + QString::number(latitude); + datagps += "&lng=" + QString::number(longitude); + datagps += "&accuracy=" + QString::number(accuracy); + + QNetworkRequest request(urlupdate); + request.setRawHeader("X-ManualHeader", QString("true").toAscii() ); + worker->post(request, datagps); + } else if ( r->url() == urlupdate ) { + QString output = r->readAll(); + QRegExp regexp ("Authentication required"); + if (regexp.indexIn(output, 1) != -1) { + emit ERROR(); + } else { + emit OK(); + } + qDebug() << output; + } else { + qDebug() << "Error"; + qDebug() << "url:" << r->url(); + qDebug() << r->rawHeaderList(); + qDebug() << r->readAll(); + } +} diff --git a/src/glatitude.h b/src/glatitude.h new file mode 100644 index 0000000..3083696 --- /dev/null +++ b/src/glatitude.h @@ -0,0 +1,38 @@ +#ifndef GLATITUDE_H +#define GLATITUDE_H + +#include + +class GoogleLatitude : public QObject { + Q_OBJECT + +signals: + void OK(); + void ERROR(); + +public: + GoogleLatitude(QObject *parent = 0); + void login(QString username, QString password); + void set(double latitude, double longitude, double accuracy=1000.); + double get_lat() { return latitude; } + double get_lon() { return longitude; } + double get_acc() { return accuracy; } + +private slots: + void finishedreply(QNetworkReply *r); + +private: + // info + QString user; + QString pass; + double latitude; + double longitude; + double accuracy; + // stuff + QNetworkAccessManager *worker; + QUrl urllogin; + QUrl urldologin; + QUrl urlupdate; +}; + +#endif // GLATITUDE_H diff --git a/src/gps.cpp b/src/gps.cpp new file mode 100644 index 0000000..0fb4ba7 --- /dev/null +++ b/src/gps.cpp @@ -0,0 +1,32 @@ +#include "gps.h" + +#ifdef Q_WS_MAEMO_5 + +GpsMaemo5::GpsMaemo5(QObject *parent) : QObject(parent) { + latitude = 0; + longitude = 0; + accuracy = 0; + + control = location_gpsd_control_get_default(); + device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL); + + g_signal_connect(device, "changed", G_CALLBACK(GpsMaemo5_changed), this); + g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL); + g_object_set(G_OBJECT(control), "preferred-interval", LOCATION_INTERVAL_120S, NULL); + + location_gpsd_control_start(control); +} + +void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) { + if (device->fix) { + if (device->fix->fields) { + g_print("lat = %f, long = %f, eph = %f\n", gps->device->fix->latitude, gps->device->fix->longitude, gps->device->fix->eph/100.); + gps->latitude = gps->device->fix->latitude; + gps->longitude = gps->device->fix->longitude; + gps->accuracy = gps->device->fix->eph/100.; + emit gps->fix(); + } + } +} + +#endif // Q_WS_MAEMO_5 diff --git a/src/gps.h b/src/gps.h new file mode 100644 index 0000000..2d9cfdf --- /dev/null +++ b/src/gps.h @@ -0,0 +1,55 @@ +#ifndef GPS_H +#define GPS_H + +#include + +#ifdef Q_WS_MAEMO_5 + +extern "C" { +#include +#include +} + +class GpsMaemo5 : public QObject { + Q_OBJECT + +signals: + void fix(); + +public: + GpsMaemo5(QObject *parent = 0); + double get_lat() { return latitude; } + double get_lon() { return longitude; } + double get_acc() { return accuracy; } + friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps); + +private: + double latitude; + double longitude; + double accuracy; + + GMainLoop *loop; + LocationGPSDControl *control; + LocationGPSDevice *device; +}; + +void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps); + +#else // Q_WS_MAEMO_5 + +class GpsMaemo5 : public QObject { + Q_OBJECT + +signals: + void fix(); + +public: + GpsMaemo5(QObject *parent = 0) { Q_UNUSED(parent); } + double get_lat() { return 0; } + double get_lon() { return 0; } + double get_acc() { return 0; } +}; + +#endif // Q_WS_MAEMO_5 + +#endif // GPS_H diff --git a/src/latitude.cpp b/src/latitude.cpp new file mode 100644 index 0000000..864f5c0 --- /dev/null +++ b/src/latitude.cpp @@ -0,0 +1,100 @@ +#include "latitude.h" + +LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) { +#ifdef Q_WS_MAEMO_5 + setAttribute(Qt::WA_Maemo5AutoOrientation, true); +#endif + setWindowTitle(tr("Latitude & Buzz")); + + setting = new QSettings(); + + // login input + QDialog *dialoglogin = new QDialog(this); + QLineEdit *login_user = new QLineEdit(setting->value("user","my_username").toString()); + QLineEdit *login_pass = new QLineEdit(setting->value("pass","my_password").toString()); + login_pass->setEchoMode(QLineEdit::Password); + QFormLayout *layout_login = new QFormLayout(); + layout_login->addRow(tr("&Username"), login_user); + layout_login->addRow(tr("&Password"), login_pass); + connect(login_user, SIGNAL(textEdited(QString)), this, SLOT(save_user(QString))); + connect(login_pass, SIGNAL(textEdited(QString)), this, SLOT(save_pass(QString))); + connect(login_user, SIGNAL(returnPressed()), login_pass, SLOT(setFocus())); + connect(login_pass, SIGNAL(returnPressed()), dialoglogin, SLOT(accept())); + dialoglogin->setLayout(layout_login); + dialoglogin->exec(); + + // GUI + url = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude"); + maps = new QWebView(); + maps->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + connect(maps, SIGNAL(loadFinished(bool)), this, SLOT(maps_login())); + maps->load(url); + menuBar()->addAction(tr("&Latitude"), this, SLOT(mode_latitude())); + menuBar()->addAction(tr("&Buzz"), this, SLOT(mode_buzz())); + + // updater + glatitude = new GoogleLatitude(this); + gps = new GpsMaemo5(this); + connect(gps, SIGNAL(fix()), this, SLOT(set())); + connect(glatitude, SIGNAL(OK()), this, SLOT(latitude_OK())); + connect(glatitude, SIGNAL(ERROR()), this, SLOT(latitude_ERROR())); + + // show it + setCentralWidget(maps); +} + +void LatitudeGUI::set() { +#ifdef Q_WS_MAEMO_5 + QMaemo5InformationBox::information(this, "new position...", 1000); +#else + qDebug() << "new position..."; +#endif + glatitude->login(setting->value("user","my_username").toString(), + setting->value("pass","my_password").toString()); + glatitude->set(gps->get_lat(), + gps->get_lon(), + gps->get_acc()); +} + +void LatitudeGUI::latitude_OK() { +#ifdef Q_WS_MAEMO_5 + QMaemo5InformationBox::information(this, "...location Sent!", 1000); +#else + qDebug() << "...location Sent!"; +#endif +} + +void LatitudeGUI::latitude_ERROR() { +#ifdef Q_WS_MAEMO_5 + QMaemo5InformationBox::information(this, "Error in Authentification !", 3000); +#else + qDebug() << "Error in Authentification !"; +#endif +} + +void LatitudeGUI::save_user(QString _user) { + setting->setValue("user", _user); +} +void LatitudeGUI::save_pass(QString _pass) { + setting->setValue("pass", _pass); +} + +void LatitudeGUI::mode_buzz() { + maps->load(QUrl::fromEncoded("http://www.google.com/maps/m?l-view=map&l-lci=m,com.google.latitudepublicupdates&ac=f,s,l")); +} + +void LatitudeGUI::mode_latitude() { + maps->load(QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude")); +} + +void LatitudeGUI::maps_login() { + if ( maps->url() == url ) { + maps->page()->mainFrame()->evaluateJavaScript( + QString("document.getElementById('Email').value = \"%1\";").arg( + setting->value("user").toString())); + maps->page()->mainFrame()->evaluateJavaScript( + QString("document.getElementById('Passwd').value = \"%1\";").arg( + setting->value("pass").toString())); + maps->page()->mainFrame()->evaluateJavaScript("document.getElementById('gaia_loginform').submit();"); + } +} diff --git a/src/latitude.h b/src/latitude.h new file mode 100644 index 0000000..4f2362d --- /dev/null +++ b/src/latitude.h @@ -0,0 +1,39 @@ +#ifndef LATITUDE_H +#define LATITUDE_H + +#include +#include +#include "glatitude.h" +#include "gps.h" +#ifdef Q_WS_MAEMO_5 +#include +#endif + +class LatitudeGUI : public QMainWindow { + Q_OBJECT + +signals: + void newpos(); + +public: + LatitudeGUI(QMainWindow *parent = 0); + +private slots: + void set(); + void latitude_OK(); + void latitude_ERROR(); + void save_user(QString); + void save_pass(QString); + void maps_login(); + void mode_buzz(); + void mode_latitude(); + +private: + GoogleLatitude *glatitude; + GpsMaemo5 *gps; + QSettings *setting; + QWebView *maps; + QUrl url; +}; + +#endif // LATITUDE_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..fd38f35 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,21 @@ +#include "latitude.h" + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + QCoreApplication::setOrganizationName("linfati"); + QCoreApplication::setOrganizationDomain("linfati.com"); + QCoreApplication::setApplicationName("GoogleLatitude"); + + LatitudeGUI *gui = new LatitudeGUI(); + gui->show(); + + return app.exec(); +} + +/* + TODO: + on auth error -> stop gps + on new pos, only set it + send new pos every 120s, only if is diferent + no n900 -> por ip + */ diff --git a/src/settings/main.cpp b/src/settings/main.cpp deleted file mode 100644 index 6a0cb8c..0000000 --- a/src/settings/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include "settings.h" - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QCoreApplication::setOrganizationName("linfati"); - QCoreApplication::setOrganizationDomain("linfati.com"); - QCoreApplication::setApplicationName("GoogleLatitude"); - - Settings *settings = new Settings(); - settings->setWindowModality(Qt::ApplicationModal); - settings->show(); - - return app.exec(); -} - -/* - TODO: - on auth error -> stop gps - on new pos, only set it - send new pos every 120s, only if is diferent - no n900 -> por ip - */ - diff --git a/src/settings/settings.cpp b/src/settings/settings.cpp deleted file mode 100644 index 55f36db..0000000 --- a/src/settings/settings.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "settings.h" -#include "ui_settings.h" -#include "../common/dbusclient.h" - -#include -#include - -Settings::Settings(QWidget *parent) : - QWidget(parent), - ui(new Ui::Settings) -{ - intervals << tr("1 second") << tr("2 seconds") << tr("5 seconds") << - tr("10 seconds") << tr("20 seconds") << tr("30 seconds") << - tr("60 seconds") << tr("120 seconds"); - - ui->setupUi(this); - addUIElements(); //Add Maemo 5 Specific widgets - - settings = new QSettings(); - loadSettings(); - - //Make the window a modal panel - setWindowFlags(Qt::Dialog); - setWindowModality(Qt::ApplicationModal); - - connect(ui->login_user, SIGNAL(returnPressed()), ui->login_pass, SLOT(setFocus())); - connect(ui->login_pass, SIGNAL(returnPressed()), SLOT(close())); - connect(ui->ok_button, SIGNAL(clicked()), SLOT(close())); - -} - -Settings::~Settings() -{ -#ifdef Q_WS_MAEMO_5 - delete interval_button; - delete interval_selector; - delete interval_model; -#endif - delete ui; - delete settings; -} - -void Settings::addUIElements() -{ - QVBoxLayout* ui_layout = (QVBoxLayout*)ui->scrollArea->widget()->layout(); -#ifdef Q_WS_MAEMO_5 - interval_button = new QMaemo5ValueButton("Update Interval",ui->scrollArea->widget()); - interval_button->setValueLayout(QMaemo5ValueButton::ValueBesideText); - interval_selector = new QMaemo5ListPickSelector; - interval_model = new QStandardItemModel(0, 1); - populateListModel(interval_model); - interval_selector->setModel(interval_model); - interval_button->setPickSelector(interval_selector); - ui_layout->insertWidget(4, interval_button); -#endif -} - -void Settings::closeEvent(QCloseEvent *event) -{ - storeSettings(); - settings->sync(); -#ifdef Q_WS_MAEMO_5 - updateDaemon(); -#endif - event->accept(); -} - -void Settings::loadSettings() -{ - unsigned short location; - unsigned short interval; - - ui->connectIfNecessary->setChecked( settings->value("autoconnect",true).toBool() ); - ui->launchOnPowerOn->setChecked( settings->value("autolaunch",false).toBool() ); -#ifdef Q_WS_MAEMO_5 - location = settings->value("location", LOCATION_METHOD_GNSS).toInt(); -#endif - ui->login_user->setText(settings->value("user","my_username").toString()); - ui->login_pass->setText(settings->value("pass","my_password").toString()); -#ifdef Q_WS_MAEMO_5 - switch(settings->value("interval", LOCATION_INTERVAL_20S).toInt()) { - case LOCATION_INTERVAL_1S: - interval = 0; - break; - case LOCATION_INTERVAL_2S: - interval = 1; - break; - case LOCATION_INTERVAL_5S: - interval = 2; - break; - case LOCATION_INTERVAL_10S: - interval = 3; - break; - case LOCATION_INTERVAL_20S: - interval = 4; - break; - case LOCATION_INTERVAL_30S: - interval = 5; - break; - case LOCATION_INTERVAL_60S: - interval = 6; - break; - case LOCATION_INTERVAL_120S: - interval = 7; - break; - } - interval_selector->setCurrentIndex(interval); - - - if (DBusClient::daemonRunning()) - ui->status_on->setChecked(true); - else - ui->status_off->setChecked(true); - - - switch (location) { - case LOCATION_METHOD_GNSS: - ui->location_gps->setChecked(true); - break; - case LOCATION_METHOD_AGNSS | LOCATION_METHOD_ACWP: - ui->location_gps_network->setChecked(true); - break; - case LOCATION_METHOD_ACWP: - ui->location_network->setChecked(true); - break; - } -#endif -} - -void Settings::populateListModel(QStandardItemModel *model) -{ - for(int i = 0; i < intervals.size(); ++i) { - QStandardItem *item = new QStandardItem(intervals.at(i)); - item->setTextAlignment(Qt::AlignCenter); // the Maemo 5 design spec recommends this. - item->setEditable(false); // prevent editing of the item - model->appendRow(item); - } -} - -void Settings::storeSettings() -{ - unsigned short status; - unsigned short location; - unsigned short interval; - - settings->setValue("autoconnect", ui->connectIfNecessary->checkState()); - settings->setValue("autolaunch", ui->launchOnPowerOn->checkState()); - settings->setValue("user", ui->login_user->text()); - settings->setValue("pass", ui->login_pass->text()); -#ifdef Q_WS_MAEMO_5 - switch(interval_selector->currentIndex()) { - case 0: - interval = LOCATION_INTERVAL_1S; - break; - case 1: - interval = LOCATION_INTERVAL_2S; - break; - case 2: - interval = LOCATION_INTERVAL_5S; - break; - case 3: - interval = LOCATION_INTERVAL_10S; - break; - case 4: - interval = LOCATION_INTERVAL_20S; - break; - case 5: - interval = LOCATION_INTERVAL_30S; - break; - case 6: - interval = LOCATION_INTERVAL_60S; - break; - case 7: - interval = LOCATION_INTERVAL_120S; - break; - } - settings->setValue("interval", interval); - - if (ui->location_gps->isChecked()) - location = LOCATION_METHOD_GNSS; - else if (ui->location_gps_network->isChecked()) - location = LOCATION_METHOD_AGNSS | LOCATION_METHOD_ACWP; - else if (ui->location_network->isChecked()) - location = LOCATION_METHOD_ACWP; - settings->setValue("location", location); -#endif - - settings->setValue("status", status); -} - -#ifdef Q_WS_MAEMO_5 -void Settings::updateDaemon() -{ - if (ui->status_on->isChecked()) { - if (DBusClient::daemonRunning()) - DBusClient::reloadDaemonConfig(); - else - (new QProcess())->start(QString("/opt/linfati.com/googlelatitude-daemon")); - } - else if (ui->status_off->isChecked()) - DBusClient::quitDaemon(); - //else if (ui->status_hide->isChecked()) - // status = STATUS_HIDE; -} -#endif - -void Settings::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/src/settings/settings.h b/src/settings/settings.h deleted file mode 100644 index bd25d29..0000000 --- a/src/settings/settings.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef SETTINGS_H -#define SETTINGS_H - -#include -#include -#include -#include -#include -#include -#include -#ifdef Q_WS_MAEMO_5 -#include -#include -#include -extern "C" { -#include -#include -} -#endif -namespace Ui { - class Settings; -} - -class Settings : public QWidget -{ - Q_OBJECT - -public: - explicit Settings(QWidget *parent = 0); - ~Settings(); - -protected: - void changeEvent(QEvent *e); - void closeEvent(QCloseEvent *e); - -private: -#ifdef Q_WS_MAEMO_5 - void updateDaemon(); -#endif - void addUIElements(); - void loadSettings(); - void storeSettings(); - void populateListModel(QStandardItemModel *model); - enum statuses { STATUS_ON, STATUS_OFF, STATUS_HIDE }; - Ui::Settings *ui; - QStringList intervals; - QSettings *settings; -#ifdef Q_WS_MAEMO_5 - QMaemo5ValueButton *interval_button; - QMaemo5ListPickSelector *interval_selector; - QStandardItemModel* interval_model; -#endif -}; - -#endif // SETTINGS_H diff --git a/src/settings/settings.pro b/src/settings/settings.pro deleted file mode 100644 index 3ce86cc..0000000 --- a/src/settings/settings.pro +++ /dev/null @@ -1,34 +0,0 @@ -TARGET = googlelatitude-settings -HEADERS += settings.h ../common/dbusclient.h -SOURCES += main.cpp settings.cpp ../common/dbusclient.cpp - -OBJECTS_DIR = build -MOC_DIR = build -DESTDIR = build - -TEMPLATE = app - -contains(QT_CONFIG, maemo5) { - QT += maemo5 dbus - CONFIG += link_pkgconfig - PKGCONFIG += glib-2.0 liblocation -} - -FORMS += \ - settings.ui - -unix { - #VARIABLES - isEmpty(PREFIX) { - PREFIX = /usr - } - BINDIR = $$PREFIX/bin - DATADIR =$$PREFIX/share - - DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" - - #MAKE INSTALL - - INSTALLS += target - target.path =$$BINDIR -} diff --git a/src/settings/settings.ui b/src/settings/settings.ui deleted file mode 100644 index 4ae43a5..0000000 --- a/src/settings/settings.ui +++ /dev/null @@ -1,206 +0,0 @@ - - - Settings - - - - 0 - 0 - 640 - 480 - - - - Settings - - - - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 618 - 458 - - - - - - - Latitude Status - - - - 0 - - - 0 - - - - - On - - - - - - - Off - - - - - - - false - - - Hide - - - - - - - - - - Location Mode - - - - 0 - - - 0 - - - - - GPS Only - - - - - - - GPS + Mobile Network - - - - - - - Mobile Network - - - - - - - - - - Launch on power on - - - - - - - false - - - Connect to network if necessary - - - - - - - - 0 - 0 - - - - Google Login - - - - QFormLayout::ExpandingFieldsGrow - - - - - Login - - - - - - - - - - Password - - - - - - - QLineEdit::Password - - - - - - - - - - - 0 - 0 - - - - - - - false - - - About... - - - - - - - Ok - - - - - - - - - - - - - - - diff --git a/src/settings/ui_settings.h b/src/settings/ui_settings.h deleted file mode 100644 index b5e6604..0000000 --- a/src/settings/ui_settings.h +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'settings.ui' -** -** Created: Thu Jan 6 21:00:12 2011 -** by: Qt User Interface Compiler version 4.7.0 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_SETTINGS_H -#define UI_SETTINGS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_Settings -{ -public: - QVBoxLayout *verticalLayout; - QScrollArea *scrollArea; - QWidget *widget; - QVBoxLayout *verticalLayout_2; - QGroupBox *groupBox; - QHBoxLayout *horizontalLayout; - QRadioButton *status_on; - QRadioButton *status_off; - QRadioButton *status_hide; - QGroupBox *groupBox_2; - QHBoxLayout *horizontalLayout_2; - QRadioButton *location_gps; - QRadioButton *location_gps_network; - QRadioButton *location_network; - QCheckBox *launchOnPowerOn; - QCheckBox *connectIfNecessary; - QGroupBox *groupBox_3; - QFormLayout *formLayout; - QLabel *label; - QLineEdit *login_user; - QLabel *label_2; - QLineEdit *login_pass; - QWidget *widget_2; - QHBoxLayout *horizontalLayout_3; - QPushButton *about_button; - QPushButton *ok_button; - - void setupUi(QWidget *Settings) - { - if (Settings->objectName().isEmpty()) - Settings->setObjectName(QString::fromUtf8("Settings")); - Settings->resize(640, 480); - verticalLayout = new QVBoxLayout(Settings); - verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); - scrollArea = new QScrollArea(Settings); - scrollArea->setObjectName(QString::fromUtf8("scrollArea")); - scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - scrollArea->setWidgetResizable(true); - widget = new QWidget(); - widget->setObjectName(QString::fromUtf8("widget")); - widget->setGeometry(QRect(0, 0, 618, 458)); - verticalLayout_2 = new QVBoxLayout(widget); - verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); - groupBox = new QGroupBox(widget); - groupBox->setObjectName(QString::fromUtf8("groupBox")); - horizontalLayout = new QHBoxLayout(groupBox); - horizontalLayout->setSpacing(0); - horizontalLayout->setContentsMargins(0, 0, 0, 0); - horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); - status_on = new QRadioButton(groupBox); - status_on->setObjectName(QString::fromUtf8("status_on")); - - horizontalLayout->addWidget(status_on); - - status_off = new QRadioButton(groupBox); - status_off->setObjectName(QString::fromUtf8("status_off")); - - horizontalLayout->addWidget(status_off); - - status_hide = new QRadioButton(groupBox); - status_hide->setObjectName(QString::fromUtf8("status_hide")); - status_hide->setEnabled(false); - - horizontalLayout->addWidget(status_hide); - - - verticalLayout_2->addWidget(groupBox); - - groupBox_2 = new QGroupBox(widget); - groupBox_2->setObjectName(QString::fromUtf8("groupBox_2")); - horizontalLayout_2 = new QHBoxLayout(groupBox_2); - horizontalLayout_2->setSpacing(0); - horizontalLayout_2->setContentsMargins(0, 0, 0, 0); - horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); - location_gps = new QRadioButton(groupBox_2); - location_gps->setObjectName(QString::fromUtf8("location_gps")); - - horizontalLayout_2->addWidget(location_gps); - - location_gps_network = new QRadioButton(groupBox_2); - location_gps_network->setObjectName(QString::fromUtf8("location_gps_network")); - - horizontalLayout_2->addWidget(location_gps_network); - - location_network = new QRadioButton(groupBox_2); - location_network->setObjectName(QString::fromUtf8("location_network")); - - horizontalLayout_2->addWidget(location_network); - - - verticalLayout_2->addWidget(groupBox_2); - - launchOnPowerOn = new QCheckBox(widget); - launchOnPowerOn->setObjectName(QString::fromUtf8("launchOnPowerOn")); - - verticalLayout_2->addWidget(launchOnPowerOn); - - connectIfNecessary = new QCheckBox(widget); - connectIfNecessary->setObjectName(QString::fromUtf8("connectIfNecessary")); - connectIfNecessary->setEnabled(false); - - verticalLayout_2->addWidget(connectIfNecessary); - - groupBox_3 = new QGroupBox(widget); - groupBox_3->setObjectName(QString::fromUtf8("groupBox_3")); - QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(groupBox_3->sizePolicy().hasHeightForWidth()); - groupBox_3->setSizePolicy(sizePolicy); - formLayout = new QFormLayout(groupBox_3); - formLayout->setObjectName(QString::fromUtf8("formLayout")); - formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - label = new QLabel(groupBox_3); - label->setObjectName(QString::fromUtf8("label")); - - formLayout->setWidget(0, QFormLayout::LabelRole, label); - - login_user = new QLineEdit(groupBox_3); - login_user->setObjectName(QString::fromUtf8("login_user")); - - formLayout->setWidget(0, QFormLayout::FieldRole, login_user); - - label_2 = new QLabel(groupBox_3); - label_2->setObjectName(QString::fromUtf8("label_2")); - - formLayout->setWidget(2, QFormLayout::LabelRole, label_2); - - login_pass = new QLineEdit(groupBox_3); - login_pass->setObjectName(QString::fromUtf8("login_pass")); - login_pass->setEchoMode(QLineEdit::Password); - - formLayout->setWidget(2, QFormLayout::FieldRole, login_pass); - - - verticalLayout_2->addWidget(groupBox_3); - - widget_2 = new QWidget(widget); - widget_2->setObjectName(QString::fromUtf8("widget_2")); - sizePolicy.setHeightForWidth(widget_2->sizePolicy().hasHeightForWidth()); - widget_2->setSizePolicy(sizePolicy); - horizontalLayout_3 = new QHBoxLayout(widget_2); - horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); - about_button = new QPushButton(widget_2); - about_button->setObjectName(QString::fromUtf8("about_button")); - about_button->setEnabled(false); - - horizontalLayout_3->addWidget(about_button); - - ok_button = new QPushButton(widget_2); - ok_button->setObjectName(QString::fromUtf8("ok_button")); - - horizontalLayout_3->addWidget(ok_button); - - - verticalLayout_2->addWidget(widget_2); - - scrollArea->setWidget(widget); - - verticalLayout->addWidget(scrollArea); - - - retranslateUi(Settings); - - QMetaObject::connectSlotsByName(Settings); - } // setupUi - - void retranslateUi(QWidget *Settings) - { - Settings->setWindowTitle(QApplication::translate("Settings", "Settings", 0, QApplication::UnicodeUTF8)); - groupBox->setTitle(QApplication::translate("Settings", "Latitude Status", 0, QApplication::UnicodeUTF8)); - status_on->setText(QApplication::translate("Settings", "On", 0, QApplication::UnicodeUTF8)); - status_off->setText(QApplication::translate("Settings", "Off", 0, QApplication::UnicodeUTF8)); - status_hide->setText(QApplication::translate("Settings", "Hide", 0, QApplication::UnicodeUTF8)); - groupBox_2->setTitle(QApplication::translate("Settings", "Location Mode", 0, QApplication::UnicodeUTF8)); - location_gps->setText(QApplication::translate("Settings", "GPS Only", 0, QApplication::UnicodeUTF8)); - location_gps_network->setText(QApplication::translate("Settings", "GPS + Mobile Network", 0, QApplication::UnicodeUTF8)); - location_network->setText(QApplication::translate("Settings", "Mobile Network", 0, QApplication::UnicodeUTF8)); - launchOnPowerOn->setText(QApplication::translate("Settings", "Launch on power on", 0, QApplication::UnicodeUTF8)); - connectIfNecessary->setText(QApplication::translate("Settings", "Connect to network if necessary", 0, QApplication::UnicodeUTF8)); - groupBox_3->setTitle(QApplication::translate("Settings", "Google Login", 0, QApplication::UnicodeUTF8)); - label->setText(QApplication::translate("Settings", "Login", 0, QApplication::UnicodeUTF8)); - label_2->setText(QApplication::translate("Settings", "Password", 0, QApplication::UnicodeUTF8)); - about_button->setText(QApplication::translate("Settings", "About...", 0, QApplication::UnicodeUTF8)); - ok_button->setText(QApplication::translate("Settings", "Ok", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class Settings: public Ui_Settings {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_SETTINGS_H diff --git a/src/settingsplugin/.directory b/src/settingsplugin/.directory deleted file mode 100644 index 9ffe6b1..0000000 --- a/src/settingsplugin/.directory +++ /dev/null @@ -1,7 +0,0 @@ -[Dolphin] -AdditionalInfo=3 -CategorizedSorting=true -ShowPreview=true -Sorting=6 -Timestamp=2010,12,23,20,40,38 -ViewMode=1 diff --git a/src/settingsplugin/settingsplugin.c b/src/settingsplugin/settingsplugin.c deleted file mode 100644 index ca9aa4c..0000000 --- a/src/settingsplugin/settingsplugin.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include -#include - -#ifdef MAEMO_CHANGES -#include - -static const char binary[] = "/opt/linfati.com/googlelatitude-settings"; - -osso_return_t execute(osso_context_t *osso_context, gpointer parent, gboolean user_activated) -{ - char args[sizeof(binary) + 64]; - Window id = None; - - (void) osso_context; - - if (parent && GTK_WIDGET(parent) && GTK_WIDGET(parent)->window) - id = gdk_x11_drawable_get_xid(GTK_WIDGET(parent)->window); - - sprintf(args, "%s --parent 0x%08x%s", binary, (unsigned int) id, user_activated ? " --user" : ""); - return system(args); -} - -osso_return_t save_state(osso_context_t *osso_context, gpointer parent) -{ - (void) osso_context; - (void) parent; - - return OSSO_OK; -} - -#endif diff --git a/src/settingsplugin/settingsplugin.pro b/src/settingsplugin/settingsplugin.pro deleted file mode 100644 index ad8b78f..0000000 --- a/src/settingsplugin/settingsplugin.pro +++ /dev/null @@ -1,31 +0,0 @@ -TARGET = glsettingsplugin -TEMPLATE = lib -SOURCES = settingsplugin.c - -OBJECTS_DIR = build -MOC_DIR = build -DESTDIR = build - -CONFIG += plugin link_pkgconfig -PKGCONFIG += gtk+-2.0 libosso - -unix { - #VARIABLES - isEmpty(PREFIX) { - PREFIX = /usr - } - BINDIR = $$PREFIX/bin - DATADIR =$$PREFIX/share - - DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" - - #MAKE INSTALL - - INSTALLS += target desktop - - target.path = $$system(pkg-config hildon-control-panel --variable=pluginlibdir) - - desktop.path = $$system(pkg-config hildon-control-panel --variable=plugindesktopentrydir) - desktop.files = ../../data/libglsettingsplugin.desktop -} - diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 69564ca..0000000 --- a/src/src.pro +++ /dev/null @@ -1,8 +0,0 @@ -QMAKEVERSION = $$[QMAKE_VERSION] -ISQT4 = $$find(QMAKEVERSION, ^[2-9]) -isEmpty( ISQT4 ) { -error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"); -} - -TEMPLATE = subdirs -SUBDIRS = daemon settings settingsplugin -- 1.7.9.5