File indexing completed on 2025-03-09 04:54:12

0001 /*
0002   SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "messagecore_private_export.h"
0010 
0011 #include "attachmentloadjob.h"
0012 #include <memory>
0013 namespace KMime
0014 {
0015 class Content;
0016 }
0017 
0018 namespace MessageCore
0019 {
0020 /**
0021  * @short A job to load an attachment from a mime content.
0022  *
0023  * @author Constantin Berzan <exit3219@gmail.com>
0024  */
0025 class MESSAGECORE_TESTS_EXPORT AttachmentFromMimeContentJob : public AttachmentLoadJob
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     /**
0031      * Creates a new job.
0032      *
0033      * @param content The mime content to load the attachment from.
0034      * @param parent The parent object.
0035      */
0036     explicit AttachmentFromMimeContentJob(const KMime::Content *content, QObject *parent = nullptr);
0037 
0038     /**
0039      * Destroys the job.
0040      */
0041     ~AttachmentFromMimeContentJob() override;
0042 
0043     /**
0044      * Sets the mime @p content to load the attachment from.
0045      */
0046     void setMimeContent(const KMime::Content *content);
0047 
0048     /**
0049      * Returns the mime content to load the attachment from.
0050      */
0051     [[nodiscard]] const KMime::Content *mimeContent() const;
0052 
0053 protected Q_SLOTS:
0054     void doStart() override;
0055 
0056 private:
0057     //@cond PRIVATE
0058     class AttachmentFromMimeContentJobPrivate;
0059     std::unique_ptr<AttachmentFromMimeContentJobPrivate> const d;
0060     //@endcond
0061 };
0062 }