File indexing completed on 2024-04-28 05:19:25

0001 /*
0002     ktnefmessage.h
0003 
0004     SPDX-FileCopyrightText: 2002 Michael Goffioul <kdeprint@swing.be>
0005 
0006     This file is part of KTNEF, the KDE TNEF support library/program.
0007 
0008     SPDX-License-Identifier: LGPL-2.0-or-later
0009  */
0010 /**
0011  * @file
0012  * This file is part of the API for handling TNEF data and
0013  * defines the KTNEFMessage class.
0014  *
0015  * @author Michael Goffioul
0016  */
0017 
0018 #pragma once
0019 
0020 #include <QList>
0021 
0022 #include "ktnef_export.h"
0023 #include "ktnefpropertyset.h"
0024 #include <memory>
0025 namespace KTnef
0026 {
0027 class KTNEFAttach;
0028 }
0029 
0030 namespace KTnef
0031 {
0032 /**
0033  * @brief
0034  * Represents a @acronym TNEF message.
0035  */
0036 class KTNEF_EXPORT KTNEFMessage : public KTNEFPropertySet
0037 {
0038 public:
0039     /**
0040      * Creates a KTNEFMessage message object.
0041      */
0042     KTNEFMessage();
0043 
0044     /**
0045      * Destroys a KTNEFMessage message object.
0046      */
0047     ~KTNEFMessage();
0048 
0049     /**
0050      * Return a QList containing all the message's attachments.
0051      */
0052     const QList<KTNEFAttach *> &attachmentList() const;
0053 
0054     /**
0055      * Find the attachment associated to the specified file name.
0056      *
0057      * @param filename is a QString containing the file to search for in the
0058      * list of message attachments.
0059      *
0060      * @return A pointer to KTNEFAttach object, or 0 if the search fails.
0061      */
0062     KTNEFAttach *attachment(const QString &filename) const;
0063 
0064     /**
0065      * Append an attachment to the message.
0066      * @param attach is a pointer to a KTNEFAttach object to be attached.
0067      */
0068     void addAttachment(KTNEFAttach *attach);
0069 
0070     /**
0071      * Clear the attachments list.
0072      */
0073     void clearAttachments();
0074 
0075     /**
0076      * Returns the Rich Text Format (@acronym RTF) data contained in the message.
0077      * @return A QString containing the @acronym RTF data.
0078      */
0079     [[nodiscard]] QString rtfString() const;
0080 
0081 private:
0082     //@cond PRIVATE
0083     class MessagePrivate;
0084     std::unique_ptr<MessagePrivate> const d;
0085     //@endcond
0086 
0087     Q_DISABLE_COPY(KTNEFMessage)
0088 };
0089 
0090 }