1/*
2 Copyright 2009 Constantin Berzan <exit3219@gmail.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef MAILTRANSPORT_ERRORATTRIBUTE_H
21#define MAILTRANSPORT_ERRORATTRIBUTE_H
22
23#include <mailtransport/mailtransport_export.h>
24
25#include <QtCore/QString>
26
27#include <akonadi/attribute.h>
28
29namespace MailTransport {
30
31/**
32 * @short An Attribute to mark messages that failed to be sent.
33 *
34 * This attribute contains the error message encountered.
35 *
36 * @author Constantin Berzan <exit3219@gmail.com>
37 * @since 4.4
38 */
39class MAILTRANSPORT_EXPORT ErrorAttribute : public Akonadi::Attribute
40{
41 public:
42 /**
43 * Creates a new error attribute.
44 *
45 * @param msg The i18n'ed error message.
46 */
47 explicit ErrorAttribute( const QString &msg = QString() );
48
49 /**
50 * Destroys the error attribute.
51 */
52 virtual ~ErrorAttribute();
53
54 /**
55 * Returns the i18n'ed error message.
56 */
57 QString message() const;
58
59 /**
60 * Sets the i18n'ed error message.
61 */
62 void setMessage( const QString &msg );
63
64 /* reimpl */
65 virtual ErrorAttribute *clone() const;
66 virtual QByteArray type() const;
67 virtual QByteArray serialized() const;
68 virtual void deserialize( const QByteArray &data );
69
70 private:
71 //@cond PRIVATE
72 class Private;
73 Private *const d;
74 //@endcond
75};
76
77}
78
79#endif
80