X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fsituareservice%2Fsituareservice.h;h=1f8a1716bdfc4e65eec6fe45499e1c9a65160e72;hb=6929a95d4efa92233e108ca7ffb2dd75ba3f2e70;hp=d34b35746b2522cd13df95a0ba99504b68d745f4;hpb=00738c4d5e872bc60d30f6da5ee148ae8a9d81ee;p=situare diff --git a/src/situareservice/situareservice.h b/src/situareservice/situareservice.h index d34b357..1f8a171 100644 --- a/src/situareservice/situareservice.h +++ b/src/situareservice/situareservice.h @@ -3,6 +3,7 @@ Copyright (C) 2010 Ixonos Plc. Authors: Henri Lampela - henri.lampela@ixonos.com + Sami Rämö - sami.ramo@ixonos.com Situare is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -24,7 +25,7 @@ #define SITUARESERVICE_H #include -#include "../facebookservice/facebookcredentials.h" + #include "../user/user.h" #include "imagefetcher.h" @@ -38,7 +39,7 @@ class QUrl; * @brief SituareService class for communicating with Situare server * * @author Henri Lampela -* @class SituareService situareservice.h "situareservice/situareservice.h" +* @author Sami Rämö - sami.ramo (at) ixonos.com */ class SituareService : public QObject { @@ -94,19 +95,19 @@ public slots: void clearUserData(); /** - * @brief Public slot, which indicates when facebook credentials are ready - * - * @param credentials New credentials - */ - void credentialsReady(const FacebookCredentials &credentials); - - /** * @brief Public slot, which indicates when http request has been completed * * @param reply storage for http reply */ void requestFinished(QNetworkReply *reply); + /** + * @brief Update session data + * + * @param session New session data + */ + void updateSession(const QString &session); + private: /** @@ -118,42 +119,19 @@ private: void addProfileImages(const QList &imageUrlList); /** - * @brief Forms a http cookie - * - * @param apiKeyValue application key - * @param expiresValue session expire date&time from Facebook - * @param userValue user id from Facebook - * @param sessionKeyValue session key from Facebook - * @param sessionSecretValue session secret from Facebook - * @param signatureValue md5 generated signature - * @param localeValue used locale - * @return QString formed cookie - */ - QString formCookie(const QString &apiKeyValue, QString expiresValue, QString userValue, - QString sessionKeyValue, QString sessionSecretValue, - const QString &signatureValue, const QString &localeValue); - - /** - * @brief Forms a http url - * - * @param baseUrl Server url - * @param phpScript Server script - * @param urlParameters optional parameters for url - * @return QUrl formed url - */ - QUrl formUrl(const QString &baseUrl, const QString &phpScript, - QString urlParameters = QString()); + * @brief Append access_token and other session data to the reques url + * + * @param[in,out] requestUrl Request URL with other request parameters and ending to & + */ + void appendAccessToken(QString &requestUrl); /** - * @brief Forms url parameters - * - * @param coordinates current coordinates - * @param status optional status message - * @param publish optional publish location on Facebook wall - * @return QString - */ - QString formUrlParameters(const GeoCoordinate &coordinates, QString status = QString(), - bool publish = false); + * @brief Convert coordinate value in degrees (double) to string with enough precision + * + * @param degrees Coordinate value in degrees + * @returns Coordinate value as string + */ + QString degreesToString(double degrees); /** * @brief Parses user and friend data from JSON string @@ -163,16 +141,24 @@ private: void parseUserData(const QByteArray &jsonReply); /** - * @brief Sends http request - * - * @param url destination - * @param cookieType type of the cookie - * @param cookie http cookie - */ - void sendRequest(const QUrl &url, const QString &cookieType, const QString &cookie); + * @brief Build and send request + * + * Appends script pathname and parameters to the server base URL. Access token is appended and + * the request sent if the access token is available, otherwise the request is queued. + * + * @param script Requested script pathname + * @param parameters Hash containing parameter key/value pairs. + */ + void buildRequest(const QString &script, const QHash ¶meters); -private slots: + /** + * @brief Send request + * + * @param requestUrl Request URL containing also all parameters + */ + void sendRequest(const QString &requestUrl); +private slots: /** * @brief Slot for received images * @@ -235,15 +221,15 @@ signals: ******************************************************************************/ private: - bool m_defaultImage; ///< Indicates if some of the friends/user doesn't have a image - QList m_currentRequests; ///< List of current http requests - QList m_friendsList; ///< List of friends(User) + QList m_currentRequests; ///< List of current http requests + QList m_friendsList; ///< List of friends(User) + + QString m_session; ///< Session data - NetworkAccessManager *m_networkManager; ///< Pointer to QNetworkAccessManager + NetworkAccessManager *m_networkManager; ///< Pointer to QNetworkAccessManager - FacebookCredentials m_credentials; ///< handle for FacebookCredentials ImageFetcher *m_imageFetcher; ///< Instance of the image fetcher User *m_user; ///< Pointer to User };