| 1 | /* |
| 2 | This file is part of the KDE project |
| 3 | SPDX-FileCopyrightText: 2017 David Faure <faure@kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef SEARCHPROVIDERREGISTRY_H |
| 9 | #define SEARCHPROVIDERREGISTRY_H |
| 10 | |
| 11 | #include "kuriikwsfiltereng_private_export.h" |
| 12 | #include <QList> |
| 13 | #include <QMap> |
| 14 | |
| 15 | class SearchProvider; |
| 16 | |
| 17 | namespace KIO |
| 18 | { |
| 19 | |
| 20 | /*! |
| 21 | * Memory cache for search provider desktop files |
| 22 | */ |
| 23 | class KURIIKWSFILTERENG_PRIVATE_EXPORT SearchProviderRegistry |
| 24 | { |
| 25 | public: |
| 26 | /*! |
| 27 | * Default constructor |
| 28 | */ |
| 29 | SearchProviderRegistry(); |
| 30 | |
| 31 | /*! |
| 32 | * Destructor |
| 33 | */ |
| 34 | ~SearchProviderRegistry(); |
| 35 | |
| 36 | SearchProviderRegistry(const SearchProviderRegistry &) = delete; |
| 37 | SearchProviderRegistry &operator=(const SearchProviderRegistry &) = delete; |
| 38 | |
| 39 | QList<SearchProvider *> findAll(); |
| 40 | |
| 41 | SearchProvider *findByKey(const QString &key) const; |
| 42 | |
| 43 | SearchProvider *findByDesktopName(const QString &desktopName) const; |
| 44 | |
| 45 | void reload(); |
| 46 | |
| 47 | private: |
| 48 | QStringList directories() const; |
| 49 | |
| 50 | QList<SearchProvider *> m_searchProviders; |
| 51 | QMap<QString, SearchProvider *> m_searchProvidersByKey; |
| 52 | QMap<QString, SearchProvider *> m_searchProvidersByDesktopName; |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | #endif // SEARCHPROVIDERREGISTRY_H |
| 57 | |