Cleaning out old login code ongoing
[situare] / src / facebookservice / facebookauthentication.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Ville Tiensuu - ville.tiensuu@ixonos.com
6        Kaj Wallin - kaj.wallin@ixonos.com
7        Henri Lampela - henri.lampela@ixonos.com
8
9    Situare is free software; you can redistribute it and/or
10    modify it under the terms of the GNU General Public License
11    version 2 as published by the Free Software Foundation.
12
13    Situare is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with Situare; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
21    USA.
22 */
23
24 #ifndef FACEBOOKAUTHENTICATION_H
25 #define FACEBOOKAUTHENTICATION_H
26
27 #include <QUrl>
28
29 /**
30 * @brief FacebookAuthentication class takes care of parsing and handling of  credentials for
31 *        Facebook. Other components of Situare application needs credentials to communicate with
32 *        facebook.
33 *
34 * @author Ville Tiensuu
35 */
36 class FacebookAuthentication : public QObject
37 {
38     Q_OBJECT
39
40 public:
41     /**
42     * @brief FacebookAuthentication constructor
43     *
44     * -Checks if there is valid credentials stored on the file. If there is emits signal.
45     *
46     * @param parent instance of parent
47     */
48     FacebookAuthentication(QObject *parent = 0);
49
50 /*******************************************************************************
51  * MEMBER FUNCTIONS AND SLOTS
52  ******************************************************************************/
53 public slots:
54
55     /**
56     * @brief Clears account iformation from settings
57     *
58     * @param keepUsername keep = true, false otherwise
59     */
60     void clearAccountInformation(bool keepUsername = false);
61
62 private:
63     QString parseSession(const QUrl &url);
64
65 private slots:
66
67     void loadFinished(bool ok);
68
69     void urlChanged(const QUrl &url);
70
71 /*******************************************************************************
72  * SIGNALS
73  ******************************************************************************/
74 signals:
75
76     /**
77     * @brief Signals error
78     *
79     * @param context error context
80     * @param error error code
81     */
82     void error(const int context, const int error);
83
84     void loggedIn(const QString session);
85
86     /**
87     * @brief Signals when credentials are invalid new login is needed
88     *
89     */
90     void newLoginRequest();
91
92 /*******************************************************************************
93  * DATA MEMBERS
94  ******************************************************************************/
95 private:
96
97
98 };
99
100 #endif // FACEBOOKAUTHENTICATION_H