Skip to content
Snippets Groups Projects
Commit b4dd2080 authored by kh1's avatar kh1
Browse files

Implement opening find toolbar after '/' as requested by hjk.

parent 977050d3
No related branches found
No related tags found
No related merge requests found
...@@ -369,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page) ...@@ -369,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page)
connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool)));
connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool)));
connect(page, SIGNAL(printRequested()), this, SLOT(print())); connect(page, SIGNAL(printRequested()), this, SLOT(print()));
connect(page, SIGNAL(openFindToolBar()), this, SIGNAL(openFindToolBar()));
} }
bool CentralWidget::eventFilter(QObject *object, QEvent *e) bool CentralWidget::eventFilter(QObject *object, QEvent *e)
......
...@@ -97,6 +97,7 @@ protected: ...@@ -97,6 +97,7 @@ protected:
void focusInEvent(QFocusEvent *event); void focusInEvent(QFocusEvent *event);
signals: signals:
void openFindToolBar();
void currentViewerChanged(); void currentViewerChanged();
void sourceChanged(const QUrl &url); void sourceChanged(const QUrl &url);
void forwardAvailable(bool available); void forwardAvailable(bool available);
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <coreplugin/rightpane.h> #include <coreplugin/rightpane.h>
#include <coreplugin/sidebar.h> #include <coreplugin/sidebar.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <find/findplugin.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <welcome/welcomemode.h> #include <welcome/welcomemode.h>
...@@ -180,6 +181,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -180,6 +181,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
m_centralWidget = new Help::Internal::CentralWidget(); m_centralWidget = new Help::Internal::CentralWidget();
connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this,
SLOT(updateSideBarSource(QUrl))); SLOT(updateSideBarSource(QUrl)));
connect(m_centralWidget, SIGNAL(openFindToolBar()), this,
SLOT(openFindToolBar()));
// Add Home, Previous and Next actions (used in the toolbar) // Add Home, Previous and Next actions (used in the toolbar)
QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")), QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")),
...@@ -568,6 +571,8 @@ void HelpPlugin::createRightPaneContextViewer() ...@@ -568,6 +571,8 @@ void HelpPlugin::createRightPaneContextViewer()
rightPaneLayout->addWidget(rightPaneStyledBar); rightPaneLayout->addWidget(rightPaneStyledBar);
m_helpViewerForSideBar = new HelpViewer(qreal(0.0), rightPaneSideBar); m_helpViewerForSideBar = new HelpViewer(qreal(0.0), rightPaneSideBar);
connect(m_helpViewerForSideBar, SIGNAL(openFindToolBar()), this,
SLOT(openFindToolBar()));
#if !defined(QT_NO_WEBKIT) #if !defined(QT_NO_WEBKIT)
m_helpViewerForSideBar->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(false); m_helpViewerForSideBar->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(false);
#endif #endif
...@@ -1119,6 +1124,12 @@ void HelpPlugin::slotOpenActionUrl(QAction *action) ...@@ -1119,6 +1124,12 @@ void HelpPlugin::slotOpenActionUrl(QAction *action)
#endif #endif
} }
void HelpPlugin::openFindToolBar()
{
if (Find::FindPlugin::instance())
Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForward);
}
void HelpPlugin::doSetupIfNeeded() void HelpPlugin::doSetupIfNeeded()
{ {
m_helpManager->setupGuiHelpEngine(); m_helpManager->setupGuiHelpEngine();
......
...@@ -110,6 +110,8 @@ private slots: ...@@ -110,6 +110,8 @@ private slots:
void slotAboutToShowNextMenu(); void slotAboutToShowNextMenu();
void slotOpenActionUrl(QAction *action); void slotOpenActionUrl(QAction *action);
void openFindToolBar();
private: private:
void setupUi(); void setupUi();
void resetFilter(); void resetFilter();
......
...@@ -105,6 +105,7 @@ public slots: ...@@ -105,6 +105,7 @@ public slots:
signals: signals:
void titleChanged(); void titleChanged();
void printRequested(); void printRequested();
void openFindToolBar();
#if !defined(QT_NO_WEBKIT) #if !defined(QT_NO_WEBKIT)
void sourceChanged(const QUrl &); void sourceChanged(const QUrl &);
......
...@@ -320,6 +320,13 @@ bool HelpViewer::eventFilter(QObject *obj, QEvent *event) ...@@ -320,6 +320,13 @@ bool HelpViewer::eventFilter(QObject *obj, QEvent *event)
{ {
if (event->type() == QEvent::FontChange && !d->forceFont) if (event->type() == QEvent::FontChange && !d->forceFont)
return true; 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); return QTextBrowser::eventFilter(obj, event);
} }
......
...@@ -232,6 +232,8 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) ...@@ -232,6 +232,8 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent)
: QWebView(parent) : QWebView(parent)
{ {
setAcceptDrops(false); setAcceptDrops(false);
installEventFilter(this);
settings()->setAttribute(QWebSettings::JavaEnabled, false); settings()->setAttribute(QWebSettings::JavaEnabled, false);
settings()->setAttribute(QWebSettings::PluginsEnabled, false); settings()->setAttribute(QWebSettings::PluginsEnabled, false);
...@@ -439,6 +441,12 @@ void HelpViewer::setLoadFinished(bool ok) ...@@ -439,6 +441,12 @@ void HelpViewer::setLoadFinished(bool ok)
bool HelpViewer::eventFilter(QObject *obj, QEvent *event) 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); return QWebView::eventFilter(obj, event);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment