File: mdnstateattribute.h

package info (click to toggle)
libkf5mailcommon 4%3A16.04.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,636 kB
  • ctags: 3,412
  • sloc: cpp: 27,550; xml: 136; sh: 21; ansic: 5; makefile: 3
file content (121 lines) | stat: -rw-r--r-- 3,752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/******************************************************************************
 *
 *  Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>
 *  Copyright (c) 2010 KDAB
 *
 *  This library is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or (at your
 *  option) any later version.
 *
 *  This library is distributed in the hope that it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 *  License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to the
 *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *  MA, 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef MailCommon_MDNSTATEATTRIBUTE_H
#define MailCommon_MDNSTATEATTRIBUTE_H

#include "mailcommon_export.h"

#include <attribute.h>

namespace MailCommon
{

/**
 * @short An Attribute that keeps track of the MDN state of a mail message.
 *
 * Once a mail that contains a Message Disposition Notification is processed,
 * the outcome of the user action will be stored in this attribute.
 *
 * @author Leo Franchi <lfranchi@kde.org>
 * @see Akonadi::Attribute
 * @since 4.6
 */
class MAILCOMMON_EXPORT MDNStateAttribute : public Akonadi::Attribute
{
public:
    /**
     * Describes the "MDN sent" state.
     */
    enum MDNSentState {
        MDNStateUnknown, ///< The state is unknown.
        MDNNone,         ///< No MDN has been set.
        MDNIgnore,       ///< Ignore sending a MDN.
        MDNDisplayed,    ///< The message has been displayed by the UA to someone reading the recipient's mailbox.
        MDNDeleted,      ///< The message has been deleted.
        MDNDispatched,   ///< The message has been sent somewhere in some manner without necessarily having been previously displayed to the user.
        MDNProcessed,    ///< The message has been processed in some manner without being displayed to the user.
        MDNDenied,       ///< The recipient does not wish the sender to be informed of the message's disposition.
        MDNFailed        ///< A failure occurred that prevented the proper generation of an MDN.
    };

    /**
     * Creates a new MDN state attribute.
     *
     * @param state The state the attribute will have.
     */
    explicit MDNStateAttribute(const MDNSentState &state = MDNStateUnknown);

    /**
     * Creates a new MDN state attribute.
     *
     * @param state The string representation of the state the attribute will have.
     */
    explicit MDNStateAttribute(const QByteArray &state);

    /**
     * Destroys the MDN state attribute.
     */
    ~MDNStateAttribute();

    /**
     * Reimplemented from Attribute
     */
    QByteArray type() const Q_DECL_OVERRIDE;

    /**
     * Reimplemented from Attribute
     */
    MDNStateAttribute *clone() const Q_DECL_OVERRIDE;

    /**
     * Reimplemented from Attribute
     */
    QByteArray serialized() const Q_DECL_OVERRIDE;

    /**
     * Reimplemented from Attribute
     */
    void deserialize(const QByteArray &data) Q_DECL_OVERRIDE;

    /**
     * Sets the MDN @p state.
     */
    void setMDNState(const MDNSentState &state);

    /**
     * Returns the MDN state.
     */
    MDNStateAttribute::MDNSentState mdnState() const;

    bool operator==(const MDNStateAttribute &other) const;

private:
    //@cond PRIVATE
    class Private;
    Private *const d;
    //@endcond
};

}

#endif