Removed FacebookLoginBrowser class, replaced with QWebView.
[situare] / src / facebookservice / facebookauthentication.h
index 0d3cbfa..5d12838 100644 (file)
 
 #include <QUrl>
 
-class FacebookLoginBrowser;
+class QNetworkReply;
+class QWebView;
+
+class MainWindow;
 
 /**
-* @brief FacebookAuthentication class takes care of parsing and handling of  credentials for
-*        Facebook. Other components of Situare application needs credentials to communicate with
-*        facebook.
+* @brief FacebookAuthentication class takes care of Facebook login process. It creates
+         QWebView instance and tries to login with cookies using hidden browser.
+         If failed, then visible login browser dialog is invoked. Class also does parse the
+         accuired credentials.
 *
 * @author Ville Tiensuu
+* @author Sami Rämö - sami.ramo (at) ixonos.com
 */
 class FacebookAuthentication : public QObject
 {
@@ -45,9 +50,10 @@ public:
     *
     * -Checks if there is valid credentials stored on the file. If there is emits signal.
     *
+    * @param mainWindow MainWindow instance
     * @param parent instance of parent
     */
-    FacebookAuthentication(QObject *parent = 0);
+    FacebookAuthentication(MainWindow *mainWindow, QObject *parent = 0);
 
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
@@ -64,8 +70,6 @@ public slots:
     */
     void clearAccountInformation(bool keepUsername = false);
 
-    void setBrowser(FacebookLoginBrowser *browser);
-
 private:
     QString parseSession(const QUrl &url);
 
@@ -74,14 +78,14 @@ private slots:
 
     void loadFinished(bool ok);
 
+    void networkReplyHandler(QNetworkReply *reply);
+
     void urlChanged(const QUrl &url);
 
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
 signals:
-    void buildLoginBrowser();
-
     /**
     * @brief Signals error
     *
@@ -96,7 +100,8 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    FacebookLoginBrowser *m_browser;
+    QWebView *m_browser;
+    MainWindow *m_mainWindow;
 };
 
 #endif // FACEBOOKAUTHENTICATION_H