public:
/**
- * @brief FacebookAuthentication constructor
+ * @brief Constructor
*
- * -Checks if there is valid credentials stored on the file. If there is emits signal.
+ * Initiates internal data members.
*
* @param mainWindow MainWindow instance
- * @param parent instance of parent
+ * @param parent Instance of the parent
*/
FacebookAuthentication(MainWindow *mainWindow, QObject *parent = 0);
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public:
+ /**
+ * @brief Initiate login process
+ *
+ * Builds login browser and starts loading login URL.
+ */
void login();
public slots:
/**
- * @brief Clears account iformation from settings
+ * @brief Clears account information from settings
*
* @param keepUsername keep = true, false otherwise
*/
void clearAccountInformation(bool keepUsername = false);
private:
+ /**
+ * @brief Destroy login dialog and browser
+ */
void destroyLogin();
+ /**
+ * @brief Parses the session information from the URL
+ *
+ * @param url URL
+ * @returns Parsed session, or empty string if parsing failed.
+ */
QString parseSession(const QUrl &url);
private slots:
+ /**
+ * @brief Cleanup after browser is destructed
+ *
+ * Clears the pointer to the browser and disables the progress indicator.
+ */
void browserDestroyed();
- void loadFinished(bool ok);
-
+ /**
+ * @brief Handler for login page loading errors
+ *
+ * @param reply Network reply
+ */
void networkReplyHandler(QNetworkReply *reply);
+ /**
+ * @brief Handler for browser URL changes
+ *
+ * Does check the new URL and based on that invokes the login dialog with visible browser view
+ * or parses the session from the new URL.
+ *
+ * @param url New URL
+ */
void urlChanged(const QUrl &url);
/*******************************************************************************
*/
void error(const int context, const int error);
+ /**
+ * @brief Emitted when logged in successfully
+ *
+ * @param session Session data
+ */
void loggedIn(const QString session);
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- QWebView *m_browser;
- MainWindow *m_mainWindow;
+ QWebView *m_browser; ///< Login browser
+ MainWindow *m_mainWindow; ///< MainWindow
};
#endif // FACEBOOKAUTHENTICATION_H