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 #include "infopart.h"
0008 
0009 using namespace MessageComposer;
0010 
0011 class InfoPart::InfoPartPrivate
0012 {
0013 public:
0014     InfoPartPrivate() = default;
0015 
0016     KMime::Headers::Base::List extraHeaders;
0017     QStringList to;
0018     QStringList cc;
0019     QStringList bcc;
0020     QStringList replyTo;
0021     QString subject;
0022     QString from;
0023     QString fcc;
0024     QString userAgent;
0025     QString inReplyTo;
0026     QString references;
0027     int transportId = 0;
0028     bool urgent = false;
0029 };
0030 
0031 InfoPart::InfoPart(QObject *parent)
0032     : MessagePart(parent)
0033     , d(new InfoPartPrivate)
0034 {
0035 }
0036 
0037 InfoPart::~InfoPart() = default;
0038 
0039 QString InfoPart::from() const
0040 {
0041     return d->from;
0042 }
0043 
0044 void InfoPart::setFrom(const QString &from)
0045 {
0046     if (d->from == from) {
0047         return;
0048     }
0049     d->from = from;
0050     Q_EMIT fromChanged();
0051 }
0052 
0053 QStringList InfoPart::to() const
0054 {
0055     return d->to;
0056 }
0057 
0058 void InfoPart::setTo(const QStringList &to)
0059 {
0060     if (d->to == to) {
0061         return;
0062     }
0063     d->to = to;
0064     Q_EMIT toChanged();
0065 }
0066 
0067 QStringList InfoPart::cc() const
0068 {
0069     return d->cc;
0070 }
0071 
0072 void InfoPart::setCc(const QStringList &cc)
0073 {
0074     if (d->cc == cc) {
0075         return;
0076     }
0077     d->cc = cc;
0078     Q_EMIT ccChanged();
0079 }
0080 
0081 QStringList InfoPart::bcc() const
0082 {
0083     return d->bcc;
0084 }
0085 
0086 void InfoPart::setBcc(const QStringList &bcc)
0087 {
0088     if (d->bcc == bcc) {
0089         return;
0090     }
0091     d->bcc = bcc;
0092     Q_EMIT bccChanged();
0093 }
0094 
0095 QString InfoPart::subject() const
0096 {
0097     return d->subject;
0098 }
0099 
0100 void InfoPart::setSubject(const QString &subject)
0101 {
0102     if (d->subject == subject) {
0103         return;
0104     }
0105     d->subject = subject;
0106     Q_EMIT subjectChanged();
0107 }
0108 
0109 QStringList InfoPart::replyTo() const
0110 {
0111     return d->replyTo;
0112 }
0113 
0114 void InfoPart::setReplyTo(const QStringList &replyTo)
0115 {
0116     if (d->replyTo == replyTo) {
0117         return;
0118     }
0119     d->replyTo = replyTo;
0120     Q_EMIT replyToChanged();
0121 }
0122 
0123 int InfoPart::transportId() const
0124 {
0125     return d->transportId;
0126 }
0127 
0128 void InfoPart::setTransportId(int tid)
0129 {
0130     d->transportId = tid;
0131 }
0132 
0133 void InfoPart::setFcc(const QString &fcc)
0134 {
0135     if (d->fcc == fcc) {
0136         return;
0137     }
0138     d->fcc = fcc;
0139     Q_EMIT fccChanged();
0140 }
0141 
0142 QString InfoPart::fcc() const
0143 {
0144     return d->fcc;
0145 }
0146 
0147 bool InfoPart::urgent() const
0148 {
0149     return d->urgent;
0150 }
0151 
0152 void InfoPart::setUrgent(bool urgent)
0153 {
0154     if (d->urgent == urgent) {
0155         return;
0156     }
0157     d->urgent = urgent;
0158     Q_EMIT urgentChanged();
0159 }
0160 
0161 QString InfoPart::inReplyTo() const
0162 {
0163     return d->inReplyTo;
0164 }
0165 
0166 void InfoPart::setInReplyTo(const QString &inReplyTo)
0167 {
0168     if (d->inReplyTo == inReplyTo) {
0169         return;
0170     }
0171     d->inReplyTo = inReplyTo;
0172     Q_EMIT inReplyToChanged();
0173 }
0174 
0175 QString InfoPart::references() const
0176 {
0177     return d->references;
0178 }
0179 
0180 void InfoPart::setReferences(const QString &references)
0181 {
0182     d->references = references;
0183 }
0184 
0185 void InfoPart::setExtraHeaders(const KMime::Headers::Base::List &headers)
0186 {
0187     d->extraHeaders = headers;
0188 }
0189 
0190 KMime::Headers::Base::List InfoPart::extraHeaders() const
0191 {
0192     return d->extraHeaders;
0193 }
0194 
0195 QString InfoPart::userAgent() const
0196 {
0197     return d->userAgent;
0198 }
0199 
0200 void InfoPart::setUserAgent(const QString &userAgent)
0201 {
0202     if (d->userAgent == userAgent) {
0203         return;
0204     }
0205     d->userAgent = userAgent;
0206     Q_EMIT userAgentChanged();
0207 }
0208 
0209 #include "moc_infopart.cpp"