MailTransport

sentactionattribute.h
1 /*
2  SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
3  SPDX-FileContributor: Tobias Koenig <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include "mailtransportakonadi_export.h"
11 
12 #include <Akonadi/Attribute>
13 #include <QSharedDataPointer>
14 #include <QVariant>
15 #include <QVector>
16 
17 #include <memory>
18 
19 namespace MailTransport
20 {
21 class SentActionAttributePrivate;
22 class 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 <[email protected]>
31  * @since 4.6
32  */
33 class MAILTRANSPORTAKONADI_EXPORT SentActionAttribute : public Akonadi::Attribute
34 {
35 public:
36  /**
37  * @short A sent action.
38  */
39  class MAILTRANSPORTAKONADI_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  */
77  ~Action();
78 
79  /**
80  * Returns the type of the action.
81  */
82  Type type() const;
83 
84  /**
85  * Returns the argument value of the action.
86  */
87  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  */
113  ~SentActionAttribute() override;
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  Action::List actions() const;
127 
128  /* reimpl */
129  SentActionAttribute *clone() const override;
130  QByteArray type() const override;
131  QByteArray serialized() const override;
132  void deserialize(const QByteArray &data) override;
133 
134 private:
135  //@cond PRIVATE
136  std::unique_ptr<SentActionAttributePrivate> const d;
137  //@endcond
138 };
139 }
140 Q_DECLARE_TYPEINFO(MailTransport::SentActionAttribute::Action, Q_MOVABLE_TYPE);
@ MarkAsReplied
The message will be marked as replied.
An Attribute that stores the action to execute after sending.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 03:58:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.