Akonadi

akonadicontrol/agentmanager.h
1 /***************************************************************************
2  * SPDX-FileCopyrightText: 2006 Tobias Koenig <[email protected]> *
3  * SPDX-FileCopyrightText: 2007 Volker Krause <[email protected]> *
4  * *
5  * SPDX-License-Identifier: LGPL-2.0-or-later *
6  ***************************************************************************/
7 
8 #ifndef AGENTMANAGER_H
9 #define AGENTMANAGER_H
10 
11 #include <QHash>
12 #include <QStringList>
13 
14 #include "agenttype.h"
15 #include "agentinstance.h"
16 
17 class QDir;
18 
19 namespace Akonadi
20 {
21 class ProcessControl;
22 }
23 
29 class AgentManager : public QObject, protected QDBusContext
30 {
31  Q_OBJECT
32  Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Akonadi.AgentManager")
33 
34 public:
40  explicit AgentManager(bool verbose, QObject *parent = nullptr);
41 
45  ~AgentManager();
46 
51  void cleanup();
52 
57  QStringList agentTypes() const;
58 
63  QString agentName(const QString &identifier) const;
64 
69  QString agentComment(const QString &identifier) const;
70 
75  QString agentIcon(const QString &identifier) const;
76 
81  QStringList agentMimeTypes(const QString &identifier) const;
82 
87  QStringList agentCapabilities(const QString &identifier) const;
88 
94  QVariantMap agentCustomProperties(const QString &identifier) const;
95 
105  QString createAgentInstance(const QString &identifier);
106 
110  void removeAgentInstance(const QString &identifier);
111 
115  QString agentInstanceType(const QString &identifier);
116 
120  QStringList agentInstances() const;
121 
125  int agentInstanceStatus(const QString &identifier) const;
126 
131  QString agentInstanceStatusMessage(const QString &identifier) const;
132 
137  uint agentInstanceProgress(const QString &identifier) const;
138 
143  QString agentInstanceProgressMessage(const QString &identifier) const;
144 
148  void setAgentInstanceName(const QString &identifier, const QString &name);
149 
153  QString agentInstanceName(const QString &identifier) const;
154 
160  void agentInstanceConfigure(const QString &identifier, qlonglong windowId);
161 
166  void agentInstanceSynchronize(const QString &identifier);
167 
172  void agentInstanceSynchronizeCollectionTree(const QString &identifier);
173 
177  void agentInstanceSynchronizeCollection(const QString &identifier, qint64 collection);
178 
183  void agentInstanceSynchronizeCollection(const QString &identifier, qint64 collection, bool recursive);
184 
189  void agentInstanceSynchronizeTags(const QString &identifier);
190 
195  void agentInstanceSynchronizeRelations(const QString &identifier);
196 
200  bool agentInstanceOnline(const QString &identifier);
201 
205  void setAgentInstanceOnline(const QString &identifier, bool state);
206 
211  void restartAgentInstance(const QString &identifier);
212 
216  void addSearch(const QString &query, const QString &queryLanguage, qint64 resultCollectionId);
217 
221  void removeSearch(quint64 resultCollectionId);
222 
223 Q_SIGNALS:
229  void agentTypeAdded(const QString &agentType);
230 
236  void agentTypeRemoved(const QString &agentType);
237 
243  void agentInstanceAdded(const QString &agentIdentifier);
244 
250  void agentInstanceRemoved(const QString &agentIdentifier);
251 
260  void agentInstanceStatusChanged(const QString &agentIdentifier, int status, const QString &message);
261 
269  void agentInstanceAdvancedStatusChanged(const QString &agentIdentifier, const QVariantMap &status);
270 
279  void agentInstanceProgressChanged(const QString &agentIdentifier, uint progress, const QString &message);
280 
287  void agentInstanceWarning(const QString &agentIdentifier, const QString &message);
288 
295  void agentInstanceError(const QString &agentIdentifier, const QString &message);
296 
303  void agentInstanceNameChanged(const QString &agentIdentifier, const QString &name);
304 
308  void agentInstanceOnlineChanged(const QString &agentIdentifier, bool state);
309 
310 private Q_SLOTS:
311  void updatePluginInfos();
312  void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
313  void agentExeChanged(const QString &fileName);
314 
315 private:
320  static QStringList pluginInfoPathList();
321 
325  void load();
326 
330  void save();
331 
335  void readPluginInfos();
336 
342  void readPluginInfos(const QDir &directory);
343 
344  AgentInstance::Ptr createAgentInstance(const AgentType &type);
345  bool checkAgentInterfaces(const QString &identifier, const QString &method) const;
346  bool checkInstance(const QString &identifier) const;
347  bool checkResourceInterface(const QString &identifier, const QString &method) const;
348  bool checkAgentExists(const QString &identifier) const;
349  void ensureAutoStart(const AgentType &info);
350  void continueStartup();
351  void registerAgentAtServer(const QString &agentIdentifier, const AgentType &type);
352 
353 private:
361 
367  QHash<QString, AgentInstance::Ptr> mAgentInstances;
368 
369  std::unique_ptr<Akonadi::ProcessControl> mAgentServer;
370  std::unique_ptr<Akonadi::ProcessControl> mStorageController;
371  bool mAgentServerEnabled = false;
372  bool mVerbose = false;
373 
374  friend class AgentInstance;
375 };
376 
377 #endif
Q_CLASSINFO(Name, Value)
Q_SIGNALSQ_SIGNALS
Represents one agent instance and takes care of communication with it.
Q_OBJECTQ_OBJECT
The agent manager has knowledge about all available agents (it scans for .desktop files in the agent ...
AgentType type(const QString &identifier) const
Returns the agent type with the given identifier or an invalid agent type if the identifier does not ...
~AgentManager()
Destroys the agent manager.
Helper integration between Akonadi and Qt.
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 13 2020 23:16:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.