From 179f8ad0934bd7b3f35d2d760e9822d15b218cf2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sami=20R=C3=A4m=C3=B6?= Date: Tue, 9 Nov 2010 12:13:32 +0200 Subject: [PATCH] Removed FacebookLoginBrowser class, replaced with QWebView. --- src/facebookservice/facebookauthentication.cpp | 29 +++++++++++-------- src/facebookservice/facebookauthentication.h | 6 ++-- src/src.pro | 6 ++-- src/ui/facebookloginbrowser.cpp | 34 ---------------------- src/ui/facebookloginbrowser.h | 36 ------------------------ src/ui/mainwindow.cpp | 2 +- src/ui/mainwindow.h | 3 +- 7 files changed, 24 insertions(+), 92 deletions(-) delete mode 100644 src/ui/facebookloginbrowser.cpp delete mode 100644 src/ui/facebookloginbrowser.h diff --git a/src/facebookservice/facebookauthentication.cpp b/src/facebookservice/facebookauthentication.cpp index 93e3e65..ca8ac04 100644 --- a/src/facebookservice/facebookauthentication.cpp +++ b/src/facebookservice/facebookauthentication.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef Q_WS_MAEMO_5 #include @@ -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&"); diff --git a/src/facebookservice/facebookauthentication.h b/src/facebookservice/facebookauthentication.h index 5987fee..5d12838 100644 --- a/src/facebookservice/facebookauthentication.h +++ b/src/facebookservice/facebookauthentication.h @@ -27,13 +27,13 @@ #include 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; }; diff --git a/src/src.pro b/src/src.pro index 0b8a066..4402841 100644 --- a/src/src.pro +++ b/src/src.pro @@ -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 index 487da24..0000000 --- a/src/ui/facebookloginbrowser.cpp +++ /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 - -#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 index 3b5ca45..0000000 --- a/src/ui/facebookloginbrowser.h +++ /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 - -class FacebookLoginBrowser : public QWebView -{ - Q_OBJECT -public: - explicit FacebookLoginBrowser(QWidget *parent = 0); - -}; - -#endif // FACEBOOKLOGINBROWSER_H diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 7defcf4..9cdeb7e 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -281,7 +281,7 @@ void MainWindow::buildLocationSearchPanel() this, SIGNAL(searchHistoryItemClicked(QString))); } -void MainWindow::buildLoginDialog(FacebookLoginBrowser *browser) +void MainWindow::buildLoginDialog(QWebView *browser) { qWarning() << __PRETTY_FUNCTION__; diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index 14f11fa..14f5402 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -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 -- 1.7.9.5