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 <QSharedDataPointer>
13 #include <QVariant>
14 #include <QVector>
15 #include <attribute.h>
16 
17 namespace MailTransport
18 {
19 /**
20  * @short An Attribute that stores the action to execute after sending.
21  *
22  * This attribute stores the action that will be executed by the mail dispatcher
23  * after a mail has successfully be sent.
24  *
25  * @author Tobias Koenig <[email protected]>
26  * @since 4.6
27  */
28 class MAILTRANSPORTAKONADI_EXPORT SentActionAttribute : public Akonadi::Attribute
29 {
30 public:
31  /**
32  * @short A sent action.
33  */
34  class MAILTRANSPORTAKONADI_EXPORT Action
35  {
36  public:
37  /**
38  * Describes the action type.
39  */
40  enum Type {
41  Invalid, ///< An invalid action.
42  MarkAsReplied, ///< The message will be marked as replied.
43  MarkAsForwarded ///< The message will be marked as forwarded.
44  };
45 
46  /**
47  * Describes a list of sent actions.
48  */
50 
51  /**
52  * Creates a new invalid action.
53  */
54  Action();
55 
56  /**
57  * Creates a new action.
58  *
59  * @param type The type of action that shall be executed.
60  * @param value The action specific argument.
61  */
62  Action(Type type, const QVariant &value);
63 
64  /**
65  * Creates an action from an @p other action.
66  */
67  Action(const Action &other);
68 
69  /**
70  * Destroys the action.
71  */
72  ~Action();
73 
74  /**
75  * Returns the type of the action.
76  */
77  Type type() const;
78 
79  /**
80  * Returns the argument value of the action.
81  */
82  QVariant value() const;
83 
84  /**
85  * @internal
86  */
87  Action &operator=(const Action &other);
88 
89  /**
90  * @internal
91  */
92  bool operator==(const Action &other) const;
93 
94  private:
95  //@cond PRIVATE
96  class Private;
98  //@endcond
99  };
100 
101  /**
102  * Creates a new sent action attribute.
103  */
104  explicit SentActionAttribute();
105 
106  /**
107  * Destroys the sent action attribute.
108  */
109  ~SentActionAttribute() override;
110 
111  /**
112  * Adds a new action to the attribute.
113  *
114  * @param type The type of the action that shall be executed.
115  * @param value The action specific argument.
116  */
117  void addAction(Action::Type type, const QVariant &value);
118 
119  /**
120  * Returns the list of actions.
121  */
122  Action::List actions() const;
123 
124  /* reimpl */
125  SentActionAttribute *clone() const override;
126  QByteArray type() const override;
127  QByteArray serialized() const override;
128  void deserialize(const QByteArray &data) override;
129 
130 private:
131  //@cond PRIVATE
132  class Private;
133  Private *const d;
134  //@endcond
135 };
136 }
137 Q_DECLARE_TYPEINFO(MailTransport::SentActionAttribute::Action, Q_MOVABLE_TYPE);
138 
An Attribute that stores the action to execute after sending.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jul 29 2021 23:19:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.