diff options
author | kh <qtc-committer@nokia.com> | 2009-04-23 13:11:16 (GMT) |
---|---|---|
committer | kh <qtc-committer@nokia.com> | 2009-04-23 13:11:16 (GMT) |
commit | 11eb20de2bbc2bb0809a0238d3124613ffac6ed4 (patch) | |
tree | 5db124f0202f0ad55d33cdd8d4c237e9837b19ca /tools/assistant | |
parent | a9157844903870521d94a5a576efd143f04f2aa3 (diff) | |
download | Qt-11eb20de2bbc2bb0809a0238d3124613ffac6ed4.zip Qt-11eb20de2bbc2bb0809a0238d3124613ffac6ed4.tar.gz Qt-11eb20de2bbc2bb0809a0238d3124613ffac6ed4.tar.bz2 |
make sure we wait until the page has fully loaded before duplicating
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/assistant/centralwidget.cpp | 4 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.cpp | 12 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.h | 4 |
3 files changed, 19 insertions, 1 deletions
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 1b0e671..633747a 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -277,7 +277,11 @@ CentralWidget *CentralWidget::instance() void CentralWidget::newTab() { HelpViewer* viewer = currentHelpViewer(); +#if !defined(QT_NO_WEBKIT) + if (viewer && viewer->hasLoadFinished()) +#else if (viewer) +#endif setSourceInNewTab(viewer->source()); } diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index f7225fa..5ce6e14 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -269,7 +269,10 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, } HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) - : QWebView(parent), helpEngine(engine), parentWidget(parent) + : QWebView(parent) + , helpEngine(engine) + , parentWidget(parent) + , loadFinished(false) { setAcceptDrops(false); @@ -295,10 +298,12 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); + connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); } void HelpViewer::setSource(const QUrl &url) { + loadFinished = false; if (url.toString() == QLatin1String("help")) { load(QUrl(QLatin1String("qthelp://com.trolltech.com." "assistantinternal_1.0.0/assistant/assistant.html"))); @@ -385,6 +390,11 @@ void HelpViewer::mousePressEvent(QMouseEvent *event) QWebView::mousePressEvent(event); } +void HelpViewer::setLoadFinished(bool ok) +{ + loadFinished = ok; +} + #else // !defined(QT_NO_WEBKIT) HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index eea7340..c66b69c 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -92,6 +92,8 @@ public: { return pageAction(QWebPage::Forward)->isEnabled(); } inline bool isBackwardAvailable() const { return pageAction(QWebPage::Back)->isEnabled(); } + inline bool hasLoadFinished() const + { return loadFinished; } public Q_SLOTS: void home(); @@ -111,10 +113,12 @@ protected: private Q_SLOTS: void actionChanged(); + void setLoadFinished(bool ok); private: QHelpEngine *helpEngine; CentralWidget* parentWidget; + bool loadFinished; }; #else |