Changeset View
Changeset View
Standalone View
Standalone View
src/contentlist/ContentListerBase.h
Show All 19 Lines | |||||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef CONTENTLISTERBASE_H | 22 | #ifndef CONTENTLISTERBASE_H | ||
23 | #define CONTENTLISTERBASE_H | 23 | #define CONTENTLISTERBASE_H | ||
24 | 24 | | |||
25 | #include <QObject> | 25 | #include <QObject> | ||
26 | 26 | | |||
27 | class ContentQuery; | 27 | class ContentQuery; | ||
28 | 28 | /** | |||
29 | * \brief Class to handle the search. | ||||
30 | * | ||||
31 | * This class can be extended to handle other search engines, | ||||
32 | * such as baloo and the file system content lister. | ||||
33 | * | ||||
34 | * By default it only searches the KFileMetaData available to it. | ||||
35 | */ | ||||
29 | class ContentListerBase : public QObject | 36 | class ContentListerBase : public QObject | ||
30 | { | 37 | { | ||
31 | Q_OBJECT | 38 | Q_OBJECT | ||
32 | public: | 39 | public: | ||
33 | explicit ContentListerBase(QObject* parent = nullptr); | 40 | explicit ContentListerBase(QObject* parent = nullptr); | ||
34 | ~ContentListerBase() override; | 41 | ~ContentListerBase() override; | ||
35 | 42 | | |||
43 | /** | ||||
44 | * \brief Start a search. | ||||
45 | * @param queries List of ContentQueries that the search should be limited to. | ||||
46 | */ | ||||
36 | Q_SLOT virtual void startSearch(const QList<ContentQuery*>& queries); | 47 | Q_SLOT virtual void startSearch(const QList<ContentQuery*>& queries); | ||
37 | 48 | | |||
49 | /** | ||||
50 | * \brief Fires when a matching file is found. | ||||
51 | */ | ||||
38 | Q_SIGNAL void fileFound(const QString& filePath, const QVariantMap& metadata); | 52 | Q_SIGNAL void fileFound(const QString& filePath, const QVariantMap& metadata); | ||
53 | /** | ||||
54 | * \brief Fires when the search was completed. | ||||
55 | */ | ||||
39 | Q_SIGNAL void searchCompleted(); | 56 | Q_SIGNAL void searchCompleted(); | ||
40 | 57 | | |||
58 | /** | ||||
59 | * @return the available metadata for the filepath so that it can be searched. | ||||
60 | */ | ||||
41 | static QVariantMap metaDataForFile(const QString& file); | 61 | static QVariantMap metaDataForFile(const QString& file); | ||
42 | }; | 62 | }; | ||
43 | 63 | | |||
44 | #endif//CONTENTLISTERBASE_H | 64 | #endif//CONTENTLISTERBASE_H |