this, SLOT(updateCredentials(const QUrl &)));
readCredentials(m_loginCredentials);
-
- if (!verifyCredentials(m_loginCredentials))
- start();
- else
- emit credentialsReady();
}
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();
}
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()
{
qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
m_loggedIn = true;
- FBAuth->close();
+ m_facebookAuthenticator->close();
}
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