From 2725fabd468bd70b4f978b957eca14a817d331d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sami=20R=C3=A4m=C3=B6?= Date: Tue, 9 Nov 2010 12:36:41 +0200 Subject: [PATCH] Added progress indicator --- src/facebookservice/facebookauthentication.cpp | 15 +++++++++++++-- src/facebookservice/facebookauthentication.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/facebookservice/facebookauthentication.cpp b/src/facebookservice/facebookauthentication.cpp index ca8ac04..40f4309 100644 --- a/src/facebookservice/facebookauthentication.cpp +++ b/src/facebookservice/facebookauthentication.cpp @@ -58,6 +58,7 @@ void FacebookAuthentication::browserDestroyed() { qWarning() << __PRETTY_FUNCTION__; + m_mainWindow->toggleProgressIndicator(false); m_browser = 0; } @@ -79,6 +80,14 @@ void FacebookAuthentication::clearAccountInformation(bool keepUsername) NetworkCookieJar::clearCookiesSetting(); } +void FacebookAuthentication::destroyLogin() +{ + qWarning() << __PRETTY_FUNCTION__; + + m_mainWindow->destroyLoginDialog(); + m_browser->deleteLater(); +} + void FacebookAuthentication::loadFinished(bool ok) { qWarning() << __PRETTY_FUNCTION__ << ok; @@ -122,6 +131,8 @@ void FacebookAuthentication::login() url.append("req_perms=publish_stream"); m_browser->load(QUrl(url)); + + m_mainWindow->toggleProgressIndicator(true); } } @@ -131,6 +142,7 @@ void FacebookAuthentication::networkReplyHandler(QNetworkReply *reply) if (reply->error() != QNetworkReply::NoError) { qCritical() << __PRETTY_FUNCTION__ << "error:" << reply->error() << reply->errorString(); + destroyLogin(); /// @todo Emit error signal } } @@ -176,8 +188,7 @@ void FacebookAuthentication::urlChanged(const QUrl &url) const QString session = parseSession(url); qWarning() << __PRETTY_FUNCTION__ << "login finished, parsed session:" << session; if (!session.isEmpty()) { - m_mainWindow->destroyLoginDialog(); - m_browser->deleteLater(); + destroyLogin(); emit loggedIn(session); } } diff --git a/src/facebookservice/facebookauthentication.h b/src/facebookservice/facebookauthentication.h index 5d12838..3699687 100644 --- a/src/facebookservice/facebookauthentication.h +++ b/src/facebookservice/facebookauthentication.h @@ -71,6 +71,8 @@ public slots: void clearAccountInformation(bool keepUsername = false); private: + void destroyLogin(); + QString parseSession(const QUrl &url); private slots: -- 1.7.9.5