diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-16 12:56:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-16 12:56:36 (GMT) |
commit | d7c1b7cddbfb7ba57e33c4286bba5c75ddcaedad (patch) | |
tree | 301695161677f75c41bbc92ae721fcbcf77d10b2 | |
parent | 3a54e5ead647a318641d9a2bcf75eda4b8859d1b (diff) | |
parent | a4376f3760fae97b3ae45c9ae7b62ed505bfa05d (diff) | |
download | Qt-d7c1b7cddbfb7ba57e33c4286bba5c75ddcaedad.zip Qt-d7c1b7cddbfb7ba57e33c4286bba5c75ddcaedad.tar.gz Qt-d7c1b7cddbfb7ba57e33c4286bba5c75ddcaedad.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Fix some kind of race condition while using remote commands.
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.cpp | 7 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.h | 2 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_p.h | 4 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qtb.cpp | 1 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.cpp | 12 |
5 files changed, 25 insertions, 1 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index a448dd4..2e4b60c 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -189,9 +189,14 @@ void HelpViewer::home() // -- private slots +void HelpViewer::setLoadStarted() +{ + d->m_loadFinished = false; +} + void HelpViewer::setLoadFinished(bool ok) { - Q_UNUSED(ok) + d->m_loadFinished = ok; emit sourceChanged(source()); } diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 847b0ca..939096d 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -127,6 +127,7 @@ signals: void highlighted(const QString &link); void printRequested(); #else + void loadStarted(); void loadFinished(bool finished); #endif @@ -138,6 +139,7 @@ protected: private slots: void actionChanged(); + void setLoadStarted(); void setLoadFinished(bool ok); private: diff --git a/tools/assistant/tools/assistant/helpviewer_p.h b/tools/assistant/tools/assistant/helpviewer_p.h index 2772905..d65bab5 100644 --- a/tools/assistant/tools/assistant/helpviewer_p.h +++ b/tools/assistant/tools/assistant/helpviewer_p.h @@ -67,6 +67,7 @@ public: HelpViewerPrivate() #endif { + m_loadFinished = false; } #ifdef QT_NO_WEBKIT @@ -112,6 +113,9 @@ public: bool forceFont; QString lastAnchor; #endif // QT_NO_WEBKIT + +public: + bool m_loadFinished; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp index f6b5022..af744b7 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp @@ -160,6 +160,7 @@ void HelpViewer::setSource(const QUrl &url) if (launchWithExternalApp(url)) return; + emit loadStarted(); QString string = url.toString(); const HelpEngineWrapper &engine = HelpEngineWrapper::instance(); const QUrl &resolvedUrl = (string == QLatin1String("help") ? LocalHelpFile : diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index f61d6d4..8993ac9 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -180,6 +180,7 @@ private: bool closeNewTabIfNeeded; friend class HelpViewer; + QUrl m_loadingUrl; Qt::MouseButtons m_pressedButtons; Qt::KeyboardModifiers m_keyboardModifiers; }; @@ -237,6 +238,11 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, return false; } + m_loadingUrl = url; // because of async page loading, we will hit some kind + // of race condition while using a remote command, like a combination of + // SetSource; SyncContent. SetSource would be called and SyncContents shortly + // afterwards, but the page might not have finished loading and the old url + // would be returned. return true; } @@ -270,6 +276,7 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); + connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); connect(this, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged())); connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); @@ -336,6 +343,11 @@ void HelpViewer::setTitle(const QString &title) QUrl HelpViewer::source() const { TRACE_OBJ + HelpPage *currentPage = static_cast<HelpPage*> (page()); + if (currentPage && !d->m_loadFinished) { + // see HelpPage::acceptNavigationRequest(...) + return currentPage->m_loadingUrl; + } return url(); } |