Changes to logout prosess and login state storing, logout bug fix
[situare] / src / facebookservice / facebookauthentication.h
index b1c1d11..28725bd 100644 (file)
@@ -27,6 +27,7 @@
 #include <QUrl>
 
 class QNetworkReply;
+class QSslError;
 class QWebView;
 
 class MainWindow;
@@ -58,7 +59,21 @@ public:
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
-public:
+public slots:
+    /**
+    * @brief Clears account information from settings
+    *
+    * @param keepUsername keep = true, false otherwise
+    */
+    void clearAccountInformation(bool keepUsername = false);
+
+    /**
+      * @brief Is the user currently logged in
+      *
+      * @returns True if the user is logged in, otherwise false
+      */
+    bool isLoggedIn();
+
     /**
       * @brief Initiate login process
       *
@@ -66,14 +81,10 @@ public:
       */
     void login();
 
-public slots:
-
     /**
-    * @brief Clears account information from settings
-    *
-    * @param keepUsername keep = true, false otherwise
-    */
-    void clearAccountInformation(bool keepUsername = false);
+      * @brief Log out
+      */
+    void logOut();
 
 private:
     /**
@@ -105,6 +116,11 @@ private slots:
     void networkReplyHandler(QNetworkReply *reply);
 
     /**
+      * @brief Handler for SSL errors, ignores the error
+      */
+    void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
+
+    /**
       * @brief Handler for browser URL changes
       *
       * Does check the new URL and based on that invokes the login dialog with visible browser view
@@ -129,14 +145,24 @@ signals:
     /**
       * @brief Emitted when logged in successfully
       *
+      * All login related actions should be connected to this signal.
+      *
       * @param session Session data
       */
     void loggedIn(const QString session);
 
+    /**
+      * @brief Emitted when logged out
+      *
+      * All logout related actions should be connected to this signal.
+      */
+    void loggedOut();
+
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
 private:
+    bool m_loggedIn;                ///< Is the user currently logged in
     QWebView *m_browser;            ///< Login browser
     MainWindow *m_mainWindow;       ///< MainWindow
 };