Akonadi Mime

sentbehaviourattribute.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 "akonadi-mime_export.h"
10
11#include <Akonadi/Attribute>
12#include <Akonadi/Collection>
13
14#include <memory>
15
16namespace Akonadi
17{
18class 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 <exit3219@gmail.com>
26 @since 4.4
27*/
28class AKONADI_MIME_EXPORT SentBehaviourAttribute : public Akonadi::Attribute
29{
30public:
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 */
51
52 /* reimpl */
53 SentBehaviourAttribute *clone() const override;
54 [[nodiscard]] QByteArray type() const override;
55 [[nodiscard]] 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 [[nodiscard]] 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 [[nodiscard]] 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 [[nodiscard]] 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
100private:
101 std::unique_ptr<SentBehaviourAttributePrivate> const d;
102};
103} // namespace MailTransport
Attribute determining what will happen to a message after it is sent.
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.
~SentBehaviourAttribute() override
Destroys the SentBehaviourAttribute.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.