defaultrenderer_p.h 3.31 KB
Newer Older
1
/*
2
   SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org>
3

4
   SPDX-License-Identifier: LGPL-2.0-or-later
5
*/
Laurent Montel's avatar
Laurent Montel committed
6
7
#ifndef MESSAGEVIEWER_DEFAULTRENDERER_P_H
#define MESSAGEVIEWER_DEFAULTRENDERER_P_H
8
9

#include "defaultrenderer.h"
10
#include "messagepartrendererbase.h"
11
12
13

#include <MimeTreeParser/MessagePart>

Laurent Montel's avatar
Laurent Montel committed
14
namespace MessageViewer {
15
class AttachmentStrategy;
16
class MessagePartRendererFactory;
17
class CSSHelperBase;
18
class HtmlWriter;
19

20
class DefaultRendererPrivate : public RenderContext
21
{
Daniel Vrátil's avatar
Daniel Vrátil committed
22
    using RenderContext::renderWithFactory;
23
public:
24
    DefaultRendererPrivate(CSSHelperBase *cssHelper, const MessagePartRendererFactory *rendererFactory);
Laurent Montel's avatar
Laurent Montel committed
25
    ~DefaultRendererPrivate() override;
26

27
    CSSHelperBase *cssHelper() const override;
28

29
    MimeTreeParser::Interface::ObjectTreeSource *source() const;
30

31
    void renderSubParts(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *htmlWriter) override;
32

33
34
35
36
37
38
39
40
41
42
    void render(const MimeTreeParser::MessagePartList::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::MimeMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::EncapsulatedRfc822MessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::HtmlMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void renderEncrypted(const MimeTreeParser::EncryptedMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void renderSigned(const MimeTreeParser::SignedMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::SignedMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::EncryptedMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::AlternativeMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
    void render(const MimeTreeParser::CertMessagePart::Ptr &mp, HtmlWriter *htmlWriter);
Laurent Montel's avatar
Laurent Montel committed
43
    Q_REQUIRED_RESULT bool renderWithFactory(const QMetaObject *mo, const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer) override;
44
    void renderFactory(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *htmlWriter);
45

Laurent Montel's avatar
Laurent Montel committed
46
47
48
49
50
51
52
53
54
55
    Q_REQUIRED_RESULT bool isHiddenHint(const MimeTreeParser::MessagePart::Ptr &msgPart) override;
    Q_REQUIRED_RESULT MimeTreeParser::IconType displayHint(const MimeTreeParser::MessagePart::Ptr &msgPart) override;
    Q_REQUIRED_RESULT bool showEmoticons() const override;
    Q_REQUIRED_RESULT bool isPrinting() const override;
    Q_REQUIRED_RESULT bool htmlLoadExternal() const override;
    Q_REQUIRED_RESULT bool showExpandQuotesMark() const override;
    Q_REQUIRED_RESULT bool showOnlyOneMimePart() const override;
    Q_REQUIRED_RESULT bool showSignatureDetails() const override;
    Q_REQUIRED_RESULT bool showEncryptionDetails() const override;
    Q_REQUIRED_RESULT int levelQuote() const override;
56
    MimeTreeParser::MessagePart::Ptr mMsgPart;
Laurent Montel's avatar
Laurent Montel committed
57
    CSSHelperBase *mCSSHelper = nullptr;
58
59
    const MessagePartRendererFactory *mRendererFactory = nullptr;
    const AttachmentStrategy *mAttachmentStrategy = nullptr;
Laurent Montel's avatar
Laurent Montel committed
60
    std::function<QString(KMime::Message *)> mCreateMessageHeader;
61

62
63
64
    int mLevelQuote = 1;

    bool mShowEmoticons = false;
65
66
    bool mIsPrinting = false;
    bool mHtmlLoadExternal = false;
67
68
    bool mShowExpandQuotesMark = false;
    bool mShowOnlyOneMimePart = false;
69
    bool mShowSignatureDetails = false;
70
    bool mShowEncryptionDetails = false;
71
72
73
};
}
#endif