Akonadi

searchrequest.h
1 /*
2  SPDX-FileCopyrightText: 2013, 2014 Daniel Vr├ítil <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QObject>
10 #include <QSet>
11 #include <QStringList>
12 #include <QVector>
13 
14 namespace Akonadi
15 {
16 namespace Server
17 {
18 class Connection;
19 class SearchManager;
20 class SearchTaskManager;
21 
22 class SearchRequest : public QObject
23 {
24  Q_OBJECT
25 
26 public:
27  explicit SearchRequest(const QByteArray &connectionId, SearchManager &searchManager, SearchTaskManager &agentSearchTask);
28  ~SearchRequest() override;
29 
30  void setQuery(const QString &query);
31  QString query() const;
32  void setCollections(const QVector<qint64> &collections);
33  QVector<qint64> collections() const;
34  void setMimeTypes(const QStringList &mimeTypes);
35  QStringList mimeTypes() const;
36  void setRemoteSearch(bool remote);
37  bool remoteSearch() const;
38 
39  /**
40  * Whether results should be stored after they are emitted via resultsAvailable(),
41  * so that they can be extracted via results() after the search is over. This
42  * is disabled by default.
43  */
44  void setStoreResults(bool storeResults);
45 
46  QByteArray connectionId() const;
47 
48  void exec();
49 
50  QSet<qint64> results() const;
51 
52 Q_SIGNALS:
53  void resultsAvailable(const QSet<qint64> &results);
54 
55 private:
56  void searchPlugins();
57  void emitResults(const QSet<qint64> &results);
58 
59  QByteArray mConnectionId;
60  QString mQuery;
61  QVector<qint64> mCollections;
62  QStringList mMimeTypes;
63  bool mRemoteSearch = false;
64  bool mStoreResults = false;
65  QSet<qint64> mResults;
66 
67  SearchManager &mSearchManager;
68  SearchTaskManager &mAgentSearchManager;
69 };
70 
71 } // namespace Server
72 } // namespace Akonadi
73 
Q_OBJECTQ_OBJECT
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
Q_SIGNALSQ_SIGNALS
QStringList mimeTypes(Mode mode=Writing)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.