File indexing completed on 2024-05-12 11:54:37
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2017 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #ifndef SEARCHPROVIDERREGISTRY_H 0009 #define SEARCHPROVIDERREGISTRY_H 0010 0011 #include <QList> 0012 #include <QMap> 0013 0014 class SearchProvider; 0015 0016 /** 0017 * Memory cache for search provider desktop files 0018 */ 0019 class SearchProviderRegistry 0020 { 0021 public: 0022 /** 0023 * Default constructor 0024 */ 0025 SearchProviderRegistry(); 0026 0027 /** 0028 * Destructor 0029 */ 0030 ~SearchProviderRegistry(); 0031 0032 SearchProviderRegistry(const SearchProviderRegistry &) = delete; 0033 SearchProviderRegistry &operator=(const SearchProviderRegistry &) = delete; 0034 0035 QList<SearchProvider *> findAll(); 0036 0037 SearchProvider *findByKey(const QString &key) const; 0038 0039 SearchProvider *findByDesktopName(const QString &desktopName) const; 0040 0041 void reload(); 0042 0043 private: 0044 QStringList directories() const; 0045 0046 QList<SearchProvider *> m_searchProviders; 0047 QMap<QString, SearchProvider *> m_searchProvidersByKey; 0048 QMap<QString, SearchProvider *> m_searchProvidersByDesktopName; 0049 }; 0050 0051 #endif // SEARCHPROVIDERREGISTRY_H