From: Sami Rämö Date: Tue, 9 Nov 2010 10:36:41 +0000 (+0200) Subject: Added progress indicator X-Git-Url: https://vcs.maemo.org/git/?p=situare;a=commitdiff_plain;h=2725fabd468bd70b4f978b957eca14a817d331d3 Added progress indicator --- 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: