#include "application.h"
#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"
m_mce = new MCE(this);
connect(m_mce, SIGNAL(displayOff(bool)), this, SLOT(setPowerSaving(bool)));
+
+ m_contactManager = new ContactManager(this);
+ m_contactManager->requestContactGuids();
+
+ ///< @todo just for testing the login browser
+ login();
}
SituareEngine::~SituareEngine()
m_geocodingService->requestLocation(location);
}
+void SituareEngine::login()
+{
+ qWarning() << __PRETTY_FUNCTION__;
+
+ FacebookLoginBrowser *browser = m_ui->buildFacebookLoginBrowser();
+
+ connect(browser, SIGNAL(loadFinished(bool)),
+ m_facebookAuthenticator, SLOT(loadFinished(bool)));
+
+ connect(browser, SIGNAL(urlChanged(QUrl)),
+ m_facebookAuthenticator, SLOT(urlChanged(QUrl)));
+
+ 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::loggedIn()
+{
+ qWarning() << __PRETTY_FUNCTION__;
+
+ m_ui->destroyFacebookLoginBrowser();
+}
+
void SituareEngine::loginActionPressed()
{
qDebug() << __PRETTY_FUNCTION__;
m_mapEngine->setAutoCentering(!enabled);
}
+void SituareEngine::showContactDialog(const QString &facebookId)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QString guid = m_contactManager->contactGuid(facebookId);
+
+ if (!guid.isEmpty())
+ m_ui->showContactDialog(guid);
+ else
+ m_ui->buildInformationBox(tr("Unable to find contact.\nAdd Facebook IM "
+ "account from Conversations to use this feature."), true);
+}
+
void SituareEngine::signalsFromFacebookAuthenticator()
{
qDebug() << __PRETTY_FUNCTION__;
connect(m_facebookAuthenticator, SIGNAL(loginUsingCookies()),
m_ui, SLOT(loginUsingCookies()));
+
+ connect(m_facebookAuthenticator, SIGNAL(loggedIn(QString)),
+ this, SLOT(loggedIn()));
}
void SituareEngine::signalsFromGeocodingService()
m_mapEngine,
SLOT(showMapArea(const GeoCoordinate&, const GeoCoordinate&)));
+ connect(m_ui, SIGNAL(searchHistoryItemClicked(QString)),
+ this, SLOT(locationSearch(QString)));
+
// signals from routing tab
connect(m_ui, SIGNAL(clearRoute()),
m_mapEngine, SLOT(clearRoute()));
// signal from search location dialog
connect(m_ui, SIGNAL(searchForLocation(QString)),
this, SLOT(locationSearch(QString)));
+
+ // signal from friend list panel
+ connect(m_ui, SIGNAL(requestContactDialog(const QString &)),
+ this, SLOT(showContactDialog(const QString &)));
}
void SituareEngine::signalsFromMapEngine()
qDebug() << __PRETTY_FUNCTION__;
m_ui->toggleProgressIndicator(false);
- m_ui->showPanels();
emit userLocationReady(user);
emit friendsLocationsReady(friendsList);