File indexing completed on 2024-04-28 03:55:43
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 "kuriikwsfiltereng_private_export.h" 0012 #include <QList> 0013 #include <QMap> 0014 0015 class SearchProvider; 0016 0017 namespace KIO 0018 { 0019 0020 /** 0021 * Memory cache for search provider desktop files 0022 */ 0023 class KURIIKWSFILTERENG_PRIVATE_EXPORT SearchProviderRegistry 0024 { 0025 public: 0026 /** 0027 * Default constructor 0028 */ 0029 SearchProviderRegistry(); 0030 0031 /** 0032 * Destructor 0033 */ 0034 ~SearchProviderRegistry(); 0035 0036 SearchProviderRegistry(const SearchProviderRegistry &) = delete; 0037 SearchProviderRegistry &operator=(const SearchProviderRegistry &) = delete; 0038 0039 QList<SearchProvider *> findAll(); 0040 0041 SearchProvider *findByKey(const QString &key) const; 0042 0043 SearchProvider *findByDesktopName(const QString &desktopName) const; 0044 0045 void reload(); 0046 0047 private: 0048 QStringList directories() const; 0049 0050 QList<SearchProvider *> m_searchProviders; 0051 QMap<QString, SearchProvider *> m_searchProvidersByKey; 0052 QMap<QString, SearchProvider *> m_searchProvidersByDesktopName; 0053 }; 0054 } 0055 0056 #endif // SEARCHPROVIDERREGISTRY_H