File indexing completed on 2025-03-16 08:11:35
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 #include <QStringList> 0008 0009 #include <Akonadi/Item> 0010 #include <QAbstractItemModel> 0011 #include <QModelIndex> 0012 0013 #include <memory> 0014 0015 class MessagePartPrivate; 0016 0017 class MessageParser : public QObject 0018 { 0019 Q_OBJECT 0020 Q_PROPERTY(Akonadi::Item item READ item WRITE setItem NOTIFY htmlChanged) 0021 Q_PROPERTY(QAbstractItemModel *parts READ parts NOTIFY htmlChanged) 0022 Q_PROPERTY(QAbstractItemModel *attachments READ attachments NOTIFY htmlChanged) 0023 Q_PROPERTY(QString rawContent READ rawContent NOTIFY htmlChanged) 0024 Q_PROPERTY(QString structureAsString READ structureAsString NOTIFY htmlChanged) 0025 Q_PROPERTY(bool loaded READ loaded NOTIFY htmlChanged) 0026 0027 public: 0028 explicit MessageParser(QObject *parent = Q_NULLPTR); 0029 ~MessageParser(); 0030 0031 Akonadi::Item item() const; 0032 void setItem(const Akonadi::Item &item); 0033 QAbstractItemModel *parts() const; 0034 QAbstractItemModel *attachments() const; 0035 QString rawContent() const; 0036 QString structureAsString() const; 0037 bool loaded() const; 0038 0039 Q_SIGNALS: 0040 void htmlChanged(); 0041 0042 private: 0043 std::unique_ptr<MessagePartPrivate> d; 0044 QString mRawContent; 0045 };