Fixed bug that causes application to ask for new login even if
authorKaj Wallin <kaj.wallin@ixonos.com>
Wed, 21 Apr 2010 08:23:31 +0000 (11:23 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Wed, 21 Apr 2010 08:23:31 +0000 (11:23 +0300)
credentials already exist

Also fixed partially bug #5577 by commenting data members at
MainWindow class, and renaming abbreviated member.

src/facebookservice/facebookauthentication.cpp
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index ce8cf47..e00d23f 100644 (file)
@@ -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();
 }
 
 
index 45c74c4..fe270bc 100644 (file)
@@ -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();
 }
index e38805b..dad12bf 100644 (file)
@@ -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