File indexing completed on 2024-12-22 05:05:19
0001 // SPDX-FileCopyrightText: 2016 Christian Mollekopf <mollekopf@kolabsys.com> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #pragma once 0005 #include <QObject> 0006 #include <QString> 0007 0008 #include <KMime/Message> 0009 #include <QAbstractItemModel> 0010 0011 #include "mimetreeparser_core_export.h" 0012 #include "partmodel.h" 0013 #include <memory> 0014 0015 class MessagePartPrivate; 0016 class AttachmentModel; 0017 0018 class MIMETREEPARSER_CORE_EXPORT MessageParser : public QObject 0019 { 0020 Q_OBJECT 0021 Q_PROPERTY(KMime::Message::Ptr message READ message WRITE setMessage NOTIFY htmlChanged) 0022 Q_PROPERTY(PartModel *parts READ parts NOTIFY htmlChanged) 0023 Q_PROPERTY(QAbstractItemModel *attachments READ attachments NOTIFY htmlChanged) 0024 Q_PROPERTY(QString structureAsString READ structureAsString NOTIFY htmlChanged) 0025 Q_PROPERTY(bool loaded READ loaded NOTIFY htmlChanged) 0026 0027 Q_PROPERTY(QString subject READ subject NOTIFY htmlChanged) 0028 Q_PROPERTY(QString from READ from NOTIFY htmlChanged) 0029 Q_PROPERTY(QString sender READ sender NOTIFY htmlChanged) 0030 Q_PROPERTY(QString to READ to NOTIFY htmlChanged) 0031 Q_PROPERTY(QString cc READ cc NOTIFY htmlChanged) 0032 Q_PROPERTY(QString bcc READ bcc NOTIFY htmlChanged) 0033 Q_PROPERTY(QDateTime date READ date NOTIFY htmlChanged) 0034 0035 public: 0036 explicit MessageParser(QObject *parent = Q_NULLPTR); 0037 ~MessageParser(); 0038 0039 KMime::Message::Ptr message() const; 0040 void setMessage(const KMime::Message::Ptr message); 0041 PartModel *parts() const; 0042 AttachmentModel *attachments() const; 0043 QString structureAsString() const; 0044 bool loaded() const; 0045 0046 QString subject() const; 0047 QString from() const; 0048 QString sender() const; 0049 QString to() const; 0050 QString cc() const; 0051 QString bcc() const; 0052 QDateTime date() const; 0053 0054 Q_SIGNALS: 0055 void htmlChanged(); 0056 0057 private: 0058 std::unique_ptr<MessagePartPrivate> d; 0059 };