#define FACEBOOKAUTHENTICATION_H
#include <QUrl>
-#include "facebookcredentials.h"
/**
* @brief FacebookAuthentication class takes care of parsing and handling of credentials for
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
-public:
- /**
- * @brief Getter for m_loginCredentials
- *
- * @return FacebookCredentials
- */
- FacebookCredentials loginCredentials() const;
-
public slots:
/**
*/
void clearAccountInformation(bool keepUsername = false);
- /**
- * @brief Loads username from settings
- *
- * @return QString Loaded username
- */
- const QString loadUsername();
-
- /**
- * @brief Saves username to settings
- *
- * @param username Username to be saved
- */
- void saveUsername(const QString &username);
-
- /**
- * @brief Shows the m_webView and loads page that is specified in the m_facebookLoginPage
- * variable. Specifies font size for the page.
- *
- */
- void start();
-
private:
- QString parseAccessToken(const QUrl &url);
+ QString parseSession(const QUrl &url);
private slots:
void loadFinished(bool ok);
- /**
- * @brief Search credentials from URL that is given as parameter.
- * If credentials are found thay are stored to loginCredentials variable.
- *
- * @param url URL where this method tries to find credentials.
- * @return bool if credentials are found returns true,
- * if credentials are not found returns false.
- */
- bool updateCredentials(const QUrl & url);
-
void urlChanged(const QUrl &url);
/*******************************************************************************
* SIGNALS
******************************************************************************/
-
signals:
/**
*/
void error(const int context, const int error);
- /**
- * @brief This signal is emitted if updateCredentials method finds credentials from URL.
- * Signal is also emitted at the beginning of the program if there is valid credentials
- * in the file.
- *
- * @param credentials New credentials
- */
- void credentialsReady(const FacebookCredentials &credentials);
-
- void loggedIn(const QString accessToken);
-
- /**
- * @brief This signal is emitted always when login is called. At first the application tries
- * to login using saved cookies
- *
- */
- void loginUsingCookies();
+ void loggedIn(const QString session);
/**
* @brief Signals when credentials are invalid new login is needed
*/
void newLoginRequest();
- /**
- * @brief This signal is emitted when new cookies need to be saved.
- *
- */
- void saveCookiesRequest();
-
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
-
private:
- bool m_freshLogin; ///< Flag for fresh login
- /**
- * @brief Dataclass that contains authorization to use facebook. Dataclass is composed of five
- * QStrings and setters and getters.
- *
- * @var m_loginCredentials
- */
- FacebookCredentials m_loginCredentials;
};
#endif // FACEBOOKAUTHENTICATION_H