File indexing completed on 2024-11-24 04:43:05

0001 /*
0002   This file is part of KAddressBook.
0003 
0004   SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0005   based on code from SPDX-FileCopyrightText: 2014 Clément Vannier <clement.vannier@free.fr>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <Akonadi/Item>
0013 #include <QObject>
0014 #include <QStringList>
0015 
0016 class KJob;
0017 namespace KABMailSender
0018 {
0019 class MailSenderJob : public QObject
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit MailSenderJob(const Akonadi::Item::List &listItem, QObject *parent = nullptr);
0025     ~MailSenderJob() override;
0026 
0027     void start();
0028 
0029 Q_SIGNALS:
0030     void sendMails(const QStringList &emails);
0031     void sendMailsError(const QString &error);
0032 
0033 private:
0034     void slotFetchJobFinished(KJob *job);
0035     void finishJob();
0036     void fetchItem(const Akonadi::Item &item);
0037     void fetchNextItem();
0038     const Akonadi::Item::List mListItem;
0039     Akonadi::Item::List mItemToFetch;
0040     QStringList mEmailAddresses;
0041     int mFetchJobCount = 0;
0042 };
0043 }