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_TRANSPORTATTRIBUTE_H |
21 | #define MAILTRANSPORT_TRANSPORTATTRIBUTE_H |
22 | |
23 | #include <mailtransport/mailtransport_export.h> |
24 | |
25 | #include <akonadi/attribute.h> |
26 | |
27 | namespace MailTransport { |
28 | |
29 | class Transport; |
30 | |
31 | /** |
32 | Attribute determining which transport to use for sending a message. |
33 | |
34 | @see mailtransport |
35 | @see TransportManager. |
36 | |
37 | @author Constantin Berzan <exit3219@gmail.com> |
38 | @since 4.4 |
39 | */ |
40 | class MAILTRANSPORT_EXPORT TransportAttribute : public Akonadi::Attribute |
41 | { |
42 | public: |
43 | /** |
44 | Creates a new TransportAttribute. |
45 | */ |
46 | explicit TransportAttribute( int id = -1 ); |
47 | |
48 | /** |
49 | Destroys this TransportAttribute. |
50 | */ |
51 | virtual ~TransportAttribute(); |
52 | |
53 | /* reimpl */ |
54 | virtual TransportAttribute *clone() const; |
55 | virtual QByteArray type() const; |
56 | virtual QByteArray serialized() const; |
57 | virtual void deserialize( const QByteArray &data ); |
58 | |
59 | /** |
60 | Returns the transport id to use for sending this message. |
61 | @see TransportManager. |
62 | */ |
63 | int transportId() const; |
64 | |
65 | /** |
66 | Returns the transport object corresponding to the transport id contained |
67 | in this attribute. |
68 | @see Transport. |
69 | */ |
70 | Transport *transport() const; |
71 | |
72 | /** |
73 | Sets the transport id to use for sending this message. |
74 | */ |
75 | void setTransportId( int id ); |
76 | |
77 | private: |
78 | class Private; |
79 | Private *const d; |
80 | |
81 | }; |
82 | |
83 | } // namespace MailTransport |
84 | |
85 | #endif // MAILTRANSPORT_TRANSPORTATTRIBUTE_H |
86 | |