testobjecttreesource.h 3.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
  Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
  Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>

  This library is free software; you can redistribute it and/or modify it
  under the terms of the GNU Library General Public License as published by
  the Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.

  This library is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
  License for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; see the file COPYING.LIB.  If not, write to the
  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  02110-1301, USA.
*/

#ifndef MESSAGECORE_TESTS_UTIL_H
#define MESSAGECORE_TESTS_UTIL_H

24
#include <MessageViewer/ObjectTreeEmptySource>
Sandro Knauß's avatar
Sandro Knauß committed
25
#include <MessageViewer/CSSHelperBase>
26
#include <MimeTreeParser/AttachmentStrategy>
27

28
class TestObjectTreeSource : public MessageViewer::EmptySource
29 30
{
public:
Laurent Montel's avatar
Laurent Montel committed
31
    TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer, MessageViewer::CSSHelperBase *cssHelper)
32 33 34 35 36 37
        : mWriter(writer)
        , mCSSHelper(cssHelper)
        , mHtmlLoadExternal(false)
    {
    }

Laurent Montel's avatar
Laurent Montel committed
38 39
    MimeTreeParser::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE
    {
40 41 42
        return mWriter;
    }

Laurent Montel's avatar
Laurent Montel committed
43 44
    MessageViewer::CSSHelperBase *cssHelper() Q_DECL_OVERRIDE
    {
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
        return mCSSHelper;
    }

    bool htmlLoadExternal() const Q_DECL_OVERRIDE
    {
        return mHtmlLoadExternal;
    }

    void setHtmlLoadExternal(bool loadExternal)
    {
        mHtmlLoadExternal = loadExternal;
    }

    bool decryptMessage() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
62

63 64 65 66
    bool showSignatureDetails() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
67 68 69

    void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) Q_DECL_OVERRIDE
    {
70
        Q_UNUSED(mode)
71
        Q_UNUSED(availableModes)
72
    }
Laurent Montel's avatar
Laurent Montel committed
73

74 75 76 77
    int levelQuote() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
78 79 80

    const QTextCodec *overrideCodec() Q_DECL_OVERRIDE
    {
Laurent Montel's avatar
Laurent Montel committed
81
        return nullptr;
82
    }
Laurent Montel's avatar
Laurent Montel committed
83 84 85

    QString createMessageHeader(KMime::Message *message) Q_DECL_OVERRIDE
    {
86 87 88
        Q_UNUSED(message);
        return QString();
    }
Laurent Montel's avatar
Laurent Montel committed
89 90 91

    const MimeTreeParser::AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE
    {
92
        return MimeTreeParser::AttachmentStrategy::smart();
93
    }
Laurent Montel's avatar
Laurent Montel committed
94

95 96 97 98
    bool autoImportKeys() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
99

100 101 102 103
    bool showEmoticons() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
104

105 106 107 108
    bool showExpandQuotesMark() const Q_DECL_OVERRIDE
    {
        return false;
    }
Laurent Montel's avatar
Laurent Montel committed
109

Laurent Montel's avatar
Laurent Montel committed
110 111
    MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE
    {
112 113
        return MimeTreeParser::Util::Html;
    }
Laurent Montel's avatar
Laurent Montel committed
114

115
private:
116
    MimeTreeParser::HtmlWriter *mWriter;
Sandro Knauß's avatar
Sandro Knauß committed
117
    MessageViewer::CSSHelperBase *mCSSHelper;
118 119 120 121
    bool mHtmlLoadExternal;
};

#endif