File indexing completed on 2024-10-27 04:50:49

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 #include "sendlatermanager.h"
0012 
0013 #include <Akonadi/Item>
0014 #include <Akonadi/ItemFetchScope>
0015 #include <KMime/Message>
0016 
0017 namespace MessageComposer
0018 {
0019 class SendLaterInfo;
0020 }
0021 class KJob;
0022 class SendLaterJob : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     SendLaterJob(SendLaterManager *manager, MessageComposer::SendLaterInfo *info, QObject *parent = nullptr);
0027     ~SendLaterJob() override;
0028 
0029     void start();
0030 
0031 private:
0032     void sendDone();
0033     void sendError(const QString &error, SendLaterManager::ErrorType type);
0034     void slotMessageTransfered(const Akonadi::Item::List &);
0035     void slotJobFinished(KJob *);
0036     void slotDeleteItem(KJob *);
0037     void updateAndCleanMessageBeforeSending(const KMime::Message::Ptr &msg);
0038     Akonadi::ItemFetchScope mFetchScope;
0039     SendLaterManager *const mManager;
0040     MessageComposer::SendLaterInfo *const mInfo;
0041     Akonadi::Item mItem;
0042 };