From: Rodrigo Linfati Date: Sat, 22 Oct 2011 23:24:57 +0000 (+0200) Subject: Work in progress: hacks at vienna, do not use it X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=commitdiff_plain;h=913f2f5465da25223c88a0fcad5a3d59ef305200 Work in progress: hacks at vienna, do not use it --- diff --git a/latitude.qml/MainPage.qml b/latitude.qml/MainPage.qml index caeb84f..8916389 100644 --- a/latitude.qml/MainPage.qml +++ b/latitude.qml/MainPage.qml @@ -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; + } + } + } + } + } + } } diff --git a/latitude.qml/latitude.qml.pro b/latitude.qml/latitude.qml.pro index 0f4b557..4f2b35f 100644 --- a/latitude.qml/latitude.qml.pro +++ b/latitude.qml/latitude.qml.pro @@ -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() + + + + diff --git a/latitude.qml/main.cpp b/latitude.qml/main.cpp index bce7fda..f430c4b 100644 --- a/latitude.qml/main.cpp +++ b/latitude.qml/main.cpp @@ -1,6 +1,28 @@ #include +#include #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(); diff --git a/latitude.qml/main.qml b/latitude.qml/main.qml index 6655bf5..95f0dae 100644 --- a/latitude.qml/main.qml +++ b/latitude.qml/main.qml @@ -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 diff --git a/latitude.qt/latitude.qt.pro b/latitude.qt/latitude.qt.pro index e4effe0..4cf4724 100644 --- a/latitude.qt/latitude.qt.pro +++ b/latitude.qt/latitude.qt.pro @@ -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 index 0000000..2865ad6 --- /dev/null +++ b/latituded/latituded.conf @@ -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" + diff --git a/latituded/latituded.pro b/latituded/latituded.pro index eddda0c..b614f83 100644 --- a/latituded/latituded.pro +++ b/latituded/latituded.pro @@ -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() diff --git a/latituded/main.cpp b/latituded/main.cpp index fe07d64..25e1a04 100644 --- a/latituded/main.cpp +++ b/latituded/main.cpp @@ -1,4 +1,5 @@ #include +#include #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(); } diff --git a/latitudeupdater.pro b/latitudeupdater.pro index f8d0ff5..89989bf 100644 --- a/latitudeupdater.pro +++ b/latitudeupdater.pro @@ -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 \ diff --git a/libkqoauth/kqoauthauthreplyserver.cpp b/libkqoauth/kqoauthauthreplyserver.cpp index 8612f5f..25ae508 100644 --- a/libkqoauth/kqoauthauthreplyserver.cpp +++ b/libkqoauth/kqoauthauthreplyserver.cpp @@ -48,7 +48,7 @@ void KQOAuthAuthReplyServerPrivate::onBytesReady() { QByteArray reply; QByteArray content; - content.append("OAuth Finished!

OAuth finished, return to the application!

"); + content.append(""); reply.append("HTTP/1.0 200 OK \r\n"); reply.append("Content-Type: text/html; charset=\"utf-8\"\r\n"); diff --git a/libkqoauth/kqoauthmanager.cpp b/libkqoauth/kqoauthmanager.cpp index ddd768e..b133ff7 100644 --- a/libkqoauth/kqoauthmanager.cpp +++ b/libkqoauth/kqoauthmanager.cpp @@ -18,7 +18,6 @@ * along with KQOAuth. If not, see . */ #include -// #include #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 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 > 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 response) { Q_D(KQOAuthManager); @@ -487,6 +644,7 @@ void KQOAuthManager::slotError(QNetworkReply::NetworkError error) { emit authorizedRequestDone(); QNetworkReply *reply = qobject_cast(sender()); + d->requestIds.remove(reply); reply->deleteLater(); } diff --git a/libkqoauth/kqoauthmanager.h b/libkqoauth/kqoauthmanager.h index cdd0f4e..1aaba17 100644 --- a/libkqoauth/kqoauthmanager.h +++ b/libkqoauth/kqoauthmanager.h @@ -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 response); void slotError(QNetworkReply::NetworkError error); diff --git a/libkqoauth/kqoauthmanager_p.h b/libkqoauth/kqoauthmanager_p.h index ecbbb7b..6b849db 100644 --- a/libkqoauth/kqoauthmanager_p.h +++ b/libkqoauth/kqoauthmanager_p.h @@ -64,6 +64,7 @@ public: bool autoAuth; QNetworkAccessManager *networkManager; bool managerUserSet; + QMap requestIds; Q_DECLARE_PUBLIC(KQOAuthManager); }; diff --git a/libkqoauth/libkqoauth.pro b/libkqoauth/libkqoauth.pro index dcd230f..7a6cef9 100644 --- a/libkqoauth/libkqoauth.pro +++ b/libkqoauth/libkqoauth.pro @@ -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 index 0000000..0f78b27 --- /dev/null +++ b/libkqoauth/no_desktopservice.patch @@ -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 . + */ + #include +-#include + + #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. diff --git a/liblatitudeupdater/googlelatitude.cpp b/liblatitudeupdater/googlelatitude.cpp index d111370..6312633 100644 --- a/liblatitudeupdater/googlelatitude.cpp +++ b/liblatitudeupdater/googlelatitude.cpp @@ -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(); } } diff --git a/liblatitudeupdater/googlelatitude.h b/liblatitudeupdater/googlelatitude.h index 1f99a24..6b02e9a 100644 --- a/liblatitudeupdater/googlelatitude.h +++ b/liblatitudeupdater/googlelatitude.h @@ -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); diff --git a/liblocationmaemo5/liblocationmaemo5.pro b/liblocationmaemo5/liblocationmaemo5.pro index 606824b..8a7b82b 100644 --- a/liblocationmaemo5/liblocationmaemo5.pro +++ b/liblocationmaemo5/liblocationmaemo5.pro @@ -19,8 +19,3 @@ SOURCES += gconfitem.cpp \ qgeopositioninfosource_maemo5.cpp \ qgeosatelliteinfosource_maemo5.cpp } - -contains(MEEGO_EDITION,harmattan) { - target.path = /opt/liblocationmaemo5/lib - INSTALLS += target -} diff --git a/qtc_packaging/debian_fremantle/changelog b/qtc_packaging/debian_fremantle/changelog index 006c02e..c924625 100644 --- a/qtc_packaging/debian_fremantle/changelog +++ b/qtc_packaging/debian_fremantle/changelog @@ -1,3 +1,9 @@ +googlelatitude (0.8.0) unstable; urgency=low + + * Ovi Store + + -- Rodrigo Linfati Sun, 11 Sep 2011 19:01:01 +0200 + googlelatitude (0.7-1) unstable; urgency=low * Enable invoker diff --git a/qtc_packaging/debian_harmattan/changelog b/qtc_packaging/debian_harmattan/changelog index 073fff5..3ef27db 100644 --- a/qtc_packaging/debian_harmattan/changelog +++ b/qtc_packaging/debian_harmattan/changelog @@ -1,4 +1,10 @@ -latitudeupdater (0.7-1) unstable; urgency=low +latitudeupdater (0.8.0) unstable; urgency=low + + * Ovi Store + + -- Rodrigo Linfati Sun, 11 Sep 2011 19:01:01 +0200 + +latitudeupdater (0.8.0) unstable; urgency=low * Enable invoker diff --git a/qtc_packaging/debian_harmattan/control b/qtc_packaging/debian_harmattan/control index b5161b3..211e227 100644 --- a/qtc_packaging/debian_harmattan/control +++ b/qtc_packaging/debian_harmattan/control @@ -2,7 +2,7 @@ Source: latitudeupdater Section: user/navigation Priority: optional Maintainer: Rodrigo Linfati -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 index 0000000..852a94d --- /dev/null +++ b/qtc_packaging/debian_harmattan/latitudeupdater.postinst @@ -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 index 0000000..b9a70d6 --- /dev/null +++ b/qtc_packaging/debian_harmattan/latitudeupdater.prerm @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ ! -f /targets/links/scratchbox.config ] + then + echo "Stoping latituded" + stop apps/latituded + fi + +exit 0