diff options
author | kh1 <qt-info@nokia.com> | 2010-09-22 15:01:33 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2010-09-22 15:33:50 +0200 |
commit | b4dd2080bee32e3feaf652893eb73d95957e6feb (patch) | |
tree | 13a18a5f22068143e34f76f8e551d9e9b8885c59 /src/plugins/help | |
parent | 977050d311b62406825781ba53022e848f941e37 (diff) | |
download | qt-creator-b4dd2080bee32e3feaf652893eb73d95957e6feb.tar.gz |
Implement opening find toolbar after '/' as requested by hjk.
Diffstat (limited to 'src/plugins/help')
-rw-r--r-- | src/plugins/help/centralwidget.cpp | 1 | ||||
-rw-r--r-- | src/plugins/help/centralwidget.h | 1 | ||||
-rw-r--r-- | src/plugins/help/helpplugin.cpp | 11 | ||||
-rw-r--r-- | src/plugins/help/helpplugin.h | 2 | ||||
-rw-r--r-- | src/plugins/help/helpviewer.h | 1 | ||||
-rw-r--r-- | src/plugins/help/helpviewer_qtb.cpp | 7 | ||||
-rw-r--r-- | src/plugins/help/helpviewer_qwv.cpp | 8 |
7 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index c7900b457a..34e234e1f9 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 f3928e43ab..e2b11c9b12 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 ca218cc68e..81e93170f1 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 3cb96a6c9c..8330b96f7f 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 43e1bfea0d..2f7405667b 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 2717712692..7cef9c543c 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 8f8968815f..993afb09a1 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); } |