Akonadi

transportresourcebase.h
1 /*
2  SPDX-FileCopyrightText: 2009 Constantin Berzan <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadiagentbase_export.h"
10 // AkonadiCore
11 #include <akonadi/item.h>
12 
13 #include <QString>
14 
15 #include <memory>
16 
17 namespace Akonadi
18 {
19 class TransportResourceBasePrivate;
20 
21 /**
22  * @short Resource implementing mail transport capability.
23  *
24  * This class allows a resource to provide mail transport (i.e. sending
25  * mail). A resource than can provide mail transport inherits from both
26  * ResourceBase and TransportResourceBase, implements the virtual method
27  * sendItem(), and calls itemSent() when finished sending.
28  *
29  * The resource must also have the "MailTransport" capability flag. For example
30  * the desktop file may contain:
31  \code
32  X-Akonadi-Capabilities=Resource,MailTransport
33  \endcode
34  *
35  * For an example of a transport-enabled resource, see
36  * kdepim/runtime/resources/mailtransport_dummy
37  *
38  * @author Constantin Berzan <[email protected]>
39  * @since 4.4
40  */
41 class AKONADIAGENTBASE_EXPORT TransportResourceBase
42 {
43 public:
44  /**
45  * Creates a new transport resource base.
46  */
48 
49  /**
50  * Destroys the transport resource base.
51  */
52  virtual ~TransportResourceBase();
53 
54  /**
55  * Describes the result of the transport process.
56  */
58  TransportSucceeded, ///< The transport process succeeded.
59  TransportFailed ///< The transport process failed.
60  };
61 
62  /**
63  * This method is called when the given @p item shall be send.
64  * When the sending is done or an error occurred during
65  * sending, call itemSent() with the appropriate result flag.
66  *
67  * @param item The message item to be send.
68  * @see itemSent().
69  */
70  virtual void sendItem(const Akonadi::Item &item) = 0;
71 
72  /**
73  * This method marks the sending of the passed @p item
74  * as finished.
75  *
76  * @param item The item that was sent.
77  * @param result The result that indicates whether the sending
78  * was successful or not.
79  * @param message An optional text explanation of the result.
80  * @see Transport.
81  */
82  void itemSent(const Akonadi::Item &item, TransportResult result, const QString &message = QString());
83 
84 private:
85  /// @cond PRIVATE
86  std::unique_ptr<TransportResourceBasePrivate> const d;
87  /// @endcond
88 };
89 
90 }
91 
TransportResult
Describes the result of the transport process.
Resource implementing mail transport capability.
@ TransportSucceeded
The transport process succeeded.
QString message
Represents a PIM item stored in Akonadi storage.
Definition: item.h:104
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:00:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.