Messagelib

mimetreemodel.h
1 /*
2  SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QAbstractItemModel>
10 #include <memory>
11 namespace KMime
12 {
13 class Content;
14 }
15 
16 namespace MessageViewer
17 {
18 /**
19  A model representing the mime part tree of a message.
20 */
22 {
23  Q_OBJECT
24 
25 public:
26  enum Role {
27  ContentIndexRole = Qt::UserRole + 1,
28  ContentRole,
29  MimeTypeRole,
30  MainBodyPartRole,
31  AlternativeBodyPartRole,
32  UserRole = Qt::UserRole + 100,
33  };
34  explicit MimeTreeModel(QObject *parent = nullptr);
35  ~MimeTreeModel() override;
36 
37  void setRoot(KMime::Content *root);
38 
39  KMime::Content *root();
40 
41  [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
42  [[nodiscard]] QModelIndex parent(const QModelIndex &index) const override;
43  [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44  [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
45  [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
46  [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
47  QMimeData *mimeData(const QModelIndexList &indexes) const override;
48  [[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
49  [[nodiscard]] QStringList mimeTypes() const override;
50 
51 private:
52  class MimeTreeModelPrivate;
53  std::unique_ptr<MimeTreeModelPrivate> const d;
54 };
55 }
Q_OBJECTQ_OBJECT
UserRole
typedef ItemFlags
Orientation
A model representing the mime part tree of a message.
Definition: mimetreemodel.h:21
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:55:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.