exporting patch:
# HG changeset patch
# User Daniel J Sebald <daniel.sebald@ieee.org>
# Date 1522804662 18000
#      Tue Apr 03 20:17:42 2018 -0500
# Node ID 2dc12c8f68a1b622417386ce69fb86949c241197
# Parent  b8ffceb0635450aa75ef6866dc2e7f15e90e6afa
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)

* documentation.cc: Add <QShortcut>, <QToolButton> and "resource-manager" to
  list of headers.
  (documentation::documentation): Create new browser_find widget and make it
  the parent of m_doc_browser for short-cut key behavior reasons.  Layout a
  footer with a "Find:" QLabel, a QLineEdit to hold search text, a forward-find
  QToolButton and a backward-find QToolButton.  Connect QLineEdit's
  returnPressed() signal and forward_button's pressed() signal to documentation
  window's find_forward() slot.  Connect backward_button's pressed() signal to
  documentation window's find_backward() slot.  Add a QShortcut for "Ctrl+F"
  with parent browser_find and connect its activated() signal to the
  documentation window's toggle_hidden_find() slot.  Default is find_footer
  hidden.
  (documentation::find_forward): Added.  Call m_doc_brower's find() method in
  the forward direction.
  (documentation::find_backward): Added.  Call m_doc_brower's find() method in
  the backward direction.
  (documentation::toggle_hidden_find): Added.  Toggle find_footer's hidden
  status and put the focus either in m_find_line_edit or m_doc_browser
  accordingly.

* documentation.h: Add new member QLineEdit pointer variable m_find_line_edit.
  (documentation::find_foward): Added.  New slot, void input.
  (documentation::find_backward): Ditto.
  (documentation::toggle_hidden_find): Ditto.

diff --git a/libgui/src/documentation.cc b/libgui/src/documentation.cc
--- a/libgui/src/documentation.cc
+++ b/libgui/src/documentation.cc
@@ -41,10 +41,13 @@ along with Octave; see the file COPYING.
 #include <QLabel>
 #include <QLineEdit>
 #include <QMessageBox>
+#include <QShortcut>
 #include <QTabWidget>
+#include <QToolButton>
 #include <QVBoxLayout>
 
 #include "documentation.h"
+#include "resource-manager.h"
 
 namespace octave
 {
@@ -93,7 +96,44 @@ namespace octave
       }
 
     // The browser
-    m_doc_browser = new documentation_browser (m_help_engine, this);
+    QWidget *browser_find = new QWidget (this);
+    m_doc_browser = new documentation_browser (m_help_engine, browser_find);
+
+    QWidget *find_footer = new QWidget (browser_find);
+    QLabel *find_label = new QLabel (tr ("Find:"), find_footer);
+    m_find_line_edit = new QLineEdit (find_footer);
+    connect (m_find_line_edit, SIGNAL (returnPressed (void)),
+             this, SLOT(find_forward (void)));
+    QToolButton *forward_button = new QToolButton (find_footer);
+    forward_button->setText (tr ("Search forward"));
+    forward_button->setToolTip (tr ("Search forward"));
+    forward_button->setIcon (resource_manager::icon ("go-down"));
+    connect (forward_button, SIGNAL (pressed (void)),
+             this, SLOT(find_forward (void)));
+    QToolButton *backward_button = new QToolButton (find_footer);
+    backward_button->setText (tr ("Search backward"));
+    backward_button->setToolTip (tr ("Search backward"));
+    backward_button->setIcon (resource_manager::icon ("go-up"));
+    connect (backward_button, SIGNAL (pressed (void)),
+             this, SLOT(find_backward (void)));
+    QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer);
+    h_box_find_footer->addWidget (find_label);
+    h_box_find_footer->addWidget (m_find_line_edit);
+    h_box_find_footer->addWidget (forward_button);
+    h_box_find_footer->addWidget (backward_button);
+    h_box_find_footer->setMargin (2);
+    find_footer->setLayout (h_box_find_footer);
+
+    QVBoxLayout *v_box_browser_find = new QVBoxLayout (browser_find);
+    v_box_browser_find->addWidget (m_doc_browser);
+    v_box_browser_find->addWidget (find_footer);
+    browser_find->setLayout (v_box_browser_find);
+
+    QShortcut *shortcut = new QShortcut(QKeySequence(tr("Ctrl+F")), browser_find);
+    shortcut->setContext(Qt::WidgetWithChildrenShortcut);
+    connect (shortcut, SIGNAL (activated (void)),
+             this, SLOT(toggle_hidden_find (void)));
+    find_footer->hide ();
 
     // Layout contents, index and search
     QTabWidget *navi = new QTabWidget (this);
@@ -176,7 +216,7 @@ namespace octave
 
     // Fill the splitter
     insertWidget (0, navi);
-    insertWidget (1, m_doc_browser);
+    insertWidget (1, browser_find);
     setStretchFactor (1, 1);
 
     // Initial view: Contents
@@ -274,6 +314,35 @@ namespace octave
     m_filter->setCurrentIndex (0);
   }
 
+  void documentation::find_forward (void)
+  {
+    if (! m_help_engine)
+      return;
+
+    m_doc_browser->find (m_find_line_edit->text ());
+  }
+
+  void documentation::find_backward (void)
+  {
+    if (! m_help_engine)
+      return;
+
+    m_doc_browser->find (m_find_line_edit->text (), QTextDocument::FindBackward);
+  }
+
+  void documentation::toggle_hidden_find (void)
+  {
+    if (! m_help_engine)
+      return;
+
+    m_find_line_edit->parentWidget ()->
+        setHidden (! m_find_line_edit->parentWidget ()->isHidden ());
+    if (m_find_line_edit->parentWidget ()->isHidden ())
+      m_doc_browser->setFocus ();
+    else
+      m_find_line_edit->setFocus ();
+  }
+
   void documentation::registerDoc (const QString& qch)
   {
     if (m_help_engine)
diff --git a/libgui/src/documentation.h b/libgui/src/documentation.h
--- a/libgui/src/documentation.h
+++ b/libgui/src/documentation.h
@@ -86,11 +86,15 @@ namespace octave
     void global_search_finished (int hits);
     void filter_update (const QString& expression);
     void filter_update_history (void);
+    void find_forward (void);
+    void find_backward (void);
+    void toggle_hidden_find (void);
 
   private:
 
     QHelpEngine *m_help_engine;
     documentation_browser *m_doc_browser;
+    QLineEdit *m_find_line_edit;
     QComboBox *m_filter;
     QString m_collection;
 
