Removed FacebookLoginBrowser class, replaced with QWebView.
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 9 Nov 2010 10:13:32 +0000 (12:13 +0200)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 9 Nov 2010 10:13:32 +0000 (12:13 +0200)
src/facebookservice/facebookauthentication.cpp
src/facebookservice/facebookauthentication.h
src/src.pro
src/ui/facebookloginbrowser.cpp [deleted file]
src/ui/facebookloginbrowser.h [deleted file]
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 93e3e65..ca8ac04 100644 (file)
@@ -29,6 +29,7 @@
 #include <QSettings>
 #include <QStringList>
 #include <QVariantMap>
+#include <QWebView>
 
 #ifdef Q_WS_MAEMO_5
 #include <QMaemo5InformationBox>
@@ -38,7 +39,6 @@
 #include "error.h"
 #include "network/networkcookiejar.h"
 #include "situareservice/situarecommon.h"
-#include "ui/facebookloginbrowser.h"
 #include "ui/mainwindow.h"
 
 #include "facebookauthentication.h"
@@ -90,22 +90,27 @@ void FacebookAuthentication::login()
 {
     qWarning() << __PRETTY_FUNCTION__;
 
-    if (!m_browser)
-        m_browser = new FacebookLoginBrowser(m_mainWindow);
+    if (!m_browser) {
+        m_browser = new QWebView(m_mainWindow);
 
-    if (m_browser) {
-        connect(m_browser, SIGNAL(loadFinished(bool)),
-                this, SLOT(loadFinished(bool)));
+        if (m_browser) {
+            m_browser->page()->networkAccessManager()->setCookieJar(new NetworkCookieJar());
 
-        connect(m_browser, SIGNAL(urlChanged(QUrl)),
-                this, SLOT(urlChanged(QUrl)));
+            connect(m_browser, SIGNAL(loadFinished(bool)),
+                    this, SLOT(loadFinished(bool)));
 
-        connect(m_browser, SIGNAL(destroyed(QObject*)),
-                this, SLOT(browserDestroyed()));
+            connect(m_browser, SIGNAL(urlChanged(QUrl)),
+                    this, SLOT(urlChanged(QUrl)));
 
-        connect(m_browser->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),
-                this, SLOT(networkReplyHandler(QNetworkReply*)));
+            connect(m_browser, SIGNAL(destroyed(QObject*)),
+                    this, SLOT(browserDestroyed()));
 
+            connect(m_browser->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),
+                    this, SLOT(networkReplyHandler(QNetworkReply*)));
+        }
+    }
+
+    if (m_browser) {
         QString url = FB_LOGIN_URL + "?";
         url.append("api_key=" + API_KEY +"&");
         url.append("display=touch&");
index 5987fee..5d12838 100644 (file)
 #include <QUrl>
 
 class QNetworkReply;
+class QWebView;
 
-class FacebookLoginBrowser;
 class MainWindow;
 
 /**
 * @brief FacebookAuthentication class takes care of Facebook login process. It creates
-         FacebookLoginBrowser instance and tries to login with cookies using hidden browser.
+         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.
 *
@@ -100,7 +100,7 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    FacebookLoginBrowser *m_browser;
+    QWebView *m_browser;
     MainWindow *m_mainWindow;
 };
 
index 0b8a066..4402841 100644 (file)
@@ -84,8 +84,7 @@ SOURCES += main.cpp \
     ui/zoombutton.cpp \
     ui/zoombuttonpanel.cpp \
     user/user.cpp \
-    ui/listitemcontextbuttonbar.cpp \
-    ui/facebookloginbrowser.cpp
+    ui/listitemcontextbuttonbar.cpp
 HEADERS += application.h \
     common.h \
     coordinates/geocoordinate.h \
@@ -171,8 +170,7 @@ HEADERS += application.h \
     ui/zoombutton.h \
     ui/zoombuttonpanel.h \
     user/user.h \
-    ui/listitemcontextbuttonbar.h \
-    ui/facebookloginbrowser.h
+    ui/listitemcontextbuttonbar.h
 QT += network \
     webkit
 DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/src/ui/facebookloginbrowser.cpp b/src/ui/facebookloginbrowser.cpp
deleted file mode 100644 (file)
index 487da24..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Sami Rämö - sami.ramo@ixonos.com
-
-    Situare is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License
-    version 2 as published by the Free Software Foundation.
-
-    Situare is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with Situare; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-    USA.
-*/
-
-#include <QDebug>
-
-#include "network/networkcookiejar.h"
-
-#include "facebookloginbrowser.h"
-
-FacebookLoginBrowser::FacebookLoginBrowser(QWidget *parent) :
-    QWebView(parent)
-{
-    qWarning() << __PRETTY_FUNCTION__;
-
-    page()->networkAccessManager()->setCookieJar(new NetworkCookieJar());
-}
diff --git a/src/ui/facebookloginbrowser.h b/src/ui/facebookloginbrowser.h
deleted file mode 100644 (file)
index 3b5ca45..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Sami Rämö - sami.ramo@ixonos.com
-
-    Situare is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License
-    version 2 as published by the Free Software Foundation.
-
-    Situare is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with Situare; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-    USA.
-*/
-
-
-#ifndef FACEBOOKLOGINBROWSER_H
-#define FACEBOOKLOGINBROWSER_H
-
-#include <QWebView>
-
-class FacebookLoginBrowser : public QWebView
-{
-    Q_OBJECT
-public:
-    explicit FacebookLoginBrowser(QWidget *parent = 0);
-
-};
-
-#endif // FACEBOOKLOGINBROWSER_H
index 7defcf4..9cdeb7e 100644 (file)
@@ -281,7 +281,7 @@ void MainWindow::buildLocationSearchPanel()
             this, SIGNAL(searchHistoryItemClicked(QString)));
 }
 
-void MainWindow::buildLoginDialog(FacebookLoginBrowser *browser)
+void MainWindow::buildLoginDialog(QWebView *browser)
 {
     qWarning() << __PRETTY_FUNCTION__;
 
index 14f11fa..14f5402 100644 (file)
@@ -41,7 +41,6 @@ class QNetworkReply;
 class QToolButton;
 class QWebView;
 
-class FacebookLoginBrowser;
 class FriendListPanel;
 class FullScreenButton;
 class GeoCoordinate;
@@ -94,7 +93,7 @@ private:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
-    void buildLoginDialog(FacebookLoginBrowser *browser);
+    void buildLoginDialog(QWebView *browser);
 
     /**
      * @brief