From 87cb2a71148b8fb543796d18d9ce108eefab76b2 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 7 Aug 2013 14:57:22 +0200 Subject: [PATCH] Set busy cursor when doing page loading in browser. --- src/creds/shibboleth/shibbolethwebview.cpp | 24 ++++++++++++++++++++-- src/creds/shibboleth/shibbolethwebview.h | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/creds/shibboleth/shibbolethwebview.cpp b/src/creds/shibboleth/shibbolethwebview.cpp index 557a4b986b..d1eeb0e6aa 100644 --- a/src/creds/shibboleth/shibbolethwebview.cpp +++ b/src/creds/shibboleth/shibbolethwebview.cpp @@ -11,6 +11,7 @@ * for more details. */ +#include #include #include #include @@ -29,8 +30,12 @@ void ShibbolethWebView::setup(const QUrl& url, ShibbolethCookieJar* jar) QWebPage* page = new QWebPage(this); jar->setParent(this); - connect (jar, SIGNAL (newCookiesForUrl (QList, QUrl)), - this, SLOT (onNewCookiesForUrl (QList, QUrl))); + connect(jar, SIGNAL (newCookiesForUrl (QList, QUrl)), + this, SLOT (onNewCookiesForUrl (QList, QUrl))); + connect(page, SIGNAL(loadStarted()), + this, SLOT(slotLoadStarted())); + connect(page, SIGNAL(loadFinished(bool)), + this, SLOT(slotLoadFinished())); nm->setCookieJar(jar); page->setNetworkAccessManager(nm); @@ -44,6 +49,11 @@ ShibbolethWebView::ShibbolethWebView(const QUrl& url, QWidget* parent) setup(url, new ShibbolethCookieJar(this)); } +ShibbolethWebView::~ShibbolethWebView() +{ + slotLoadFinished(); +} + ShibbolethWebView::ShibbolethWebView(const QUrl& url, ShibbolethCookieJar* jar, QWidget* parent) : QWebView(parent) { @@ -81,4 +91,14 @@ void ShibbolethWebView::hideEvent(QHideEvent* event) QWebView::hideEvent(event); } +void ShibbolethWebView::slotLoadStarted() +{ + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); +} + +void ShibbolethWebView::slotLoadFinished() +{ + QApplication::restoreOverrideCursor(); +} + } // ns Mirall diff --git a/src/creds/shibboleth/shibbolethwebview.h b/src/creds/shibboleth/shibbolethwebview.h index 0688d0598b..f0e43816d1 100644 --- a/src/creds/shibboleth/shibbolethwebview.h +++ b/src/creds/shibboleth/shibbolethwebview.h @@ -32,6 +32,7 @@ class ShibbolethWebView : public QWebView public: ShibbolethWebView(const QUrl& url, QWidget* parent = 0); ShibbolethWebView(const QUrl& url, ShibbolethCookieJar* jar, QWidget* parent = 0); + ~ShibbolethWebView(); protected: void hideEvent(QHideEvent* event); @@ -43,6 +44,8 @@ Q_SIGNALS: private Q_SLOTS: void onNewCookiesForUrl(const QList& cookieList, const QUrl& url); + void slotLoadStarted(); + void slotLoadFinished(); private: void setup(const QUrl& url, ShibbolethCookieJar* jar);