File indexing completed on 2024-06-23 05:18:34

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 "messagepart.h"
0010 
0011 #include <QStringList>
0012 
0013 #include <KMime/Headers>
0014 #include <KMime/KMimeMessage>
0015 #include <memory>
0016 namespace MessageComposer
0017 {
0018 /**
0019  * @brief The InfoPart class contains the message header.
0020  */
0021 class MESSAGECOMPOSER_EXPORT InfoPart : public MessageComposer::MessagePart
0022 {
0023     Q_OBJECT
0024 
0025     /// The email address and optionally the name of the author of the mail.
0026     Q_PROPERTY(QString from READ from WRITE setFrom NOTIFY fromChanged)
0027 
0028     /// The email address and optionally the name of the primary recipients.
0029     Q_PROPERTY(QStringList to READ to WRITE setTo NOTIFY toChanged)
0030 
0031     /// Carbon copy: The email address and optionally the name of the secondary recipients.
0032     Q_PROPERTY(QStringList cc READ cc WRITE setCc NOTIFY ccChanged)
0033 
0034     /// Blind Carbon copy: The email address and optionally the name of the secondary recipients.
0035     /// Only specified during SMTP delivery but not in the final mail delivery.
0036     Q_PROPERTY(QStringList bcc READ bcc WRITE setBcc NOTIFY bccChanged)
0037 
0038     /// Reply-To: Email address that should be used to reply to this mail.
0039     Q_PROPERTY(QStringList replyTo READ replyTo WRITE setReplyTo NOTIFY replyToChanged)
0040 
0041     /// Subject of the message.
0042     Q_PROPERTY(QString subject READ subject WRITE setSubject NOTIFY subjectChanged)
0043 
0044     /// The name of a file, to which a copy of the sent message should be appended.
0045     Q_PROPERTY(QString fcc READ fcc WRITE setFcc NOTIFY fccChanged)
0046 
0047     /// User agent of the sender.
0048     Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged)
0049 
0050     /// Set urgency of the message.
0051     Q_PROPERTY(bool urgent READ urgent WRITE setUrgent NOTIFY urgentChanged)
0052 
0053     /// In-Reply-To: Id of the message this message is a reply to.
0054     Q_PROPERTY(QString inReplyTo READ inReplyTo WRITE setInReplyTo NOTIFY inReplyToChanged)
0055 
0056 public:
0057     explicit InfoPart(QObject *parent = nullptr);
0058     ~InfoPart() override;
0059 
0060     [[nodiscard]] QString from() const;
0061     void setFrom(const QString &from);
0062     [[nodiscard]] QStringList to() const;
0063     void setTo(const QStringList &to);
0064     [[nodiscard]] QStringList cc() const;
0065     void setCc(const QStringList &cc);
0066     [[nodiscard]] QStringList bcc() const;
0067     void setBcc(const QStringList &bcc);
0068 
0069     [[nodiscard]] QStringList replyTo() const;
0070     void setReplyTo(const QStringList &replyTo);
0071 
0072     [[nodiscard]] QString subject() const;
0073     void setSubject(const QString &subject);
0074 
0075     [[nodiscard]] QString fcc() const;
0076     void setFcc(const QString &fcc);
0077 
0078     [[nodiscard]] QString userAgent() const;
0079     void setUserAgent(const QString &userAgent);
0080 
0081     [[nodiscard]] bool urgent() const;
0082     void setUrgent(bool);
0083 
0084     [[nodiscard]] QString inReplyTo() const;
0085     void setInReplyTo(const QString &inReplyTo);
0086 
0087     [[nodiscard]] QString references() const;
0088     void setReferences(const QString &references);
0089 
0090     void setExtraHeaders(const KMime::Headers::Base::List &headers);
0091     [[nodiscard]] KMime::Headers::Base::List extraHeaders() const;
0092 
0093     [[nodiscard]] int transportId() const;
0094     void setTransportId(int tid);
0095 
0096 Q_SIGNALS:
0097     void toChanged();
0098     void fromChanged();
0099     void ccChanged();
0100     void bccChanged();
0101     void replyToChanged();
0102     void subjectChanged();
0103     void urgentChanged();
0104     void userAgentChanged();
0105     void inReplyToChanged();
0106     void fccChanged();
0107 
0108 private:
0109     class InfoPartPrivate;
0110     std::unique_ptr<InfoPartPrivate> const d;
0111 };
0112 } // namespace MessageComposer