Akonadi Mime

sentactionattribute.h
1/*
2 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
3 SPDX-FileContributor: Tobias Koenig <tokoe@kdab.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "akonadi-mime_export.h"
11
12#include <Akonadi/Attribute>
13#include <QList>
14#include <QSharedDataPointer>
15#include <QVariant>
16
17#include <memory>
18
19namespace Akonadi
20{
21class SentActionAttributePrivate;
22class SentActionAttributeActionPrivate;
23
24/**
25 * @short An Attribute that stores the action to execute after sending.
26 *
27 * This attribute stores the action that will be executed by the mail dispatcher
28 * after a mail has successfully be sent.
29 *
30 * @author Tobias Koenig <tokoe@kdab.com>
31 * @since 4.6
32 */
33class AKONADI_MIME_EXPORT SentActionAttribute : public Akonadi::Attribute
34{
35public:
36 /**
37 * @short A sent action.
38 */
39 class AKONADI_MIME_EXPORT Action
40 {
41 public:
42 /**
43 * Describes the action type.
44 */
45 enum Type {
46 Invalid, ///< An invalid action.
47 MarkAsReplied, ///< The message will be marked as replied.
48 MarkAsForwarded ///< The message will be marked as forwarded.
49 };
50
51 /**
52 * Describes a list of sent actions.
53 */
55
56 /**
57 * Creates a new invalid action.
58 */
59 Action();
60
61 /**
62 * Creates a new action.
63 *
64 * @param type The type of action that shall be executed.
65 * @param value The action specific argument.
66 */
67 Action(Type type, const QVariant &value);
68
69 /**
70 * Creates an action from an @p other action.
71 */
72 Action(const Action &other);
73
74 /**
75 * Destroys the action.
76 */
78
79 /**
80 * Returns the type of the action.
81 */
82 [[nodiscard]] Type type() const;
83
84 /**
85 * Returns the argument value of the action.
86 */
87 [[nodiscard]] QVariant value() const;
88
89 /**
90 * @internal
91 */
92 Action &operator=(const Action &other);
93
94 /**
95 * @internal
96 */
97 bool operator==(const Action &other) const;
98
99 private:
100 //@cond PRIVATE
102 //@endcond
103 };
104
105 /**
106 * Creates a new sent action attribute.
107 */
108 explicit SentActionAttribute();
109
110 /**
111 * Destroys the sent action attribute.
112 */
114
115 /**
116 * Adds a new action to the attribute.
117 *
118 * @param type The type of the action that shall be executed.
119 * @param value The action specific argument.
120 */
121 void addAction(Action::Type type, const QVariant &value);
122
123 /**
124 * Returns the list of actions.
125 */
126 [[nodiscard]] Action::List actions() const;
127
128 /* reimpl */
129 SentActionAttribute *clone() const override;
130 [[nodiscard]] QByteArray type() const override;
131 [[nodiscard]] QByteArray serialized() const override;
132 void deserialize(const QByteArray &data) override;
133
134private:
135 //@cond PRIVATE
136 std::unique_ptr<SentActionAttributePrivate> const d;
137 //@endcond
138};
139}
140Q_DECLARE_TYPEINFO(Akonadi::SentActionAttribute::Action, Q_RELOCATABLE_TYPE);
Action(const Action &other)
Creates an action from an other action.
@ MarkAsReplied
The message will be marked as replied.
An Attribute that stores the action to execute after sending.
~SentActionAttribute() override
Destroys the sent action attribute.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:55:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.