Akonadi Mime

dispatchmodeattribute.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 <QDateTime>
12
13#include <Akonadi/Attribute>
14
15#include <memory>
16
17namespace Akonadi
18{
19class DispatchModeAttributePrivate;
20
21/**
22 Attribute determining how and when a message from the outbox should be
23 dispatched. Messages can be sent immediately, sent only when the user
24 explicitly requests it, or sent automatically at a certain date and time.
25
26 @author Constantin Berzan <exit3219@gmail.com>
27 @since 4.4
28*/
29class AKONADI_MIME_EXPORT DispatchModeAttribute : public Akonadi::Attribute
30{
31public:
32 /**
33 Determines how the message is sent.
34 */
36 Automatic, ///< Send message as soon as possible, but no earlier than
37 /// specified by setSendAfter()
38 Manual ///< Send message only when the user requests so.
39 };
40
41 /**
42 Creates a new DispatchModeAttribute.
43 */
44 explicit DispatchModeAttribute(DispatchMode mode = Automatic);
45
46 /**
47 Destroys the DispatchModeAttribute.
48 */
50
51 /* reimpl */
52 DispatchModeAttribute *clone() const override;
53 [[nodiscard]] QByteArray type() const override;
54 [[nodiscard]] QByteArray serialized() const override;
55 void deserialize(const QByteArray &data) override;
56
57 /**
58 Returns the dispatch mode for the message.
59 @see DispatchMode.
60 */
61 [[nodiscard]] DispatchMode dispatchMode() const;
62
63 /**
64 Sets the dispatch mode for the message.
65 @param mode the dispatch mode to set
66 @see DispatchMode.
67 */
69
70 /**
71 Returns the date and time when the message should be sent.
72 Only valid if dispatchMode() is Automatic.
73 */
74 [[nodiscard]] QDateTime sendAfter() const;
75
76 /**
77 Sets the date and time when the message should be sent.
78 @param date the date and time to set
79 @see setDispatchMode.
80 */
81 void setSendAfter(const QDateTime &date);
82
83private:
84 std::unique_ptr<DispatchModeAttributePrivate> const d;
85};
86} // namespace MailTransport
Attribute determining how and when a message from the outbox should be dispatched.
QDateTime sendAfter() const
Returns the date and time when the message should be sent.
DispatchMode dispatchMode() const
Returns the dispatch mode for the message.
void setDispatchMode(DispatchMode mode)
Sets the dispatch mode for the message.
~DispatchModeAttribute() override
Destroys the DispatchModeAttribute.
DispatchMode
Determines how the message is sent.
@ Manual
specified by setSendAfter()
@ Automatic
Send message as soon as possible, but no earlier than.
void setSendAfter(const QDateTime &date)
Sets the date and time when the message should be sent.
DispatchModeAttribute(DispatchMode mode=Automatic)
Creates a new DispatchModeAttribute.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:08:39 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.