diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index 40b767c83bb..1366d6a0993 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -167,9 +167,9 @@ void CentralWidget::setCurrentPage(HelpViewer *page) } bool CentralWidget::find(const QString &txt, Find::FindFlags flags, - bool incremental) + bool incremental, bool *wrapped) { - return currentHelpViewer()->findText(txt, flags, incremental, false); + return currentHelpViewer()->findText(txt, flags, incremental, false, wrapped); } // -- public slots diff --git a/src/plugins/help/centralwidget.h b/src/plugins/help/centralwidget.h index 6b088fa6992..0024dba3d7c 100644 --- a/src/plugins/help/centralwidget.h +++ b/src/plugins/help/centralwidget.h @@ -73,7 +73,7 @@ public: void setCurrentPage(HelpViewer *page); bool find(const QString &txt, Find::FindFlags findFlags, - bool incremental); + bool incremental, bool *wrapped = 0); public slots: void copy(); diff --git a/src/plugins/help/helpfindsupport.cpp b/src/plugins/help/helpfindsupport.cpp index a3dc655d07d..13dadb6eda3 100644 --- a/src/plugins/help/helpfindsupport.cpp +++ b/src/plugins/help/helpfindsupport.cpp @@ -75,16 +75,24 @@ QString HelpFindSupport::completedFindString() const Find::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt, Find::FindFlags findFlags) { - QTC_ASSERT(m_centralWidget, return NotFound); findFlags &= ~Find::FindBackward; - return m_centralWidget->find(txt, findFlags, true) ? Found : NotFound; + return find(txt, findFlags, true) ? Found : NotFound; } Find::IFindSupport::Result HelpFindSupport::findStep(const QString &txt, Find::FindFlags findFlags) { - QTC_ASSERT(m_centralWidget, return NotFound); - return m_centralWidget->find(txt, findFlags, false) ? Found : NotFound; + return find(txt, findFlags, false) ? Found : NotFound; +} + +bool HelpFindSupport::find(const QString &txt, Find::FindFlags findFlags, bool incremental) +{ + QTC_ASSERT(m_centralWidget, return false); + bool wrapped = false; + bool found = m_centralWidget->find(txt, findFlags, incremental, &wrapped); + if (wrapped) + showWrapIndicator(m_centralWidget); + return found; } // -- HelpViewerFindSupport @@ -125,5 +133,9 @@ bool HelpViewerFindSupport::find(const QString &txt, Find::FindFlags findFlags, bool incremental) { QTC_ASSERT(m_viewer, return false); - return m_viewer->findText(txt, findFlags, incremental, false); + bool wrapped = false; + bool found = m_viewer->findText(txt, findFlags, incremental, false, &wrapped); + if (wrapped) + showWrapIndicator(m_viewer); + return found; } diff --git a/src/plugins/help/helpviewer.h b/src/plugins/help/helpviewer.h index 619f243061c..05cf268703b 100644 --- a/src/plugins/help/helpviewer.h +++ b/src/plugins/help/helpviewer.h @@ -87,7 +87,7 @@ public: bool isBackwardAvailable() const; bool findText(const QString &text, Find::FindFlags flags, - bool incremental, bool fromSearch); + bool incremental, bool fromSearch, bool *wrapped = 0); static const QString NsNokia; static const QString NsTrolltech; diff --git a/src/plugins/help/helpviewer_qtb.cpp b/src/plugins/help/helpviewer_qtb.cpp index d576a54364e..aa436a390ed 100644 --- a/src/plugins/help/helpviewer_qtb.cpp +++ b/src/plugins/help/helpviewer_qtb.cpp @@ -191,8 +191,10 @@ bool HelpViewer::isBackwardAvailable() const } bool HelpViewer::findText(const QString &text, Find::FindFlags flags, - bool incremental, bool fromSearch) + bool incremental, bool fromSearch, bool *wrapped) { + if (wrapped) + *wrapped = false; QTextDocument *doc = document(); QTextCursor cursor = textCursor(); if (!doc || cursor.isNull()) @@ -210,6 +212,8 @@ bool HelpViewer::findText(const QString &text, Find::FindFlags flags, else cursor.movePosition(QTextCursor::End); found = doc->find(text, cursor, f); + if (!found.isNull() && wrapped) + *wrapped = true; } if (fromSearch) { diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp index 22148b17692..425cb6ac47d 100644 --- a/src/plugins/help/helpviewer_qwv.cpp +++ b/src/plugins/help/helpviewer_qwv.cpp @@ -344,17 +344,25 @@ bool HelpViewer::isBackwardAvailable() const } bool HelpViewer::findText(const QString &text, Find::FindFlags flags, - bool incremental, bool fromSearch) + bool incremental, bool fromSearch, bool *wrapped) { Q_UNUSED(incremental); Q_UNUSED(fromSearch); - QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument; + if (wrapped) + *wrapped = false; + QWebPage::FindFlags options; if (flags & Find::FindBackward) options |= QWebPage::FindBackward; if (flags & Find::FindCaseSensitively) options |= QWebPage::FindCaseSensitively; bool found = QWebView::findText(text, options); + if (!found) { + options |= QWebPage::FindWrapsAroundDocument; + found = QWebView::findText(text, options); + if (found && wrapped) + *wrapped = true; + } options = QWebPage::HighlightAllOccurrences; QWebView::findText(QLatin1String(""), options); // clear first QWebView::findText(text, options); // force highlighting of all other matches