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

0001 /*  -*- c++ -*-
0002  *    imagecollector.h
0003  *
0004  *    This file is part of KMail, the KDE mail client.
0005  *    SPDX-FileCopyrightText: 2004 Marc Mutz <mutz@kde.org>
0006  *    SPDX-FileCopyrightText: 2011 Torgny Nyblom <nyblom@kde.org>
0007  *
0008  *    SPDX-License-Identifier: GPL-2.0-or-later
0009  */
0010 
0011 #pragma once
0012 
0013 #include "messagecore_export.h"
0014 
0015 #include <QObject>
0016 #include <memory>
0017 #include <vector>
0018 namespace KMime
0019 {
0020 class Content;
0021 }
0022 
0023 namespace MessageCore
0024 {
0025 /**
0026  * @short A helper class to collect the embedded images of a email.
0027  *
0028  * @author Marc Mutz <mutz@kde.org>
0029  * @author Torgny Nyblom <nyblom@kde.org>
0030  * @todo: Make it a simple static method?!?
0031  */
0032 class MESSAGECORE_EXPORT ImageCollector
0033 {
0034 public:
0035     /**
0036      * Creates a new image collector.
0037      */
0038     ImageCollector();
0039 
0040     /**
0041      * Destroys the image collector.
0042      */
0043     ~ImageCollector();
0044 
0045     /**
0046      * Starts collecting the images.
0047      *
0048      * @param content The email content that contains the images.
0049      */
0050     void collectImagesFrom(KMime::Content *content);
0051 
0052     /**
0053      * Returns the collected images.
0054      */
0055     [[nodiscard]] const std::vector<KMime::Content *> &images() const;
0056 
0057 private:
0058     //@cond PRIVATE
0059     class ImageCollectorPrivate;
0060     std::unique_ptr<ImageCollectorPrivate> const d;
0061 
0062     Q_DISABLE_COPY(ImageCollector)
0063     //@endcond
0064 };
0065 }