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

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 <QString>
0012 #include <QStringList>
0013 
0014 #include <Akonadi/Attribute>
0015 
0016 #include <memory>
0017 
0018 namespace Akonadi
0019 {
0020 class AddressAttributePrivate;
0021 
0022 /**
0023   Attribute storing the From, To, Cc, Bcc addresses of a message.
0024 
0025   @author Constantin Berzan <exit3219@gmail.com>
0026   @since 4.4
0027 */
0028 class AKONADI_MIME_EXPORT AddressAttribute : public Akonadi::Attribute
0029 {
0030 public:
0031     /**
0032       Creates a new AddressAttribute.
0033     */
0034     explicit AddressAttribute(const QString &from = QString(),
0035                               const QStringList &to = QStringList(),
0036                               const QStringList &cc = QStringList(),
0037                               const QStringList &bcc = QStringList(),
0038                               bool dsn = false);
0039     /**
0040       Destroys the AddressAttribute.
0041     */
0042     ~AddressAttribute() override;
0043 
0044     /* reimpl */
0045     [[nodiscard]] AddressAttribute *clone() const override;
0046     [[nodiscard]] QByteArray type() const override;
0047     [[nodiscard]] QByteArray serialized() const override;
0048     void deserialize(const QByteArray &data) override;
0049 
0050     /**
0051       Returns the address of the sender.
0052     */
0053     [[nodiscard]] QString from() const;
0054 
0055     /**
0056       Sets the address of the sender.
0057     */
0058     void setFrom(const QString &from);
0059 
0060     /**
0061       Returns the addresses of the "To:" receivers.
0062     */
0063     [[nodiscard]] QStringList to() const;
0064 
0065     /**
0066      * Sets the addresses of the "To: "receivers."
0067      * @param to address of the receiver.
0068      */
0069     void setTo(const QStringList &to);
0070 
0071     /**
0072       Returns the addresses of the "Cc:" receivers.
0073     */
0074     [[nodiscard]] QStringList cc() const;
0075 
0076     /**
0077      * Sets the addresses of the "Cc:" receivers."
0078      * @param cc addresses of the receivers (CC)
0079      */
0080     void setCc(const QStringList &cc);
0081 
0082     /**
0083      * Returns the addresses of the "Bcc:" receivers.
0084      */
0085     [[nodiscard]] QStringList bcc() const;
0086 
0087     /**
0088      * Sets the addresses of the "Bcc:" receivers."
0089      * @param bcc addresses of the receivers (CC)
0090      */
0091     void setBcc(const QStringList &bcc);
0092 
0093     void setDeliveryStatusNotification(bool b);
0094     [[nodiscard]] bool deliveryStatusNotification() const;
0095 
0096     bool operator==(const AddressAttribute &other) const;
0097 
0098 private:
0099     std::unique_ptr<AddressAttributePrivate> const d;
0100 };
0101 } // namespace Akonadi