From: Kaj Wallin Date: Wed, 21 Apr 2010 08:23:31 +0000 (+0300) Subject: Fixed bug that causes application to ask for new login even if X-Git-Tag: v0.3~35 X-Git-Url: http://git.maemo.org/git/?p=situare;a=commitdiff_plain;h=c724a203b39b9e43b83233de2c6a2eee801f3fe9 Fixed bug that causes application to ask for new login even if credentials already exist Also fixed partially bug #5577 by commenting data members at MainWindow class, and renaming abbreviated member. --- diff --git a/src/facebookservice/facebookauthentication.cpp b/src/facebookservice/facebookauthentication.cpp index ce8cf47..e00d23f 100644 --- a/src/facebookservice/facebookauthentication.cpp +++ b/src/facebookservice/facebookauthentication.cpp @@ -42,11 +42,6 @@ FacebookAuthentication::FacebookAuthentication(QWidget *parent) this, SLOT(updateCredentials(const QUrl &))); readCredentials(m_loginCredentials); - - if (!verifyCredentials(m_loginCredentials)) - start(); - else - emit credentialsReady(); } FacebookAuthentication::~FacebookAuthentication() @@ -59,10 +54,14 @@ FacebookAuthentication::~FacebookAuthentication() void FacebookAuthentication::start() { qDebug() << __PRETTY_FUNCTION__; - - m_webView->setZoomFactor(FACEBOOK_LOGINPAGE_FONT_SIZE); - m_webView->load(m_facebookLoginPage); - setCentralWidget(m_webView); + if (!verifyCredentials(m_loginCredentials)){ + m_webView->setZoomFactor(FACEBOOK_LOGINPAGE_FONT_SIZE); + m_webView->load(m_facebookLoginPage); + setCentralWidget(m_webView); + this->show(); + } + else + emit credentialsReady(); } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 45c74c4..fe270bc 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -38,15 +38,13 @@ MainWindow::MainWindow(QWidget *parent) setWindowTitle(tr("List view")); this->hide(); - FBAuth = new FacebookAuthentication(this); - FBAuth->show(); - FBAuth->start(); + m_facebookAuthenticator = new FacebookAuthentication(this); + connect(m_facebookAuthenticator, SIGNAL(credentialsReady()), this, SLOT(loginOK())); + connect(m_facebookAuthenticator, SIGNAL(userExit()), this, SLOT(loginScreenClosed())); + m_facebookAuthenticator->start(); m_networkManager = new QNetworkAccessManager; m_situareService = new SituareService(this,m_networkManager); - - connect(FBAuth, SIGNAL(credentialsReady()), this, SLOT(loginOK())); - connect(FBAuth, SIGNAL(userExit()), this, SLOT(loginScreenClosed())); } MainWindow::~MainWindow() @@ -129,5 +127,5 @@ void MainWindow::loginOK() { qDebug() << __PRETTY_FUNCTION__ << m_loggedIn; m_loggedIn = true; - FBAuth->close(); + m_facebookAuthenticator->close(); } diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index e38805b..dad12bf 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -86,9 +86,9 @@ private: void switchView(int); private: - FacebookAuthentication *FBAuth; - QNetworkAccessManager *m_networkManager; - SituareService *m_situareService; + FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator + QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService + SituareService *m_situareService; ///< Instance of the situare server communication service bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets QAction *m_toListViewAct; ///< Action to trigger switch to list view