From 03d0b577fd31f36ab24a2bd32e3f4ade3dcace93 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 20 Nov 2009 12:56:49 +0100
Subject: [PATCH] First polish of options dialog find: Set item flags, match on
 category.

Strip buddy markers.
---
 src/plugins/coreplugin/dialogs/settingsdialog.cpp | 8 ++++++--
 src/plugins/vcsbase/vcsbasesettingspage.cpp       | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index f2794d31949..be51bb792d4 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -66,6 +66,7 @@ template<class Parent>
                                              IOptionsPage *page = 0)
 {
     QStandardItem *rc = new QStandardItem(text);
+    rc->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
     rc->setData(QVariant(int(type)), TypeRole);
     rc->setData(QVariant(index), IndexRole);
     rc->setData(qVariantFromValue(page), PageRole);
@@ -115,8 +116,11 @@ bool PageFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source
     // Regular contents check, then check page-filter.
     if (QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent))
         return true;
-    if (const IOptionsPage *page = pageOfItem(sourceModel(), source_parent.child(source_row, 0)))
-        return page->matches(filterRegExp().pattern());
+    if (const IOptionsPage *page = pageOfItem(sourceModel(), source_parent.child(source_row, 0))) {
+        const QString pattern = filterRegExp().pattern();
+        return page->trCategory().contains(pattern, Qt::CaseInsensitive) ||
+        page->matches(pattern);
+    }
     return false;
 }
 
diff --git a/src/plugins/vcsbase/vcsbasesettingspage.cpp b/src/plugins/vcsbase/vcsbasesettingspage.cpp
index ac5ef4c2372..5d9fcb0a83a 100644
--- a/src/plugins/vcsbase/vcsbasesettingspage.cpp
+++ b/src/plugins/vcsbase/vcsbasesettingspage.cpp
@@ -88,6 +88,7 @@ QString VCSBaseSettingsWidget::searchKeyWordMatchString() const
     rc += m_ui->nickNameMailMapLabel->text();
     rc += blank;
     rc += m_ui->nickNameFieldsFileLabel->text();
+    rc.remove(QLatin1Char('&')); // Strip buddy markers.
     return rc;
 }
 
@@ -130,7 +131,8 @@ QWidget *VCSBaseSettingsPage::createPage(QWidget *parent)
 {
     m_widget = new VCSBaseSettingsWidget(parent);
     m_widget->setSettings(m_settings);
-    m_searchKeyWords = m_widget->searchKeyWordMatchString();
+    if (m_searchKeyWords.isEmpty())
+        m_searchKeyWords = m_widget->searchKeyWordMatchString();
     return m_widget;
 }
 
-- 
GitLab