1/*
2 Copyright (c) 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_TRANSPORTTYPE_H
21#define MAILTRANSPORT_TRANSPORTTYPE_H
22
23#include "mailtransport_export.h"
24#include "transport.h"
25
26#include <QtCore/QString>
27
28#include <akonadi/agenttype.h>
29
30namespace MailTransport {
31
32class AddTransportDialog;
33class TransportManager;
34
35/**
36 @short A representation of a transport type.
37
38 Represents an available transport type. SMTP and Sendmail are available,
39 as well as a number of Akonadi-based types. Each Akonadi-based type
40 corresponds to an Akonadi resource type that supports sending messages.
41
42 This class provides information about the type, such as name and
43 description. Additionally, for Akonadi types, it provides the corresponding
44 Akonadi AgentType.
45
46 All available transport types can be retrieved via TransportManager::types().
47
48 @author Constantin Berzan <exit3219@gmail.com>
49 @since 4.4
50*/
51class MAILTRANSPORT_EXPORT TransportType
52{
53 friend class AddTransportDialog;
54 friend class Transport;
55 friend class TransportManager;
56 friend class TransportManagerPrivate;
57
58 public:
59 /**
60 Describes a list of transport types.
61 */
62 typedef QList<TransportType> List;
63
64 /**
65 Constructs a new TransportType.
66 */
67 TransportType();
68
69 /**
70 Creates a copy of the @p other TransportType.
71 */
72 TransportType( const TransportType &other );
73
74 /**
75 Destroys the TransportType.
76 */
77 ~TransportType();
78
79 /**
80 * Replaces the transport type by the @p other.
81 */
82 TransportType &operator=( const TransportType &other );
83
84 /**
85 * Compares the transport type with the @p other.
86 */
87 bool operator==( const TransportType &other ) const;
88
89 /**
90 Returns whether the transport type is valid.
91 */
92 bool isValid() const;
93
94 /**
95 @internal
96 Returns the type of the transport.
97 */
98 TransportBase::EnumType::type type() const;
99
100 /**
101 Returns the i18n'ed name of the transport type.
102 */
103 QString name() const;
104
105 /**
106 Returns a description of the transport type.
107 */
108 QString description() const;
109
110 /**
111 Returns the corresponding Akonadi::AgentType that this transport type
112 represents. Only valid if type() is Transport::EnumType::Akonadi.
113 */
114 Akonadi::AgentType agentType() const;
115
116 private:
117 //@cond PRIVATE
118 class Private;
119 QSharedDataPointer<Private> d;
120 //@endcond
121};
122
123} // namespace MailTransport
124
125Q_DECLARE_METATYPE( MailTransport::TransportType )
126
127#endif // MAILTRANSPORT_TRANSPORTTYPE_H
128