Akonadi

searchmanager.h
1 /*
2  SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
3  SPDX-FileCopyrightText: 2013 Daniel Vrátil <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef SEARCHMANAGER_H
9 #define SEARCHMANAGER_H
10 
11 #include "akthread.h"
12 
13 #include <QVector>
14 #include <QSet>
15 #include <QMutex>
16 
17 class QTimer;
18 class QPluginLoader;
19 
20 namespace Akonadi
21 {
22 
23 class AbstractSearchPlugin;
24 
25 namespace Server
26 {
27 
28 class AbstractSearchEngine;
29 class Collection;
30 class SearchTaskManager;
31 
36 class SearchManager : public AkThread
37 {
38  Q_OBJECT
39  Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Akonadi.SearchManager")
40 
41 public:
43  explicit SearchManager(const QStringList &searchEngines, SearchTaskManager &agentSearchManager);
44 
45  ~SearchManager() override;
46 
50  virtual void updateSearchAsync(const Collection &collection);
51 
55  virtual void updateSearch(const Collection &collection);
56 
61 
62 public Q_SLOTS:
63  virtual void scheduleSearchUpdate();
64 
69  virtual void registerInstance(const QString &id);
70 
75  virtual void unregisterInstance(const QString &id);
76 
77 private Q_SLOTS:
78  void searchUpdateTimeout();
79  void searchUpdateResultsAvailable(const QSet<qint64> &results);
80 
86  void updateSearchImpl(const Akonadi::Server::Collection &collection);
87 
88 private:
89  void init() override;
90  void quit() override;
91 
92  // Called from main thread
93  void loadSearchPlugins();
94  // Called from manager thread
95  void initSearchPlugins();
96 
97  SearchTaskManager &mAgentSearchManager;
98  QStringList mEngineNames;
99  QVector<QPluginLoader *> mPluginLoaders;
102 
103  QTimer *mSearchUpdateTimer = nullptr;
104 
105  QMutex mLock;
106  QSet<qint64> mUpdatingCollections;
107 
108 };
109 
110 } // namespace Server
111 } // namespace Akonadi
112 
113 #endif
Q_CLASSINFO(Name, Value)
SearchManager creates and deletes persistent searches for all currently active search engines...
Definition: searchmanager.h:36
Represents a collection of PIM items.
Definition: collection.h:63
virtual void registerInstance(const QString &id)
This is called via D-Bus from AgentManager to register an agent with search interface.
virtual QVector< AbstractSearchPlugin * > searchPlugins() const
Returns currently available search plugins.
Q_OBJECTQ_OBJECT
SearchManager(const QStringList &searchEngines, SearchTaskManager &agentSearchManager)
Create a new search manager with the given searchEngines.
Definition: item.h:31
virtual void updateSearch(const Collection &collection)
Updates the search query synchronously.
Helper integration between Akonadi and Qt.
virtual void unregisterInstance(const QString &id)
This is called via D-Bus from AgentManager to unregister an agent with search interface.
virtual void updateSearchAsync(const Collection &collection)
Updates the search query asynchronously.
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 23:15:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.