From ff739572a13949afb4ef82e6789e3c3810ee2d5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sami=20R=C3=A4m=C3=B6?= Date: Tue, 9 Nov 2010 08:47:26 +0200 Subject: [PATCH] Replaced some hard coded strings with constants, removed facebookcommon.h --- src/facebookservice/facebookauthentication.cpp | 17 ++++------ src/facebookservice/facebookcommon.h | 41 ------------------------ src/src.pro | 1 - 3 files changed, 7 insertions(+), 52 deletions(-) delete mode 100644 src/facebookservice/facebookcommon.h diff --git a/src/facebookservice/facebookauthentication.cpp b/src/facebookservice/facebookauthentication.cpp index 3698666..7760312 100644 --- a/src/facebookservice/facebookauthentication.cpp +++ b/src/facebookservice/facebookauthentication.cpp @@ -36,19 +36,19 @@ #include "common.h" #include "error.h" -#include "facebookcommon.h" +#include "situareservice/situarecommon.h" #include "ui/facebookloginbrowser.h" #include "facebookauthentication.h" -const QString REDIRECT_URI = "http://www.facebook.com/connect/login_success.html"; +const QString FB_LOGIN_SUCCESS_URL = "http://www.facebook.com/connect/login_success.html"; +const QString FB_LOGIN_URL = "https://www.facebook.com/login.php"; FacebookAuthentication::FacebookAuthentication(QObject *parent) : QObject(parent), m_browser(0) { qDebug() << __PRETTY_FUNCTION__; - } void FacebookAuthentication::browserDestroyed() @@ -138,14 +138,11 @@ void FacebookAuthentication::setBrowser(FacebookLoginBrowser *browser) connect(m_browser->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(networkReplyHandler(QNetworkReply*))); - // 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")); - - QString url = "https://www.facebook.com/login.php?"; - url.append("api_key=cf77865a5070f2c2ba3b52cbf3371579&"); ///< @todo hard coded test server api key - url.append("cancel_url=http://www.facebook.com/connect/login_failure.html&"); + QString url = FB_LOGIN_URL + "?"; + url.append("api_key=" + API_KEY +"&"); url.append("display=touch&"); url.append("fbconnect=1&"); - url.append("next=http://www.facebook.com/connect/login_success.html&"); + url.append("next=" + FB_LOGIN_SUCCESS_URL + "&"); url.append("return_session=1&"); url.append("session_version=3&"); url.append("v=1.0&"); @@ -173,7 +170,7 @@ void FacebookAuthentication::urlChanged(const QUrl &url) // url parameter doesn't contain session data, so login with cookies failed qWarning() << __PRETTY_FUNCTION__ << "working credentials required"; m_browser->show(); - } else if (url.toString().startsWith(REDIRECT_URI)) { + } else if (url.toString().startsWith(FB_LOGIN_SUCCESS_URL)) { // login succeeded const QString session = parseSession(url); qWarning() << __PRETTY_FUNCTION__ << "login finished, parsed session:" << session; diff --git a/src/facebookservice/facebookcommon.h b/src/facebookservice/facebookcommon.h deleted file mode 100644 index 4f5e927..0000000 --- a/src/facebookservice/facebookcommon.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Situare - A location system for Facebook - Copyright (C) 2010 Ixonos Plc. Authors: - - Ville Tiensuu - ville.tiensuu@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 FACEBOOKCOMMON_H -#define FACEBOOKCOMMON_H - -#include - -const QString ERROR = "Error"; - -// Facebook callback url indentifiers and setting items -///< @todo remove -const QString SESSION_KEY = "session_key"; -const QString USER_ID = "uid"; -const QString EXPIRES = "expires"; -const QString SESSION_SECRET = "secret"; -const QString SIGNATURE = "sig"; - -const QString LOGIN_SUCCESS_REPLY = "http://www.facebook.com/connect/login_success.html"; -const QString LOGIN_FAILURE_REPLY = "https://login.facebook.com/login.php?login_attempt="; -const QString LOGIN_PAGE = "http://www.facebook.com/login.php?api_key="; - -#endif // FACEBOOKCOMMON_H diff --git a/src/src.pro b/src/src.pro index 1fcb5b7..0b8a066 100644 --- a/src/src.pro +++ b/src/src.pro @@ -95,7 +95,6 @@ HEADERS += application.h \ engine/mce.h \ error.h \ facebookservice/facebookauthentication.h \ - facebookservice/facebookcommon.h \ gps/gpscommon.h \ gps/gpsposition.h \ map/baselocationitem.h \ -- 1.7.9.5