00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Ville Tiensuu - ville.tiensuu@ixonos.com 00006 Kaj Wallin - kaj.wallin@ixonos.com 00007 Henri Lampela - henri.lampela@ixonos.com 00008 00009 Situare is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 version 2 as published by the Free Software Foundation. 00012 00013 Situare is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Situare; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00021 USA. 00022 */ 00023 00024 #ifndef FACEBOOKAUTHENTICATION_H 00025 #define FACEBOOKAUTHENTICATION_H 00026 00027 #include <QUrl> 00028 #include "facebookcredentials.h" 00029 00037 class FacebookAuthentication : public QObject 00038 { 00039 Q_OBJECT 00040 00041 public: 00049 FacebookAuthentication(QObject *parent = 0); 00050 00051 /******************************************************************************* 00052 * MEMBER FUNCTIONS AND SLOTS 00053 ******************************************************************************/ 00054 00060 FacebookCredentials loginCredentials() const; 00061 00062 public slots: 00063 00069 void clearAccountInformation(bool keepUsername = false); 00070 00076 const QString loadUsername(); 00077 00083 void saveUsername(const QString &username); 00084 00090 void start(); 00091 00092 private slots: 00093 00102 bool updateCredentials(const QUrl & url); 00103 00104 /******************************************************************************* 00105 * SIGNALS 00106 ******************************************************************************/ 00107 00108 signals: 00109 00115 void error(const QString &error); 00116 00124 void credentialsReady(const FacebookCredentials &credentials); 00125 00130 void loginFailure(); 00131 00137 void loginUsingCookies(); 00138 00143 void newLoginRequest(); 00144 00149 void saveCookiesRequest(); 00150 00151 /******************************************************************************* 00152 * DATA MEMBERS 00153 ******************************************************************************/ 00154 00155 private: 00156 00157 bool m_freshLogin; 00158 00165 FacebookCredentials m_loginCredentials; 00166 }; 00167 00168 #endif // FACEBOOKAUTHENTICATION_H