MailTransport

sentbehaviourattribute.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 "mailtransportakonadi_export.h"
10 
11 #include <Akonadi/Attribute>
12 #include <Akonadi/Collection>
13 
14 #include <memory>
15 
16 namespace MailTransport
17 {
18 class SentBehaviourAttributePrivate;
19 
20 /**
21  Attribute determining what will happen to a message after it is sent. The
22  message can be deleted from the Outbox, moved to the default sent-mail
23  collection, or moved to a custom collection.
24 
25  @author Constantin Berzan <[email protected]>
26  @since 4.4
27 */
28 class MAILTRANSPORTAKONADI_EXPORT SentBehaviourAttribute : public Akonadi::Attribute
29 {
30 public:
31  /**
32  What to do with the item in the outbox after it has been sent successfully.
33  */
35  Delete, ///< Delete the item from the outbox.
36  MoveToCollection, ///< Move the item to a custom collection.
37  MoveToDefaultSentCollection ///< Move the item to the default sent-mail collection.
38  };
39 
40  /**
41  Creates a new SentBehaviourAttribute.
42  */
43  explicit SentBehaviourAttribute(SentBehaviour beh = MoveToDefaultSentCollection,
44  const Akonadi::Collection &moveToCollection = Akonadi::Collection(-1),
45  bool sendSilently = false);
46 
47  /**
48  Destroys the SentBehaviourAttribute.
49  */
50  ~SentBehaviourAttribute() override;
51 
52  /* reimpl */
53  SentBehaviourAttribute *clone() const override;
54  QByteArray type() const override;
55  QByteArray serialized() const override;
56  void deserialize(const QByteArray &data) override;
57 
58  /**
59  Returns the sent-behaviour of the message.
60  @see SentBehaviour.
61  */
62  SentBehaviour sentBehaviour() const;
63 
64  /**
65  Sets the sent-behaviour of the message.
66  @param beh the sent-behaviour to set
67  @see SentBehaviour.
68  */
69  void setSentBehaviour(SentBehaviour beh);
70 
71  /**
72  Returns the collection to which the item should be moved after it is sent.
73  Only valid if sentBehaviour() is MoveToCollection.
74  */
75  Akonadi::Collection moveToCollection() const;
76 
77  /**
78  Sets the collection to which the item should be moved after it is sent.
79  Make sure you set the SentBehaviour to MoveToCollection first.
80  @param moveToCollection target collection for "move to" operation
81  @see setSentBehaviour.
82  */
83  void setMoveToCollection(const Akonadi::Collection &moveToCollection);
84 
85  /**
86  * Returns whether a notification should be shown after the email is sent.
87  * @since 5.4
88  */
89  bool sendSilently() const;
90 
91  /**
92  * Set whether a notification should be shown after the email is sent.
93  *
94  * Default is false.
95  *
96  * @since 5.4
97  */
98  void setSendSilently(bool sendSilently);
99 
100 private:
101  std::unique_ptr<SentBehaviourAttributePrivate> const d;
102 };
103 } // namespace MailTransport
SentBehaviour
What to do with the item in the outbox after it has been sent successfully.
@ MoveToCollection
Move the item to a custom collection.
@ Delete
Delete the item from the outbox.
Attribute determining what will happen to a message after it is sent.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 26 2022 04:07:31 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.