MailTransport

dispatchmodeattribute.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 <QDateTime>
12 
13 #include <Akonadi/Attribute>
14 
15 #include <memory>
16 
17 namespace MailTransport
18 {
19 class 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 <[email protected]>
27  @since 4.4
28 */
29 class MAILTRANSPORTAKONADI_EXPORT DispatchModeAttribute : public Akonadi::Attribute
30 {
31 public:
32  /**
33  Determines how the message is sent.
34  */
35  enum DispatchMode {
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  */
49  ~DispatchModeAttribute() override;
50 
51  /* reimpl */
52  DispatchModeAttribute *clone() const override;
53  Q_REQUIRED_RESULT QByteArray type() const override;
54  Q_REQUIRED_RESULT 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  Q_REQUIRED_RESULT 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  */
68  void setDispatchMode(DispatchMode mode);
69 
70  /**
71  Returns the date and time when the message should be sent.
72  Only valid if dispatchMode() is Automatic.
73  */
74  Q_REQUIRED_RESULT 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 
83 private:
84  std::unique_ptr<DispatchModeAttributePrivate> const d;
85 };
86 } // namespace MailTransport
DispatchMode
Determines how the message is sent.
Attribute determining how and when a message from the outbox should be dispatched.
@ Automatic
Send message as soon as possible, but no earlier than.
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.