transporttype.h 2.78 KB
Newer Older
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
/*
    Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>

    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 MAILTRANSPORT_TRANSPORTTYPE_H
#define MAILTRANSPORT_TRANSPORTTYPE_H

#include "mailtransport_export.h"
#include "transport.h"

Laurent Montel's avatar
Laurent Montel committed
26
#include <QString>
27

Laurent Montel's avatar
Laurent Montel committed
28
namespace MailTransport {
29 30 31 32
class AddTransportDialog;
class TransportManager;

/**
33
  @short A representation of a transport type.
34

Laurent Montel's avatar
Laurent Montel committed
35
  Represents an available transport type.  SMTP is available
36 37 38 39 40

  All available transport types can be retrieved via TransportManager::types().

  @author Constantin Berzan <exit3219@gmail.com>
  @since 4.4
41 42 43
*/
class MAILTRANSPORT_EXPORT TransportType
{
Laurent Montel's avatar
Laurent Montel committed
44 45 46 47
    friend class AddTransportDialog;
    friend class Transport;
    friend class TransportManager;
    friend class TransportManagerPrivate;
48

Laurent Montel's avatar
Laurent Montel committed
49
public:
50 51 52
    /**
      Describes a list of transport types.
    */
Laurent Montel's avatar
Laurent Montel committed
53
    typedef QVector<TransportType> List;
54

55 56 57
    /**
      Constructs a new TransportType.
    */
58
    TransportType();
59 60 61 62

    /**
      Creates a copy of the @p other TransportType.
    */
Laurent Montel's avatar
Laurent Montel committed
63
    TransportType(const TransportType &other);
64 65 66 67

    /**
      Destroys the TransportType.
    */
68
    ~TransportType();
69 70

    /**
Tobias Koenig's avatar
Tobias Koenig committed
71 72
     * Replaces the transport type by the @p other.
     */
Laurent Montel's avatar
Laurent Montel committed
73
    TransportType &operator=(const TransportType &other);
74

75
    /**
Tobias Koenig's avatar
Tobias Koenig committed
76 77
     * Compares the transport type with the @p other.
     */
Laurent Montel's avatar
Laurent Montel committed
78
    bool operator==(const TransportType &other) const;
79

80 81 82
    /**
      Returns whether the transport type is valid.
    */
83 84
    bool isValid() const;

85 86 87
    /**
      Returns the i18n'ed name of the transport type.
    */
88
    QString name() const;
89 90 91 92

    /**
      Returns a description of the transport type.
    */
93 94
    QString description() const;

95 96 97 98 99
    /**
     * Returns a plugin identifier
     */
    QString identifier() const;

100 101
    bool isAkonadiResource() const;

Laurent Montel's avatar
Laurent Montel committed
102
private:
Tobias Koenig's avatar
Tobias Koenig committed
103
    //@cond PRIVATE
104 105
    class Private;
    QSharedDataPointer<Private> d;
Tobias Koenig's avatar
Tobias Koenig committed
106
    //@endcond
107
};
108
} // namespace MailTransport
109

Laurent Montel's avatar
Laurent Montel committed
110
Q_DECLARE_METATYPE(MailTransport::TransportType)
Laurent Montel's avatar
Laurent Montel committed
111
Q_DECLARE_TYPEINFO(MailTransport::TransportType, Q_MOVABLE_TYPE);
112

113
#endif // MAILTRANSPORT_TRANSPORTTYPE_H