Akonadi

itemretrievaljob.h
1 /*
2  SPDX-FileCopyrightText: 2009 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef ITEMRETRIEVALJOB_H
8 #define ITEMRETRIEVALJOB_H
9 
10 #include <QObject>
11 
12 #include "itemretrievalrequest.h"
13 
15 class OrgFreedesktopAkonadiResourceInterface;
16 
17 namespace Akonadi
18 {
19 namespace Server
20 {
21 
22 class ItemRetrievalRequest;
23 
24 class AbstractItemRetrievalJob : public QObject
25 {
26  Q_OBJECT
27 public:
28  AbstractItemRetrievalJob(ItemRetrievalRequest req, QObject *parent);
29  ~AbstractItemRetrievalJob() override = default;
30 
31  virtual void start() = 0;
32  virtual void kill() = 0;
33 
34  const ItemRetrievalRequest &request() const { return m_result.request; }
35  const ItemRetrievalResult &result() const { return m_result; }
36 
37 Q_SIGNALS:
38  void requestCompleted(Akonadi::Server::AbstractItemRetrievalJob *job);
39 
40 protected:
41  ItemRetrievalResult m_result;
42 };
43 
45 class ItemRetrievalJob : public AbstractItemRetrievalJob
46 {
47  Q_OBJECT
48 public:
50  : AbstractItemRetrievalJob(std::move(req), parent)
51  {}
52 
53  void setInterface(OrgFreedesktopAkonadiResourceInterface *interface)
54  {
55  m_interface = interface;
56  }
57 
58  ~ItemRetrievalJob() override;
59  void start() override;
60  void kill() override;
61 
62 private Q_SLOTS:
63  void callFinished(QDBusPendingCallWatcher *watcher);
64 
65 private:
66  bool m_active = false;
67  OrgFreedesktopAkonadiResourceInterface *m_interface = nullptr;
68 
69 };
70 
71 } // namespace Server
72 } // namespace Akonadi
73 
74 #endif
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
Details of a single item retrieval request.
Helper integration between Akonadi and Qt.
Async D-Bus retrieval, no modification of the request (thus no need for locking)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 12 2020 23:16:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.