File indexing completed on 2024-12-22 05:05:21

0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl.schwan@gnupg.com>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include "mimetreeparser_widgets_export.h"
0007 
0008 #include <KMime/Message>
0009 
0010 #include <QSplitter>
0011 #include <QWidget>
0012 
0013 #include <memory>
0014 
0015 class QPainter;
0016 
0017 namespace MimeTreeParser
0018 {
0019 namespace Widgets
0020 {
0021 
0022 /// MessageViewer that displays the given KMime::Message::Ptr
0023 /// \author Carl Schwan <carl.schwan@gnupg.com>
0024 class MIMETREEPARSER_WIDGETS_EXPORT MessageViewer : public QSplitter
0025 {
0026 public:
0027     explicit MessageViewer(QWidget *parent = nullptr);
0028     ~MessageViewer() override;
0029 
0030     KMime::Message::Ptr message() const;
0031     void setMessage(const KMime::Message::Ptr message);
0032 
0033     void print(QPainter *painter, int width);
0034 
0035 private:
0036     class Private;
0037     std::unique_ptr<Private> d;
0038 };
0039 
0040 } // end namespace Widgets
0041 } // end namespace MimeTreeParser