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

0001 /*  -*- c++ -*-
0002     headerstyle.h
0003 
0004     This file is part of KMail, the KDE mail client.
0005     SPDX-FileCopyrightText: 2003 Marc Mutz <mutz@kde.org>
0006 
0007     SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #pragma once
0013 
0014 #include "messageviewer_export.h"
0015 
0016 #include <Akonadi/MessageStatus>
0017 #include <KMime/Message>
0018 #include <memory.h>
0019 
0020 class QString;
0021 
0022 namespace MimeTreeParser
0023 {
0024 class NodeHelper;
0025 }
0026 
0027 namespace GrantleeTheme
0028 {
0029 class Theme;
0030 }
0031 
0032 namespace MessageViewer
0033 {
0034 class HeaderStrategy;
0035 class HeaderStylePrivate;
0036 
0037 /** This class encapsulates the visual appearance of message
0038     headers. Together with HeaderStrategy, which determines
0039     which of the headers present in the message be shown, it is
0040     responsible for the formatting of message headers.
0041 
0042     @short Encapsulates visual appearance of message headers.
0043     @author Marc Mutz <mutz@kde.org>
0044     @see HeaderStrategy
0045 **/
0046 class MESSAGEVIEWER_EXPORT HeaderStyle
0047 {
0048 protected:
0049     HeaderStyle();
0050 
0051 public:
0052     virtual ~HeaderStyle();
0053     //
0054     // Methods for handling the styles:
0055     //
0056     virtual const char *name() const = 0;
0057 
0058     //
0059     // HeaderStyle interface:
0060     //
0061     virtual QString format(KMime::Message *message) const = 0;
0062 
0063     void setHeaderStrategy(const HeaderStrategy *strategy);
0064     [[nodiscard]] const HeaderStrategy *headerStrategy() const;
0065 
0066     void setVCardName(const QString &vCardName);
0067     [[nodiscard]] QString vCardName() const;
0068 
0069     void setPrinting(bool printing);
0070     [[nodiscard]] bool isPrinting() const;
0071 
0072     void setTopLevel(bool topLevel);
0073     [[nodiscard]] bool isTopLevel() const;
0074 
0075     void setNodeHelper(MimeTreeParser::NodeHelper *nodeHelper);
0076     [[nodiscard]] MimeTreeParser::NodeHelper *nodeHelper() const;
0077 
0078     void setAllowAsync(bool allowAsync);
0079     [[nodiscard]] bool allowAsync() const;
0080 
0081     void setSourceObject(QObject *sourceObject);
0082     QObject *sourceObject() const;
0083 
0084     void setMessageStatus(Akonadi::MessageStatus status);
0085     [[nodiscard]] Akonadi::MessageStatus messageStatus() const;
0086 
0087     void setTheme(const GrantleeTheme::Theme &theme);
0088     [[nodiscard]] GrantleeTheme::Theme theme() const;
0089 
0090     [[nodiscard]] bool readOnlyMessage() const;
0091     void setReadOnlyMessage(bool readOnlyMessage);
0092 
0093     [[nodiscard]] bool showEmoticons() const;
0094     void setShowEmoticons(bool b);
0095 
0096     void setAttachmentHtml(const QString &html);
0097     [[nodiscard]] QString attachmentHtml() const;
0098 
0099 private:
0100     std::unique_ptr<HeaderStylePrivate> const d;
0101 };
0102 }