2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef SITUARESERVICE_H
24 #define SITUARESERVICE_H
28 #include <QNetworkAccessManager>
29 #include <QNetworkRequest>
30 #include <QNetworkReply>
33 #include "../facebookservice/facebookauthentication.h" // not final
34 #include "../facebookservice/facebookcredentials.h" // not final
37 * @brief SituareService class for communicating with Situare server
39 * @class SituareService situareservice.h "situareservice/situareservice.h"
41 class SituareService : public QObject
48 * @brief Default constructor
51 * @param parent instance of parent
52 * @param manager instance of QNetworkAccessManager
54 SituareService(QObject *parent = 0, QNetworkAccessManager *manager = 0);
58 * @brief Updates location to the Situare server
61 * @param coordinates current cordinates
62 * @param status message
63 * @param publish publish location on Facebook wall (true/false)
65 void updateLocation(QPointF coordinates, QString status, bool publish);
68 * @brief Translates coordinates to street address via Situare server
71 * @param coordinates coordinates to be translated
73 void reverseGeo(QPointF coordinates);
76 * @brief Forms a http url
79 * @param baseUrl Server url
80 * @param phpScript Server script
81 * @param urlParameters optional parameters for url
82 * @return QUrl formed url
84 QUrl formUrl(const QString baseUrl, const QString phpScript, QString urlParameters = 0);
87 * @brief Forms url parameters
89 * @fn formUrlParameters
90 * @param coordinates current coordinates
91 * @param status optional status message
92 * @param publish optional publish location on Facebook wall (true/false)
95 QString formUrlParameters(QPointF coordinates, QString status = 0, QString publish = 0);
98 * @brief Sends http request
101 * @param url destination
102 * @param cookieType type of the cookie
103 * @param cookie http cookie
105 void sendRequest(QUrl url, const QString cookieType, QString cookie);
110 * @brief Signals error
113 * @param error error message
115 void error(const QString &error);
120 * @brief Public slot, which indicates when http request has been completed
122 * @fn requestFinished
123 * @param reply storage for http reply
125 void requestFinished(QNetworkReply *reply);
128 void credentialsReady(); // not final
131 QNetworkAccessManager *networkManager;
132 QList<QNetworkReply *> currentRequests;
133 FacebookAuthentication facebookAuthentication; // not final
134 FacebookCredentials credentials; // not final
137 #endif // SITUARESERVICE_H