Messagelib

mimetreemodel.h
1 /*
2  SPDX-FileCopyrightText: 2007 Volker Krause <[email protected]>
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  Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
42  Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &index) const override;
43  Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44  Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override;
45  Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
46  Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
47  QMimeData *mimeData(const QModelIndexList &indexes) const override;
48  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
49  Q_REQUIRED_RESULT 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-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:01:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.