Created base for Facebook login browser
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 24 Sep 2010 09:29:20 +0000 (12:29 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 24 Sep 2010 09:29:20 +0000 (12:29 +0300)
 - FacebookLoginBrowser class

 - MainWindow builds login browser and shows it.

src/engine/engine.cpp
src/engine/engine.h
src/facebookservice/facebookauthentication.h
src/facebookservice/facebookcommon.h
src/src.pro
src/ui/facebookloginbrowser.cpp [new file with mode: 0644]
src/ui/facebookloginbrowser.h [new file with mode: 0644]
src/ui/locationsearchpanel.cpp
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index f8fcf91..3034747 100644 (file)
@@ -31,6 +31,7 @@
 #include "common.h"
 #include "contactmanager.h"
 #include "../error.h"
+#include "ui/facebookloginbrowser.h"
 #include "facebookservice/facebookauthentication.h"
 #include "gps/gpsposition.h"
 #include "map/mapengine.h"
@@ -136,6 +137,9 @@ SituareEngine::SituareEngine()
     
     m_contactManager = new ContactManager(this);
     m_contactManager->requestContactGuids();
+
+    ///< @todo just for testing the login browser
+    login();
 }
 
 SituareEngine::~SituareEngine()
@@ -361,6 +365,14 @@ void SituareEngine::locationSearch(QString location)
         m_geocodingService->requestLocation(location);
 }
 
+void SituareEngine::login()
+{
+    qWarning() << __PRETTY_FUNCTION__;
+
+    FacebookLoginBrowser *browser = m_ui->buildFacebookLoginBrowser();
+    browser->load(QUrl("https://graph.facebook.com/oauth/authorize?client_id=4197c64da2fb6b927236feaea32d7d81&redirect_uri=http://www.facebook.com/connect/login_success.html&display=touch&type=user_agent"));
+}
+
 void SituareEngine::loginActionPressed()
 {
     qDebug() << __PRETTY_FUNCTION__;
index aacd9e5..c392124 100644 (file)
@@ -95,6 +95,8 @@ public slots:
     */
     void locationSearch(QString location);
 
+    void login();
+
     /**
     * @brief Slot to intercept signal when Login/Logout action is pressed
     *
index 11dc05a..f7f8082 100644 (file)
@@ -51,7 +51,7 @@ public:
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
-
+public:
     /**
     * @brief Getter for m_loginCredentials
     *
index e3eb52f..c2af8a2 100644 (file)
@@ -26,9 +26,6 @@
 
 const QString ERROR = "Error";
 
-// Facebook webView font size
-const double FACEBOOK_LOGINPAGE_FONT_SIZE = 1.2;
-
 // Facebook callback url indentifiers and setting items
 const QString SESSION_KEY = "session_key";
 const QString USER_ID = "uid";
index 8cc801c..1571280 100644 (file)
@@ -86,7 +86,8 @@ SOURCES += main.cpp \
     ui/zoombutton.cpp \
     ui/zoombuttonpanel.cpp \
     user/user.cpp \
-    ui/listitemcontextbuttonbar.cpp
+    ui/listitemcontextbuttonbar.cpp \
+    ui/facebookloginbrowser.cpp
 HEADERS += application.h \
     common.h \
     coordinates/geocoordinate.h \
@@ -174,7 +175,8 @@ HEADERS += application.h \
     ui/zoombutton.h \
     ui/zoombuttonpanel.h \
     user/user.h \
-    ui/listitemcontextbuttonbar.h
+    ui/listitemcontextbuttonbar.h \
+    ui/facebookloginbrowser.h
 QT += network \
     webkit
 DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/src/ui/facebookloginbrowser.cpp b/src/ui/facebookloginbrowser.cpp
new file mode 100644 (file)
index 0000000..3c46cb6
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+    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 "facebookloginbrowser.h"
+
+FacebookLoginBrowser::FacebookLoginBrowser(QWidget *parent) :
+    QWebView(parent)
+{
+    qWarning() << __PRETTY_FUNCTION__;
+
+    setWindowFlags(Qt::Dialog);
+    setWindowTitle(tr("Login"));
+}
diff --git a/src/ui/facebookloginbrowser.h b/src/ui/facebookloginbrowser.h
new file mode 100644 (file)
index 0000000..659f23c
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    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);
+
+signals:
+
+public slots:
+
+};
+
+#endif // FACEBOOKLOGINBROWSER_H
index beb9b0c..99ba250 100644 (file)
@@ -248,8 +248,7 @@ void LocationSearchPanel::showEmptyPanel(bool show)
         m_noSearchLabel->show();
         m_searchHistoryListView->hide();
         m_locationListView->hide();
-    }
-    else {
+    } else {
         m_noSearchLabel->hide();
         m_resultsLabel->show();
     }
index 244fc01..d0d7675 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "common.h"
 #include "error.h"
+#include "facebookloginbrowser.h"
 #include "facebookservice/facebookauthentication.h"
 #include "friendlistpanel.h"
 #include "fullscreenbutton.h"
@@ -77,6 +78,7 @@ MainWindow::MainWindow(QWidget *parent)
       m_email(), ///< @todo WTF?!?!?!?
       m_password(),
       m_webView(0),
+      m_facebookLoginBrowser(0),
       m_fullScreenButton(0),
       m_indicatorButtonPanel(0),
       m_mapScale(0),
@@ -167,6 +169,18 @@ void MainWindow::buildCrosshair()
             this, SLOT(mapCenterHorizontalShiftingChanged(int)));
 }
 
+FacebookLoginBrowser* MainWindow::buildFacebookLoginBrowser()
+{
+    qWarning() << __PRETTY_FUNCTION__;
+
+    if (!m_facebookLoginBrowser)
+        m_facebookLoginBrowser = new FacebookLoginBrowser(this);
+
+    m_facebookLoginBrowser->show();
+
+    return m_facebookLoginBrowser;
+}
+
 void MainWindow::buildFriendListPanel()
 {
     qDebug() << __PRETTY_FUNCTION__;
index b9e5604..2d2293c 100644 (file)
@@ -40,6 +40,7 @@ class QToolButton;
 class QWebView;
 
 class FacebookAuthentication;
+class FacebookLoginBrowser;
 class FriendListPanel;
 class FullScreenButton;
 class GeoCoordinate;
@@ -92,6 +93,8 @@ private:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
+    FacebookLoginBrowser* buildFacebookLoginBrowser();
+
     /**
      * @brief Clears cookie jar
      *
@@ -715,6 +718,7 @@ private:
 
     QWebView *m_webView;                    ///< Shows facebook login page
 
+    FacebookLoginBrowser *m_facebookLoginBrowser;
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
     FullScreenButton *m_fullScreenButton;   ///< Instance of the fullscreen toggle button
     IndicatorButtonPanel *m_indicatorButtonPanel;   ///< Instance of direction indicator button