File indexing completed on 2025-01-19 04:46:48

0001 /*
0002   SPDX-FileCopyrightText: 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003   SPDX-FileCopyrightText: 2010 Leo Franchi <lfranchi@kde.org>
0004 
0005   SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <MessageViewer/AttachmentStrategy>
0011 #include <MessageViewer/CSSHelperBase>
0012 #include <MessageViewer/ObjectTreeEmptySource>
0013 
0014 class TestObjectTreeSource : public MessageViewer::EmptySource
0015 {
0016 public:
0017     TestObjectTreeSource(MessageViewer::HtmlWriter *writer, MessageViewer::CSSHelperBase *cssHelper)
0018         : mWriter(writer)
0019         , mCSSHelper(cssHelper)
0020         , mHtmlLoadExternal(false)
0021         , mShowSignatureDetails(false)
0022     {
0023     }
0024 
0025     MessageViewer::HtmlWriter *htmlWriter() const override
0026     {
0027         return mWriter;
0028     }
0029 
0030     MessageViewer::CSSHelperBase *cssHelper() const override
0031     {
0032         return mCSSHelper;
0033     }
0034 
0035     bool htmlLoadExternal() const override
0036     {
0037         return mHtmlLoadExternal;
0038     }
0039 
0040     void setHtmlLoadExternal(bool loadExternal)
0041     {
0042         mHtmlLoadExternal = loadExternal;
0043     }
0044 
0045     bool decryptMessage() const override
0046     {
0047         return false;
0048     }
0049 
0050     bool showSignatureDetails() const override
0051     {
0052         return mShowSignatureDetails;
0053     }
0054 
0055     void setShowSignatureDetails(bool showSignatureDetails)
0056     {
0057         mShowSignatureDetails = showSignatureDetails;
0058     }
0059 
0060     void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override
0061     {
0062         Q_UNUSED(mode)
0063         Q_UNUSED(availableModes)
0064     }
0065 
0066     int levelQuote() const override
0067     {
0068         return false;
0069     }
0070 
0071     QByteArray overrideCodecName() const override
0072     {
0073         return {};
0074     }
0075 
0076     QString createMessageHeader(KMime::Message *message) override
0077     {
0078         Q_UNUSED(message)
0079         return {};
0080     }
0081 
0082     const MessageViewer::AttachmentStrategy *attachmentStrategy() const override
0083     {
0084         return MessageViewer::AttachmentStrategy::smart();
0085     }
0086 
0087     bool autoImportKeys() const override
0088     {
0089         return false;
0090     }
0091 
0092     bool showEmoticons() const override
0093     {
0094         return false;
0095     }
0096 
0097     bool showExpandQuotesMark() const override
0098     {
0099         return false;
0100     }
0101 
0102     MimeTreeParser::Util::HtmlMode preferredMode() const override
0103     {
0104         return MimeTreeParser::Util::Html;
0105     }
0106 
0107 private:
0108     MessageViewer::HtmlWriter *mWriter = nullptr;
0109     MessageViewer::CSSHelperBase *mCSSHelper = nullptr;
0110     bool mHtmlLoadExternal;
0111     bool mShowSignatureDetails;
0112 };