diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.cpp | 23 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer_qwv.h | 3 | ||||
-rw-r--r-- | tools/shared/symbian/epocroot.cpp | 4 |
3 files changed, 24 insertions, 6 deletions
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index 244d091..dcbbf2c 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -172,6 +172,7 @@ private: bool closeNewTabIfNeeded; friend class HelpViewer; + QUrl m_loadingUrl; Qt::MouseButtons m_pressedButtons; Qt::KeyboardModifiers m_keyboardModifiers; }; @@ -232,6 +233,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; } @@ -268,6 +274,7 @@ HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom) 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(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); @@ -333,10 +340,19 @@ bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e) return false; } +QUrl HelpViewer::source() const +{ + HelpPage *currentPage = static_cast<HelpPage*> (page()); + if (currentPage && !hasLoadFinished()) { + // see HelpPage::acceptNavigationRequest(...) + return currentPage->m_loadingUrl; + } + return url(); +} + void HelpViewer::setSource(const QUrl &url) { TRACE_OBJ - loadFinished = false; load(url.toString() == QLatin1String("help") ? LocalHelpFile : url); } @@ -396,6 +412,11 @@ void HelpViewer::mousePressEvent(QMouseEvent *event) QWebView::mousePressEvent(event); } +void HelpViewer::setLoadStarted() +{ + loadFinished = false; +} + void HelpViewer::setLoadFinished(bool ok) { TRACE_OBJ diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index 2577828..1897e3e 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -71,8 +71,8 @@ public: bool handleForwardBackwardMouseButtons(QMouseEvent *e); + QUrl source() const; void setSource(const QUrl &url); - inline QUrl source() const { return url(); } inline QString documentTitle() const { return title(); } @@ -109,6 +109,7 @@ protected: private Q_SLOTS: void actionChanged(); + void setLoadStarted(); void setLoadFinished(bool ok); private: diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp index 064e056..ae1dcb1 100644 --- a/tools/shared/symbian/epocroot.cpp +++ b/tools/shared/symbian/epocroot.cpp @@ -105,10 +105,6 @@ static void fixEpocRoot(QString &path) { path.replace("\\", "/"); - if (path.size() > 1 && path[1] == QChar(':')) { - path = path.mid(2); - } - if (!path.size() || path[path.size()-1] != QChar('/')) { path += QChar('/'); } |