diff options
author | con <qtc-committer@nokia.com> | 2011-01-14 11:19:57 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2011-01-14 11:19:57 +0100 |
commit | 7915ce6bd38e93f64bb150aab4158160174407f6 (patch) | |
tree | 51aada13b98644d16c498e8dbb2d66196994e22a /src | |
parent | ebb9e252779aff1ff874565c2b056f1c8319c2c8 (diff) | |
download | qt-creator-7915ce6bd38e93f64bb150aab4158160174407f6.tar.gz |
Show wrap indicator also for searches in help views.
Task-number: QTCREATORBUG-2753
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/help/centralwidget.cpp | 4 | ||||
-rw-r--r-- | src/plugins/help/centralwidget.h | 2 | ||||
-rw-r--r-- | src/plugins/help/helpfindsupport.cpp | 22 | ||||
-rw-r--r-- | src/plugins/help/helpviewer.h | 2 | ||||
-rw-r--r-- | src/plugins/help/helpviewer_qtb.cpp | 6 | ||||
-rw-r--r-- | src/plugins/help/helpviewer_qwv.cpp | 12 |
6 files changed, 36 insertions, 12 deletions
diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index 40b767c83b..1366d6a099 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 6b088fa699..0024dba3d7 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 a3dc655d07..13dadb6eda 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 619f243061..05cf268703 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 d576a54364..aa436a390e 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 22148b1769..425cb6ac47 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 |