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 #pragma once
8 
9 #include <QObject>
10 
11 #include "itemretrievalrequest.h"
12 
14 class OrgFreedesktopAkonadiResourceInterface;
15 
16 namespace Akonadi
17 {
18 namespace Server
19 {
20 class ItemRetrievalRequest;
21 
22 class AbstractItemRetrievalJob : public QObject
23 {
24  Q_OBJECT
25 public:
26  AbstractItemRetrievalJob(ItemRetrievalRequest req, QObject *parent);
27  ~AbstractItemRetrievalJob() override = default;
28 
29  virtual void start() = 0;
30  virtual void kill() = 0;
31 
32  const ItemRetrievalRequest &request() const
33  {
34  return m_result.request;
35  }
36  const ItemRetrievalResult &result() const
37  {
38  return m_result;
39  }
40 
41 Q_SIGNALS:
42  void requestCompleted(Akonadi::Server::AbstractItemRetrievalJob *job);
43 
44 protected:
45  ItemRetrievalResult m_result;
46 };
47 
48 /// Async D-Bus retrieval, no modification of the request (thus no need for locking)
49 class ItemRetrievalJob : public AbstractItemRetrievalJob
50 {
51  Q_OBJECT
52 public:
54  : AbstractItemRetrievalJob(std::move(req), parent)
55  {
56  }
57 
58  void setInterface(OrgFreedesktopAkonadiResourceInterface *interface)
59  {
60  m_interface = interface;
61  }
62 
63  ~ItemRetrievalJob() override;
64  void start() override;
65  void kill() override;
66 
67 private Q_SLOTS:
68  void callFinished(QDBusPendingCallWatcher *watcher);
69 
70 private:
71  bool m_active = false;
72  OrgFreedesktopAkonadiResourceInterface *m_interface = nullptr;
73 };
74 
75 } // namespace Server
76 } // namespace Akonadi
77 
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Q_SCRIPTABLE Q_NOREPLY void start()
Async D-Bus retrieval, no modification of the request (thus no need for locking)
Q_SIGNALSQ_SIGNALS
Details of a single item retrieval request.
QObject * parent() const const
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:01:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.