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

0001 /*
0002  * This file is part of KMail.
0003  *
0004  * SPDX-FileCopyrightText: 2010 KDAB
0005  * SPDX-FileContributor: Tobias Koenig <tokoe@kde.org>
0006  * SPDX-FileContributor: Leo Franchi <lfranchi@kde.org>
0007  *
0008  * SPDX-License-Identifier: GPL-2.0-or-later
0009  */
0010 
0011 #pragma once
0012 
0013 #include "messagecomposer_export.h"
0014 
0015 #include <KJob>
0016 
0017 #include <QStringList>
0018 
0019 namespace MessageComposer
0020 {
0021 class Composer;
0022 
0023 class EmailAddressResolveJobPrivate;
0024 /**
0025  * @short A job to resolve nicknames, distribution lists and email addresses for queued emails.
0026  */
0027 class MESSAGECOMPOSER_EXPORT EmailAddressResolveJob : public KJob
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     /**
0033      * Creates a new email address resolve job.
0034      *
0035      * @param parent The parent object.
0036      */
0037     explicit EmailAddressResolveJob(QObject *parent = nullptr);
0038 
0039     /**
0040      * Destroys the email address resolve job.
0041      */
0042     ~EmailAddressResolveJob() override;
0043 
0044     /**
0045      * Starts the job.
0046      */
0047     void start() override;
0048 
0049     /**
0050      * Sets the from address to expand.
0051      */
0052     void setFrom(const QString &from);
0053 
0054     /**
0055      * Sets the from address to expand.
0056      */
0057     void setTo(const QStringList &from);
0058 
0059     /**
0060      * Sets the from address to expand.
0061      */
0062     void setCc(const QStringList &from);
0063 
0064     /**
0065      * Sets the from address to expand.
0066      */
0067     void setBcc(const QStringList &from);
0068     /**
0069      * Sets the Reply-To address to expand.
0070      */
0071     void setReplyTo(const QStringList &replyTo);
0072 
0073     /**
0074      * Returns the expanded From field
0075      */
0076     [[nodiscard]] QString expandedFrom() const;
0077 
0078     /**
0079      * Returns the expanded To field
0080      */
0081     [[nodiscard]] QStringList expandedTo() const;
0082 
0083     /**
0084      * Returns the expanded CC field
0085      */
0086     [[nodiscard]] QStringList expandedCc() const;
0087 
0088     /**
0089      * Returns the expanded Bcc field
0090      */
0091     [[nodiscard]] QStringList expandedBcc() const;
0092 
0093     void setDefaultDomainName(const QString &domainName);
0094     /**
0095      * Returns the expanded Reply-To field
0096      */
0097     [[nodiscard]] QStringList expandedReplyTo() const;
0098 
0099 private:
0100     MESSAGECOMPOSER_NO_EXPORT void slotAliasExpansionDone(KJob *);
0101     std::unique_ptr<EmailAddressResolveJobPrivate> const d;
0102 };
0103 }