diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 1784867dc26..1a8fcd42d72 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -110,57 +110,6 @@ LocatorMatcherTasks HelpIndexFilter::matchers() return {{AsyncTask(onSetup, onDone), storage}}; } -void HelpIndexFilter::prepareSearch(const QString &entry) -{ - Q_UNUSED(entry) - if (!m_needsUpdate) - return; - - m_needsUpdate = false; - LocalHelpManager::setupGuiHelpEngine(); - m_allIndicesCache = LocalHelpManager::filterEngine()->indices({}); - m_lastIndicesCache.clear(); - m_lastEntry.clear(); -} - -QList HelpIndexFilter::matchesFor(QFutureInterface &future, - const QString &entry) -{ - const QStringList cache = m_lastEntry.isEmpty() || !entry.contains(m_lastEntry) - ? m_allIndicesCache : m_lastIndicesCache; - - const Qt::CaseSensitivity cs = caseSensitivity(entry); - QStringList bestKeywords; - QStringList worseKeywords; - bestKeywords.reserve(cache.size()); - worseKeywords.reserve(cache.size()); - for (const QString &keyword : cache) { - if (future.isCanceled()) - return {}; - if (keyword.startsWith(entry, cs)) - bestKeywords.append(keyword); - else if (keyword.contains(entry, cs)) - worseKeywords.append(keyword); - } - m_lastIndicesCache = bestKeywords + worseKeywords; - m_lastEntry = entry; - - QList entries; - for (const QString &key : std::as_const(m_lastIndicesCache)) { - const int index = key.indexOf(entry, 0, cs); - LocatorFilterEntry filterEntry; - filterEntry.displayName = key; - filterEntry.acceptor = [key] { - HelpPlugin::showLinksInCurrentViewer(LocalHelpManager::linksForKeyword(key), key); - return AcceptResult(); - }; - filterEntry.displayIcon = m_icon; - filterEntry.highlightInfo = {index, int(entry.length())}; - entries.append(filterEntry); - } - return entries; -} - void HelpIndexFilter::invalidateCache() { m_needsUpdate = true; diff --git a/src/plugins/help/helpindexfilter.h b/src/plugins/help/helpindexfilter.h index 489f7078c18..e980f49ab0c 100644 --- a/src/plugins/help/helpindexfilter.h +++ b/src/plugins/help/helpindexfilter.h @@ -5,19 +5,13 @@ #include -namespace Help { -namespace Internal { +namespace Help::Internal { class HelpIndexFilter final : public Core::ILocatorFilter { - Q_OBJECT - public: HelpIndexFilter(); - void prepareSearch(const QString &entry) override; - QList matchesFor(QFutureInterface &future, - const QString &entry) override; private: Core::LocatorMatcherTasks matchers() final; void invalidateCache(); @@ -29,5 +23,4 @@ private: QIcon m_icon; }; -} // namespace Internal -} // namespace Help +} // namespace Help::Internal