forked from qt-creator/qt-creator
Implement opening find toolbar after '/' as requested by hjk.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -97,6 +97,7 @@ protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
|
||||
signals:
|
||||
void openFindToolBar();
|
||||
void currentViewerChanged();
|
||||
void sourceChanged(const QUrl &url);
|
||||
void forwardAvailable(bool available);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -110,6 +110,8 @@ private slots:
|
||||
void slotAboutToShowNextMenu();
|
||||
void slotOpenActionUrl(QAction *action);
|
||||
|
||||
void openFindToolBar();
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
void resetFilter();
|
||||
|
||||
@@ -105,6 +105,7 @@ public slots:
|
||||
signals:
|
||||
void titleChanged();
|
||||
void printRequested();
|
||||
void openFindToolBar();
|
||||
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
void sourceChanged(const QUrl &);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user