diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index c7900b457abb015f7a3ee13cd5184bf4ff071546..34e234e1f9671a5c93dbf20c10d6fe608ccc27b6 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -369,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page) connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(page, SIGNAL(printRequested()), this, SLOT(print())); + connect(page, SIGNAL(openFindToolBar()), this, SIGNAL(openFindToolBar())); } bool CentralWidget::eventFilter(QObject *object, QEvent *e) diff --git a/src/plugins/help/centralwidget.h b/src/plugins/help/centralwidget.h index f3928e43abc0121e200441ac3160c441b2b32908..e2b11c9b12b2f8687779089154b291c2cac589ab 100644 --- a/src/plugins/help/centralwidget.h +++ b/src/plugins/help/centralwidget.h @@ -97,6 +97,7 @@ protected: void focusInEvent(QFocusEvent *event); signals: + void openFindToolBar(); void currentViewerChanged(); void sourceChanged(const QUrl &url); void forwardAvailable(bool available); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index ca218cc68e8889608cd69ff7bcdf86f66f3a308a..81e93170f1ce356ff3852a77203a96520add7f55 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -62,6 +62,7 @@ #include <coreplugin/rightpane.h> #include <coreplugin/sidebar.h> #include <extensionsystem/pluginmanager.h> +#include <find/findplugin.h> #include <texteditor/texteditorconstants.h> #include <utils/styledbar.h> #include <welcome/welcomemode.h> @@ -180,6 +181,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) m_centralWidget = new Help::Internal::CentralWidget(); connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, SLOT(updateSideBarSource(QUrl))); + connect(m_centralWidget, SIGNAL(openFindToolBar()), this, + SLOT(openFindToolBar())); // Add Home, Previous and Next actions (used in the toolbar) QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")), @@ -568,6 +571,8 @@ void HelpPlugin::createRightPaneContextViewer() rightPaneLayout->addWidget(rightPaneStyledBar); m_helpViewerForSideBar = new HelpViewer(qreal(0.0), rightPaneSideBar); + connect(m_helpViewerForSideBar, SIGNAL(openFindToolBar()), this, + SLOT(openFindToolBar())); #if !defined(QT_NO_WEBKIT) m_helpViewerForSideBar->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(false); #endif @@ -1119,6 +1124,12 @@ void HelpPlugin::slotOpenActionUrl(QAction *action) #endif } +void HelpPlugin::openFindToolBar() +{ + if (Find::FindPlugin::instance()) + Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForward); +} + void HelpPlugin::doSetupIfNeeded() { m_helpManager->setupGuiHelpEngine(); diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 3cb96a6c9c44a4c1dfee89147c5a4a21e0c221d1..8330b96f7f013e0ff4fe45d769959a08636b3b8b 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -110,6 +110,8 @@ private slots: void slotAboutToShowNextMenu(); void slotOpenActionUrl(QAction *action); + void openFindToolBar(); + private: void setupUi(); void resetFilter(); diff --git a/src/plugins/help/helpviewer.h b/src/plugins/help/helpviewer.h index 43e1bfea0d6052ad2e15bd95deceda90d6c63357..2f7405667b058d185f0cabc3edc6aaf5bff9cca5 100644 --- a/src/plugins/help/helpviewer.h +++ b/src/plugins/help/helpviewer.h @@ -105,6 +105,7 @@ public slots: signals: void titleChanged(); void printRequested(); + void openFindToolBar(); #if !defined(QT_NO_WEBKIT) void sourceChanged(const QUrl &); diff --git a/src/plugins/help/helpviewer_qtb.cpp b/src/plugins/help/helpviewer_qtb.cpp index 2717712692694699d5dc3a0d1749a32b3b9d1f09..7cef9c543ce89e5c137d4a0811af4da4dc7cd7d3 100644 --- a/src/plugins/help/helpviewer_qtb.cpp +++ b/src/plugins/help/helpviewer_qtb.cpp @@ -320,6 +320,13 @@ bool HelpViewer::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::FontChange && !d->forceFont) return true; + + if (event->type() == QEvent::KeyPress) { + if (QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event)) { + if (keyEvent->key() == Qt::Key_Slash) + emit openFindToolBar(); + } + } return QTextBrowser::eventFilter(obj, event); } diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp index 8f8968815f9d37a64fc18689c9cde6e7fce8a77b..993afb09a108eb3659fdfbce54a7dd09fe70d039 100644 --- a/src/plugins/help/helpviewer_qwv.cpp +++ b/src/plugins/help/helpviewer_qwv.cpp @@ -232,6 +232,8 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) : QWebView(parent) { setAcceptDrops(false); + installEventFilter(this); + settings()->setAttribute(QWebSettings::JavaEnabled, false); settings()->setAttribute(QWebSettings::PluginsEnabled, false); @@ -439,6 +441,12 @@ void HelpViewer::setLoadFinished(bool ok) bool HelpViewer::eventFilter(QObject *obj, QEvent *event) { + if (event->type() == QEvent::KeyPress) { + if (QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event)) { + if (keyEvent->key() == Qt::Key_Slash) + emit openFindToolBar(); + } + } return QWebView::eventFilter(obj, event); }