/*
 * This file is part of KMail.
 *
 * Copyright (c) 2010 KDAB
 *
 * Authors: Tobias Koenig <tokoe@kde.org>
 *          Leo Franchi   <lfranchi@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef EMAILADDRESSRESOLVEJOB_H
#define EMAILADDRESSRESOLVEJOB_H

#include "messagecomposer_export.h"

#include <kjob.h>

#include <QStringList>
#include <QVariant>

namespace MessageComposer
{
class Composer;

/**
 * @short A job to resolve nicknames, distribution lists and email addresses for queued emails.
 */
class EmailAddressResolveJobPrivate;
class MESSAGECOMPOSER_EXPORT EmailAddressResolveJob : public KJob
{
    Q_OBJECT

public:
    /**
     * Creates a new email address resolve job.
     *
     * @param parent The parent object.
     */
    explicit EmailAddressResolveJob(QObject *parent = Q_NULLPTR);

    /**
     * Destroys the email address resolve job.
     */
    ~EmailAddressResolveJob();

    /**
     * Starts the job.
     */
    void start() Q_DECL_OVERRIDE;

    /**
     * Sets the from address to expand.
     */
    virtual void setFrom(const QString &from);

    /**
     * Sets the from address to expand.
     */
    virtual void setTo(const QStringList &from);

    /**
     * Sets the from address to expand.
     */
    virtual void setCc(const QStringList &from);

    /**
     * Sets the from address to expand.
     */
    virtual void setBcc(const QStringList &from);

    /**
     * Returns the expanded From field
     */
    virtual QString expandedFrom() const;

    /**
     * Returns the expanded To field
     */
    virtual QStringList expandedTo() const;

    /**
     * Returns the expanded CC field
     */
    virtual QStringList expandedCc() const;

    /**
     * Returns the expanded Bcc field
     */
    virtual QStringList expandedBcc() const;

    void setDefaultDomainName(const QString &domainName);
private Q_SLOTS:
    void slotAliasExpansionDone(KJob *);

private:
    EmailAddressResolveJobPrivate *const d;
};

}

#endif
