File indexing completed on 2024-05-12 05:11:13

0001 /*
0002     SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadi-mime_export.h"
0010 
0011 #include <Akonadi/Attribute>
0012 
0013 #include <memory>
0014 
0015 namespace Akonadi
0016 {
0017 class TransportAttributePrivate;
0018 
0019 /**
0020   Attribute determining which transport to use for sending a message.
0021 
0022   @see mailtransport
0023   @see TransportManager.
0024 
0025   @author Constantin Berzan <exit3219@gmail.com>
0026   @since 4.4
0027 */
0028 class AKONADI_MIME_EXPORT TransportAttribute : public Akonadi::Attribute
0029 {
0030 public:
0031     /**
0032       Creates a new TransportAttribute.
0033     */
0034     explicit TransportAttribute(int id = -1);
0035 
0036     /**
0037       Destroys this TransportAttribute.
0038     */
0039     ~TransportAttribute() override;
0040 
0041     /* reimpl */
0042     TransportAttribute *clone() const override;
0043     QByteArray type() const override;
0044     QByteArray serialized() const override;
0045     void deserialize(const QByteArray &data) override;
0046 
0047     /**
0048       Returns the transport id to use for sending this message.
0049       @see TransportManager.
0050     */
0051     [[nodiscard]] int transportId() const;
0052 
0053     /**
0054       Sets the transport id to use for sending this message.
0055     */
0056     void setTransportId(int id);
0057 
0058 private:
0059     std::unique_ptr<TransportAttributePrivate> const d;
0060 };
0061 } // namespace MailTransport