From 394cad3f79c843be3dfb09b70080c2c6852d3d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Mon, 12 Apr 2010 14:38:00 +0200 Subject: [PATCH] Override IOptionsPage::matches for ShortcutSettings page It wasn't finding this page when looking for 'shortcut'. --- .../coreplugin/dialogs/shortcutsettings.cpp | 27 ++++++++++++++----- .../coreplugin/dialogs/shortcutsettings.h | 3 +++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 42c79069596..39a24412610 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -39,7 +39,6 @@ #include <utils/treewidgetcolumnstretcher.h> - #include <QtGui/QKeyEvent> #include <QtGui/QShortcut> #include <QtGui/QHeaderView> @@ -98,10 +97,21 @@ QWidget *ShortcutSettings::createPage(QWidget *parent) m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0; QWidget *w = CommandMappings::createPage(parent); - setPageTitle(tr("Keyboard Shortcuts")); - setTargetLabelText(tr("Shortcut:")); - setTargetEditTitle(tr("Keyboard Shortcuts")); - setTargetHeader(tr("Shortcut")); + + const QString pageTitle = tr("Keyboard Shortcuts"); + const QString targetLabelText = tr("Key sequence:"); + const QString editTitle = tr("Shortcut"); + + setPageTitle(pageTitle); + setTargetLabelText(targetLabelText); + setTargetEditTitle(editTitle); + setTargetHeader(editTitle); + + if (m_searchKeywords.isEmpty()) { + QTextStream(&m_searchKeywords) << ' ' << pageTitle + << ' ' << targetLabelText + << ' ' << editTitle; + } return w; } @@ -120,6 +130,11 @@ void ShortcutSettings::finish() CommandMappings::finish(); } +bool ShortcutSettings::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} + bool ShortcutSettings::eventFilter(QObject *o, QEvent *e) { Q_UNUSED(o) @@ -369,7 +384,7 @@ void ShortcutSettings::markPossibleCollisions(ShortcutItem *item) continue; } - foreach(int context, currentItem->m_cmd->context()) { + foreach (int context, currentItem->m_cmd->context()) { // conflict if context is identical, OR if one // of the contexts is the global context diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.h b/src/plugins/coreplugin/dialogs/shortcutsettings.h index d9a816a63c6..f4013a187f3 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.h +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.h @@ -73,6 +73,7 @@ public: QWidget *createPage(QWidget *parent); void apply(); void finish(); + bool matches(const QString &s) const; protected: bool eventFilter(QObject *o, QEvent *e); @@ -97,6 +98,8 @@ private: QList<ShortcutItem *> m_scitems; int m_key[4], m_keyNum; + + QString m_searchKeywords; }; } // namespace Internal -- GitLab