Akonadi

transportresourcebase.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
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
17namespace Akonadi
18{
19class 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 <exit3219@gmail.com>
39 * @since 4.4
40 */
41class AKONADIAGENTBASE_EXPORT TransportResourceBase
42{
43public:
44 /**
45 * Creates a new transport resource base.
46 */
48
49 /**
50 * Destroys the transport resource base.
51 */
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
84private:
85 /// @cond PRIVATE
86 std::unique_ptr<TransportResourceBasePrivate> const d;
87 /// @endcond
88};
89
90}
Represents a PIM item stored in Akonadi storage.
Definition item.h:100
Resource implementing mail transport capability.
TransportResult
Describes the result of the transport process.
@ TransportSucceeded
The transport process succeeded.
virtual void sendItem(const Akonadi::Item &item)=0
This method is called when the given item shall be send.
virtual ~TransportResourceBase()
Destroys the transport resource base.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.