Work in progress: hacks at vienna, do not use it
authorRodrigo Linfati <rodrigo@linfati.cl>
Sat, 22 Oct 2011 23:24:57 +0000 (01:24 +0200)
committerRodrigo Linfati <rodrigo@linfati.cl>
Sat, 22 Oct 2011 23:24:57 +0000 (01:24 +0200)
23 files changed:
latitude.qml/MainPage.qml
latitude.qml/latitude.qml.pro
latitude.qml/main.cpp
latitude.qml/main.qml
latitude.qt/latitude.qt.pro
latituded/latituded.conf [new file with mode: 0644]
latituded/latituded.pro
latituded/main.cpp
latitudeupdater.pro
libkqoauth/kqoauthauthreplyserver.cpp
libkqoauth/kqoauthmanager.cpp
libkqoauth/kqoauthmanager.h
libkqoauth/kqoauthmanager_p.h
libkqoauth/libkqoauth.pro
libkqoauth/no_desktopservice.patch [new file with mode: 0644]
liblatitudeupdater/googlelatitude.cpp
liblatitudeupdater/googlelatitude.h
liblocationmaemo5/liblocationmaemo5.pro
qtc_packaging/debian_fremantle/changelog
qtc_packaging/debian_harmattan/changelog
qtc_packaging/debian_harmattan/control
qtc_packaging/debian_harmattan/latitudeupdater.postinst [new file with mode: 0644]
qtc_packaging/debian_harmattan/latitudeupdater.prerm [new file with mode: 0644]

index caeb84f..8916389 100644 (file)
@@ -1,45 +1,32 @@
-import QtQuick 1.0
-import com.meego 1.0
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import QtWebKit 1.0
 
 Page {
     id: mainPage
-    orientationLock: PageOrientation.LockLandscape
+    orientationLock: PageOrientation.LockPortrait
     Column {
         spacing: 16
         Row {
-            width: rootWindow.width
+//            width: rootWindow.width
             Button {
-                id: do_auth
+                id: do_staff
                 width: rootWindow.width / 3
-                text: "Auth"
+                text: "..."
                 enabled: false
                 onClicked: {
-                    Qt.openUrlExternally(latitude.getUserAuthorization())
-                }
-            }
-            Button {
-                id: do_start
-                width: rootWindow.width / 3
-                text: "Start"
-                enabled: false
-                onClicked: {
-                    do_start.enabled = false;
-                    do_stop.enabled = true;
-                    if (!demonio.demonio_start()) {
-                        gps.startUpdates()
-                    }
-                }
-            }
-            Button {
-                id: do_stop
-                width: rootWindow.width / 3
-                text: "Stop"
-                enabled: false
-                onClicked: {
-                    do_start.enabled = true;
-                    do_stop.enabled = false;
-                    if (!demonio.demonio_stop()) {
-                        gps.stopUpdates(true)
+                    if (text.match("Start")) {
+                        console.log("match start")
+                        if (!demonio.demonio_start()) {
+                            gps.startUpdates()
+                        }
+                        text = "Stop"
+                    } else if (text.match("Stop")) {
+                        console.log("match stop")
+                        if (!demonio.demonio_stop()) {
+                            gps.stopUpdates(true)
+                        }
+                        text = "Start"
                     }
                 }
             }
@@ -48,12 +35,12 @@ Page {
             Label {
                 id: method_label
                 text: "Method"
-                width: rootWindow.width / 4
+                width: mainPage.width / 4
                 anchors.verticalCenter: method_button.verticalCenter
             }
-            ButtonRow {
+            ButtonColumn {
                 id: method_button
-                width: rootWindow.width * 2 / 3
+                width: mainPage.width * 1 / 3
                 Button {
                     id: method_cell
                     text: "Cell Tower"
@@ -83,7 +70,7 @@ Page {
             }
             Slider {
                 id: timeout_slider
-                width: rootWindow.width / 2
+                width: rootWindow.width / 4
                 valueIndicatorVisible: true
                 minimumValue: 5
                 maximumValue: 120
@@ -113,7 +100,7 @@ Page {
             }
             Slider {
                 id: interval_slider
-                width: rootWindow.width / 2
+                width: rootWindow.width / 4
                 valueIndicatorVisible: true
                 minimumValue: 5
                 maximumValue: 60
@@ -143,7 +130,7 @@ Page {
             }
             Switch {
                 id: connect_switch
-                width: rootWindow.width / 2
+                width: rootWindow.width / 4
                 checked: latitude.getAutoConnect() ? true : false
                 onCheckedChanged: {
                     connect_value.text = checked
@@ -157,35 +144,58 @@ Page {
                 anchors.verticalCenter: connect_switch.verticalCenter
             }
         }
+        Row {
+            Label {
+                id: daemon_label
+                text: "Daemon at boot time"
+                width: rootWindow.width / 4
+                anchors.verticalCenter: daemon_switch.verticalCenter
+            }
+            Switch {
+                id: daemon_switch
+                width: rootWindow.width / 4
+                checked: latitude.getDaemonMode() ? true : false
+                onCheckedChanged: {
+                    daemon_value.text = checked
+                    latitude.setDaemonMode(checked)                }
+            }
+            Label {
+                id: daemon_value
+                text:  daemon_switch.checked
+                width: rootWindow.width / 4
+                anchors.verticalCenter: daemon_switch.verticalCenter
+            }
+        }
 
         Connections {
             target: latitude
             onGotToken: {
-                do_auth.enabled = false;
                 if (demonio.demonio_status()) {
-                    do_start.enabled = false;
-                    do_stop.enabled = true;
+                    do_staff.text = "Stop"
+                    do_staff.enabled = true;
                 } else {
-                    do_start.enabled = true;
-                    do_stop.enabled = false;
+                    do_staff.text = "Start"
+                    do_staff.enabled = true;
                 }
+                pageStack.pop(login)
             }
         }
+
         Connections {
             target: latitude
             onNotToken: {
-                do_auth.enabled = true;
-                do_start.enabled = false;
-                do_stop.enabled = false;
+                do_staff.text = "..."
+                do_staff.enabled = false;
                 if (!demonio.demonio_stop()) {
                     gps.stopUpdates(true)
                 }
+                latitude.getAccess()
             }
         }
         Connections {
             target: latitude
             onNeedAuth: {
-                do_auth.enabled = true;
+                pageStack.push(login)
             }
         }
 
@@ -199,4 +209,35 @@ Page {
             }
         }
     }
+
+    Component {
+        id: login
+        Page {
+            orientationLock: PageOrientation.LockPortrait
+            Flickable {
+                id: flickable
+                width: parent.width
+                height: parent.height
+                contentWidth: webView.width
+                contentHeight: webView.height
+                WebView {
+                    id: webView
+                    url: latitude.getUserAuthorization()
+                    preferredWidth: parent.width
+                    preferredHeight: parent.height
+                    onLoadFinished: {
+                        console.log(url)
+                        flickable.contentY = 0;
+                        if (url.toString().match("ServiceLogin")) {
+                            console.log("* QML WebView go w/2,0")
+                            flickable.contentX = width/2;
+                        } else {
+                            console.log("* QML WebView go 0,0")
+                            flickable.contentX = 0;
+                        }
+                    }
+                }
+            }
+        }
+    }
 }
index 0f4b557..4f2b35f 100644 (file)
@@ -8,7 +8,6 @@ MOBILITY += location
 INCLUDEPATH += ../liblatitudeupdater
 INCLUDEPATH += ../libkqoauth
 
-LIBS += ../liblocationmaemo5/liblocationmaemo5.a
 LIBS += ../liblatitudeupdater/liblatitudeupdater.a
 LIBS += ../libkqoauth/libkqoauth.a
 
@@ -20,3 +19,7 @@ OTHER_FILES += main.qml MainPage.qml
 
 include(../deployment.pri)
 qtcAddDeployment()
+
+
+
+
index bce7fda..f430c4b 100644 (file)
@@ -1,6 +1,28 @@
 #include <QtGui/QApplication>
+#include <QtGui/QInputContext>
 #include "qml.h"
 
+class EventFilter : public QObject {
+protected:
+    bool eventFilter(QObject *obj, QEvent *event) {
+        QInputContext *ic = qApp->inputContext();
+        if (ic) {
+            if (ic->focusWidget() == 0 && prevFocusWidget) {
+                QEvent closeSIPEvent(QEvent::CloseSoftwareInputPanel);
+                ic->filterEvent(&closeSIPEvent);
+            } else if (prevFocusWidget == 0 && ic->focusWidget()) {
+                QEvent openSIPEvent(QEvent::RequestSoftwareInputPanel);
+                ic->filterEvent(&openSIPEvent);
+            }
+            prevFocusWidget = ic->focusWidget();
+        }
+        return QObject::eventFilter(obj,event);
+    }
+
+private:
+    QWidget *prevFocusWidget;
+};
+
 int main(int argc, char *argv[]) {
     qDebug() << "* Main QML";
     QCoreApplication::setOrganizationName("linfati.com");
@@ -10,6 +32,8 @@ int main(int argc, char *argv[]) {
     QApplication lu(argc, argv);
 
     LatitudeQML mygui;
+    EventFilter ef;
+    mygui.installEventFilter(&ef);
     mygui.showFullScreen();
 
     return lu.exec();
index 6655bf5..95f0dae 100644 (file)
@@ -1,5 +1,5 @@
-import QtQuick 1.0
-import com.meego 1.0
+import QtQuick 1.1
+import com.nokia.meego 1.0
 
 PageStackWindow {
     id: rootWindow
index e4effe0..4cf4724 100644 (file)
@@ -8,7 +8,6 @@ MOBILITY += location
 INCLUDEPATH += ../liblatitudeupdater
 INCLUDEPATH += ../libkqoauth
 
-LIBS += ../liblocationmaemo5/liblocationmaemo5.a
 LIBS += ../liblatitudeupdater/liblatitudeupdater.a
 LIBS += ../libkqoauth/libkqoauth.a
 
diff --git a/latituded/latituded.conf b/latituded/latituded.conf
new file mode 100644 (file)
index 0000000..2865ad6
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# Example 3rd party application startup script.
+#
+# Install the startup script to /etc/init/apps.
+#
+# Applications are started after official stuff is done.
+#
+# The name of the script has to be unique, suffix .conf is mandatory.
+#
+# Applications are started in alphabetical order; note that
+# 3rd party applications are not run in malfunction state.
+#
+# Only these tags ("stanzas") are allowed.
+#
+# During installation, application can be  started by issuing command
+# "start apps/myapp" in post-install script. Note that suffix .conf is 
+# not allowed.
+#
+# If your app does not get started, run command /etc/init/xsession/app-precheck.sh
+
+description "Google Latitude Updater"
+author "rodrigo@linfati.cl"
+
+stop on stopping xsession
+
+console none
+
+# respawn
+# respawn limit 3 30
+# nice 2
+# normal exit 0
+
+exec /usr/bin/aegis-exec -s -u user -l "/opt/linfati.com/bin/latituded --init"
+
index eddda0c..b614f83 100644 (file)
@@ -8,12 +8,17 @@ MOBILITY += location
 INCLUDEPATH += ../liblatitudeupdater
 INCLUDEPATH += ../libkqoauth
 
-LIBS += ../liblocationmaemo5/liblocationmaemo5.a
 LIBS += ../liblatitudeupdater/liblatitudeupdater.a
 LIBS += ../libkqoauth/libkqoauth.a
 
 HEADERS += daemon.h
 SOURCES += daemon.cpp main.cpp
 
+OTHER_FILES += latituded.conf
+
+launcher.files = latituded.conf
+launcher.path = /etc/init/apps/
+INSTALLS += launcher
+
 include(../deployment.pri)
 qtcAddDeployment()
index fe07d64..25e1a04 100644 (file)
@@ -1,4 +1,5 @@
 #include <QtCore/QCoreApplication>
+#include <QtCore/QStringList>
 #include "daemon.h"
 
 int main(int argc, char *argv[]) {
@@ -12,5 +13,13 @@ int main(int argc, char *argv[]) {
 
     Q_UNUSED(mygui)
 
+    if ( lu.arguments().contains(QString("--init")) ) {
+        QSettings set;
+        if ( ! set.value("daemon",false).toBool() ) {
+            qDebug() << "No Daemon mode enable";
+            return 0;
+        }
+    }
+
     return lu.exec();
 }
index f8d0ff5..89989bf 100644 (file)
@@ -11,6 +11,14 @@ SUBDIRS = \
 
 contains(QT_CONFIG, maemo5): message(Maemo5)
 contains(MEEGO_EDITION,harmattan): message(Maemo6)
+linux-g++-maemo:!contains(MEEGO_EDITION,harmattan): {
+  MEEGO_VERSION_MAJOR     = 1
+  MEEGO_VERSION_MINOR     = 2
+  MEEGO_VERSION_PATCH     = 0
+  MEEGO_EDITION           = harmattan
+  DEFINES += MEEGO_EDITION_HARMATTAN
+  message(Maemo6-beta)
+}
 
 include(deployment.pri)
 qtcAddDeployment()
@@ -23,6 +31,9 @@ OTHER_FILES += \
         qtc_packaging/debian_harmattan/control \
         qtc_packaging/debian_harmattan/compat \
         qtc_packaging/debian_harmattan/changelog \
+        qtc_packaging/debian_harmattan/latitudeupdater.aegis \
+        qtc_packaging/debian_harmattan/latitudeupdater.postinst \
+        qtc_packaging/debian_harmattan/latitudeupdater.prerm \
         qtc_packaging/debian_fremantle/rules \
         qtc_packaging/debian_fremantle/rules.real \
         qtc_packaging/debian_fremantle/README \
index 8612f5f..25ae508 100644 (file)
@@ -48,7 +48,7 @@ void KQOAuthAuthReplyServerPrivate::onBytesReady() {
     
     QByteArray reply;
     QByteArray content;
-    content.append("<html><head><title>OAuth Finished!</title></head><body bgcolor='white' text='black'><center><h1>OAuth finished, return to the application!</h1></center></body></html>");
+    content.append("<HTML></HTML>");
 
     reply.append("HTTP/1.0 200 OK \r\n");
     reply.append("Content-Type: text/html; charset=\"utf-8\"\r\n");
index ddd768e..b133ff7 100644 (file)
@@ -18,7 +18,6 @@
  *  along with KQOAuth.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <QtCore>
-// #include <QDesktopServices>
 
 #include "kqoauthmanager.h"
 #include "kqoauthmanager_p.h"
@@ -203,7 +202,9 @@ void KQOAuthManager::executeRequest(KQOAuthRequest *request) {
     networkRequest.setRawHeader("Authorization", authHeader);
 
     connect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
-            this, SLOT(onRequestReplyReceived(QNetworkReply *)));
+            this, SLOT(onRequestReplyReceived(QNetworkReply *)), Qt::UniqueConnection);
+    disconnect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
+            this, SLOT(onAuthorizedRequestReplyReceived(QNetworkReply *)));
 
     if (request->httpMethod() == KQOAuthRequest::GET) {
         // Get the requested additional params as a list of pairs we can give QUrl
@@ -241,6 +242,103 @@ void KQOAuthManager::executeRequest(KQOAuthRequest *request) {
     d->r->requestTimerStart();
 }
 
+void KQOAuthManager::executeAuthorizedRequest(KQOAuthRequest *request, int id) {
+    Q_D(KQOAuthManager);
+
+    d->r = request;
+
+    if (request == 0) {
+        qWarning() << "Request is NULL. Cannot proceed.";
+        d->error = KQOAuthManager::RequestError;
+        return;
+    }
+
+    if (!request->requestEndpoint().isValid()) {
+        qWarning() << "Request endpoint URL is not valid. Cannot proceed.";
+        d->error = KQOAuthManager::RequestEndpointError;
+        return;
+    }
+
+    if (!request->isValid()) {
+        qWarning() << "Request is not valid. Cannot proceed.";
+        d->error = KQOAuthManager::RequestValidationError;
+        return;
+    }
+
+    d->currentRequestType = request->requestType();
+
+    QNetworkRequest networkRequest;
+    networkRequest.setUrl( request->requestEndpoint() );
+
+    if ( d->currentRequestType != KQOAuthRequest::AuthorizedRequest){
+        qWarning() << "Not Authorized Request. Cannot proceed";
+        d->error = KQOAuthManager::RequestError;
+        return;
+    }
+
+
+    // And now fill the request with "Authorization" header data.
+    QList<QByteArray> requestHeaders = request->requestParameters();
+    QByteArray authHeader;
+
+    bool first = true;
+    foreach (const QByteArray header, requestHeaders) {
+        if (!first) {
+            authHeader.append(", ");
+        } else {
+            authHeader.append("OAuth ");
+            first = false;
+        }
+
+        authHeader.append(header);
+    }
+    networkRequest.setRawHeader("Authorization", authHeader);
+
+
+    disconnect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
+            this, SLOT(onRequestReplyReceived(QNetworkReply *)));
+    connect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
+            this, SLOT(onAuthorizedRequestReplyReceived(QNetworkReply*)), Qt::UniqueConnection);
+
+    if (request->httpMethod() == KQOAuthRequest::GET) {
+        // Get the requested additional params as a list of pairs we can give QUrl
+        QList< QPair<QString, QString> > urlParams = d->createQueryParams(request->additionalParameters());
+
+        // Take the original URL and append the query params to it.
+        QUrl urlWithParams = networkRequest.url();
+        urlWithParams.setQueryItems(urlParams);
+        networkRequest.setUrl(urlWithParams);
+
+        // Submit the request including the params.
+        QNetworkReply *reply = d->networkManager->get(networkRequest);
+        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
+                 this, SLOT(slotError(QNetworkReply::NetworkError)));
+
+    } else if (request->httpMethod() == KQOAuthRequest::POST) {
+
+        networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, request->contentType());
+
+        /*
+        qDebug() << networkRequest.rawHeaderList();
+        qDebug() << networkRequest.rawHeader("Authorization");
+        qDebug() << networkRequest.rawHeader("Content-Type");
+        */
+        QNetworkReply *reply;
+        if (request->contentType() == "application/x-www-form-urlencoded") {
+          reply = d->networkManager->post(networkRequest, request->requestBody());
+        } else {
+          reply = d->networkManager->post(networkRequest, request->rawData());
+        }
+
+        d->requestIds.insert(reply, id);
+
+        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
+                 this, SLOT(slotError(QNetworkReply::NetworkError)));
+    }
+
+    d->r->requestTimerStart();
+}
+
 
 void KQOAuthManager::setHandleUserAuthorization(bool set) {
     Q_D(KQOAuthManager);
@@ -323,10 +421,8 @@ QUrl KQOAuthManager::getUserAuthorization(QUrl authorizationEndpoint) {
     QUrl openWebPageUrl(authorizationEndpoint.toString(), QUrl::StrictMode);
     openWebPageUrl.addQueryItem(tokenParam.first, tokenParam.second);
 
-    // Open the user's default browser to the resource authorization page provided
-    // by the service.
-    // QDesktopServices::openUrl(openWebPageUrl);
-    qDebug() << "* KQOAuthManager::getUserAuthorization -> QDesktopServices::openUrl" << openWebPageUrl;
+    // Return the resource authorization page provided by the service.
+    qDebug() << "KQOAuthManager::getUserAuthorization " << openWebPageUrl;
     return openWebPageUrl;
 }
 
@@ -408,6 +504,12 @@ void KQOAuthManager::onRequestReplyReceived( QNetworkReply *reply ) {
         break;
     }
 
+    // Let's disconnect this slot first
+    /*
+    disconnect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
+            this, SLOT(onRequestReplyReceived(QNetworkReply *)));
+    */
+
     // Read the content of the reply from the network.
     QByteArray networkReply = reply->readAll();
 
@@ -457,6 +559,61 @@ void KQOAuthManager::onRequestReplyReceived( QNetworkReply *reply ) {
     reply->deleteLater();           // We need to clean this up, after the event processing is done.
 }
 
+void KQOAuthManager::onAuthorizedRequestReplyReceived( QNetworkReply *reply ) {
+    Q_D(KQOAuthManager);
+
+    QNetworkReply::NetworkError networkError = reply->error();
+    switch (networkError) {
+    case QNetworkReply::NoError:
+        d->error = KQOAuthManager::NoError;
+        break;
+
+    case QNetworkReply::ContentAccessDenied:
+    case QNetworkReply::AuthenticationRequiredError:
+        d->error = KQOAuthManager::RequestUnauthorized;
+        break;
+
+    default:
+        d->error = KQOAuthManager::NetworkError;
+        break;
+    }
+
+    /*
+    disconnect(d->networkManager, SIGNAL(finished(QNetworkReply *)),
+            this, SLOT(onAuthorizedRequestReplyReceived(QNetworkReply *)));
+    */
+
+    // Read the content of the reply from the network.
+    QByteArray networkReply = reply->readAll();
+
+    // Stop any timer we have set on the request.
+    d->r->requestTimerStop();
+
+    // Just don't do anything if we didn't get anything useful.
+    if(networkReply.isEmpty()) {
+        reply->deleteLater();
+        return;
+    }
+
+    // We need to emit the signal even if we got an error.
+    if (d->error != KQOAuthManager::NoError) {
+        qWarning() << "Network reply error";
+        return;
+    }
+
+
+    d->opaqueRequest->clearRequest();
+    d->opaqueRequest->setHttpMethod(KQOAuthRequest::POST);   // XXX FIXME: Convenient API does not support GET
+    if (d->currentRequestType == KQOAuthRequest::AuthorizedRequest) {
+                emit authorizedRequestDone();
+     }
+
+    int id = d->requestIds.take(reply);
+    emit authorizedRequestReady(networkReply, id);
+    reply->deleteLater();
+}
+
+
 void KQOAuthManager::onVerificationReceived(QMultiMap<QString, QString> response) {
     Q_D(KQOAuthManager);
 
@@ -487,6 +644,7 @@ void KQOAuthManager::slotError(QNetworkReply::NetworkError error) {
     emit authorizedRequestDone();
 
     QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
+    d->requestIds.remove(reply);
     reply->deleteLater();
 }
 
index cdd0f4e..1aaba17 100644 (file)
@@ -58,7 +58,8 @@ public:
      * When the request is done it will emit signal requestReady(QByteArray networkReply).
      * NOTE: At the moment there is no timeout for the request.
      */
-    void executeRequest(KQOAuthRequest *request);
+    void executeRequest(KQOAuthRequest *request);    
+    void executeAuthorizedRequest(KQOAuthRequest *request, int id);
     /**
      * Indicates to the user that KQOAuthManager should handle user authorization by
      * opening the user's default browser and parsing the reply from the service.
@@ -140,6 +141,8 @@ Q_SIGNALS:
     // Parameter is the raw response from the service.
     void requestReady(QByteArray networkReply);
 
+    void authorizedRequestReady(QByteArray networkReply, int id);
+
     // This signal will be emited when we have an request tokens available
     // (either temporary resource tokens, or authorization tokens).
     void receivedToken(QString oauth_token, QString oauth_token_secret);   // oauth_token, oauth_token_secret
@@ -164,6 +167,7 @@ Q_SIGNALS:
 
 private Q_SLOTS:
     void onRequestReplyReceived( QNetworkReply *reply );
+    void onAuthorizedRequestReplyReceived( QNetworkReply *reply );
     void onVerificationReceived(QMultiMap<QString, QString> response);
     void slotError(QNetworkReply::NetworkError error);
 
index ecbbb7b..6b849db 100644 (file)
@@ -64,6 +64,7 @@ public:
     bool autoAuth;
     QNetworkAccessManager *networkManager;
     bool managerUserSet;
+    QMap<QNetworkReply*, int> requestIds;
 
     Q_DECLARE_PUBLIC(KQOAuthManager);
 };
index dcd230f..7a6cef9 100644 (file)
@@ -2,6 +2,7 @@ TEMPLATE = lib
 CONFIG   += staticlib
 TARGET   = kqoauth
 
+QT       -= gui
 QT       += network
 
 HEADERS += kqoauthauthreplyserver.h \
@@ -21,3 +22,6 @@ SOURCES += kqoauthauthreplyserver.cpp \
            kqoauthrequest_1.cpp \
            kqoauthrequest_xauth.cpp \
            kqoauthutils.cpp
+
+target.path = /opt/linfati.com/lib
+INSTALLS += target
diff --git a/libkqoauth/no_desktopservice.patch b/libkqoauth/no_desktopservice.patch
new file mode 100644 (file)
index 0000000..0f78b27
--- /dev/null
@@ -0,0 +1,59 @@
+diff -up ../../kqoauth/src//kqoauthmanager.cpp ./kqoauthmanager.cpp
+--- ../../kqoauth/src//kqoauthmanager.cpp      2011-10-22 22:23:12.391025442 +0200
++++ ./kqoauthmanager.cpp       2011-10-22 22:44:06.897246201 +0200
+@@ -18,7 +18,6 @@
+  *  along with KQOAuth.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ #include <QtCore>
+-#include <QDesktopServices>
+ #include "kqoauthmanager.h"
+ #include "kqoauthmanager_p.h"
+@@ -401,19 +400,19 @@ QNetworkAccessManager * KQOAuthManager::
+ //////////// Public convenience API /////////////
+-void KQOAuthManager::getUserAuthorization(QUrl authorizationEndpoint) {
++QUrl KQOAuthManager::getUserAuthorization(QUrl authorizationEndpoint) {
+     Q_D(KQOAuthManager);
+     if (!d->hasTemporaryToken) {
+         qWarning() << "No temporary tokens retreieved. Cannot get user authorization.";
+         d->error = KQOAuthManager::RequestUnauthorized;
+-        return;
++        return QString();
+     }
+     if (!authorizationEndpoint.isValid()) {
+         qWarning() << "Authorization endpoint not valid. Cannot proceed.";
+         d->error = KQOAuthManager::RequestEndpointError;
+-        return;
++        return QString();
+     }
+     d->error = KQOAuthManager::NoError;
+@@ -422,9 +421,9 @@ void KQOAuthManager::getUserAuthorizatio
+     QUrl openWebPageUrl(authorizationEndpoint.toString(), QUrl::StrictMode);
+     openWebPageUrl.addQueryItem(tokenParam.first, tokenParam.second);
+-    // Open the user's default browser to the resource authorization page provided
+-    // by the service.
+-    QDesktopServices::openUrl(openWebPageUrl);
++    // Return the resource authorization page provided by the service.
++    qDebug() << "KQOAuthManager::getUserAuthorization " << openWebPageUrl;
++    return openWebPageUrl;
+ }
+ void KQOAuthManager::getUserAccessTokens(QUrl accessTokenEndpoint) {
+diff -up ../../kqoauth/src//kqoauthmanager.h ./kqoauthmanager.h
+--- ../../kqoauth/src//kqoauthmanager.h        2011-10-22 22:23:12.391025442 +0200
++++ ./kqoauthmanager.h 2011-10-22 22:39:48.715965943 +0200
+@@ -103,7 +103,7 @@ public:
+      * us to access protected resources, the verifier token is stored in KQOAuthManager for further use.
+      * In order to use this method, you must set setHandleUserAuthorization() to true.
+      */
+-    void getUserAuthorization(QUrl authorizationEndpoint);
++    QUrl getUserAuthorization(QUrl authorizationEndpoint);
+     /**
+      * This is a convenience API for retrieving the access token in exchange for the temporary token and the
+      * verifier.
index d111370..6312633 100644 (file)
@@ -144,6 +144,16 @@ bool GoogleLatitude::getAutoConnect() {
     return OauthSettings.value("net_auto", true).toBool();
 }
 
+void GoogleLatitude::setDaemonMode(bool status) {
+    qDebug() << "* GoogleLatitude::setDaemonMode" << status;
+    OauthSettings.setValue("daemon", status);
+}
+
+bool GoogleLatitude::getDaemonMode() {
+    qDebug() << "* GoogleLatitude::getDaemonMode";
+    return OauthSettings.value("daemon", true).toBool();
+}
+
 void GoogleLatitude::onTemporaryTokenReceived(QString temporaryToken, QString temporaryTokenSecret) {
     qDebug() << "* GoogleLatitude::onTemporaryTokenReceived" << temporaryToken << temporaryTokenSecret;
     if( OauthManager->lastError() == KQOAuthManager::NoError) {
@@ -171,8 +181,10 @@ void GoogleLatitude::onAccessTokenReceived(QString token, QString tokenSecret) {
 void GoogleLatitude::onRequestReady(QByteArray response) {
     qDebug() << "* GoogleLatitude::onRequestReady" << response;
     if (response.contains("Invalid Credentials") ) {
+        qDebug() << "* GoogleLatitude::onRequestReady" << "Invalid Credentials";
         OauthSettings.remove("oauth_token");
         OauthSettings.remove("oauth_token_secret");
+        UserAuthorization.clear();
         emit notToken();
     }
 }
index 1f99a24..6b02e9a 100644 (file)
@@ -21,6 +21,8 @@ public slots:
     QUrl getUserAuthorization();
     void setAutoConnect(bool status);
     bool getAutoConnect();
+    void setDaemonMode(bool status);
+    bool getDaemonMode();
 
 private slots:
     void onTemporaryTokenReceived(QString temporaryToken, QString temporaryTokenSecret);
index 606824b..8a7b82b 100644 (file)
@@ -19,8 +19,3 @@ SOURCES += gconfitem.cpp \
            qgeopositioninfosource_maemo5.cpp \
            qgeosatelliteinfosource_maemo5.cpp
 }
-
-contains(MEEGO_EDITION,harmattan) {
-    target.path = /opt/liblocationmaemo5/lib
-    INSTALLS += target
-}
index 006c02e..c924625 100644 (file)
@@ -1,3 +1,9 @@
+googlelatitude (0.8.0) unstable; urgency=low
+
+  * Ovi Store
+
+ -- Rodrigo Linfati <rodrigo@linfati.cl>  Sun, 11 Sep 2011 19:01:01 +0200
+
 googlelatitude (0.7-1) unstable; urgency=low
 
   * Enable invoker
index 073fff5..3ef27db 100644 (file)
@@ -1,4 +1,10 @@
-latitudeupdater (0.7-1) unstable; urgency=low
+latitudeupdater (0.8.0) unstable; urgency=low
+
+  * Ovi Store
+
+ -- Rodrigo Linfati <rodrigo@linfati.cl>  Sun, 11 Sep 2011 19:01:01 +0200
+
+latitudeupdater (0.8.0) unstable; urgency=low
 
   * Enable invoker
 
index b5161b3..211e227 100644 (file)
@@ -2,7 +2,7 @@ Source: latitudeupdater
 Section: user/navigation
 Priority: optional
 Maintainer: Rodrigo Linfati <rodrigo@linfati.cl>
-Build-Depends: debhelper (>= 5), libqt4-dev, libqtm-dev, applauncherd-dev, aegis-builder
+Build-Depends: debhelper (>= 5), libqt4-dev, libqtm-dev, applauncherd-dev, aegis-builder, pkg-config
 Standards-Version: 3.7.3
 Homepage: http://www.linfati.com/
 XSBC-Bugtracker: mailto:rodrigo@linfati.cl
@@ -10,7 +10,6 @@ XSBC-Bugtracker: mailto:rodrigo@linfati.cl
 Package: latitudeupdater
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Replaces: googlelatitude
 Description: Google Latitude Updater
  Features:
   - Retrieve location using Cell Tower and/or Gps and send to Google Latitude
diff --git a/qtc_packaging/debian_harmattan/latitudeupdater.postinst b/qtc_packaging/debian_harmattan/latitudeupdater.postinst
new file mode 100644 (file)
index 0000000..852a94d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f /targets/links/scratchbox.config ]
+  then
+    echo "Starting latituded"
+    start apps/latituded
+  fi
+
+exit 0
diff --git a/qtc_packaging/debian_harmattan/latitudeupdater.prerm b/qtc_packaging/debian_harmattan/latitudeupdater.prerm
new file mode 100644 (file)
index 0000000..b9a70d6
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f /targets/links/scratchbox.config ]
+  then
+    echo "Stoping latituded"
+    stop apps/latituded
+  fi
+
+exit 0