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 { ContentIndexRole = Qt::UserRole + 1, ContentRole, MimeTypeRole, MainBodyPartRole, AlternativeBodyPartRole, UserRole = Qt::UserRole + 100 };
27  explicit MimeTreeModel(QObject *parent = nullptr);
28  ~MimeTreeModel() override;
29 
30  void setRoot(KMime::Content *root);
31 
32  KMime::Content *root();
33 
34  Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
35  Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &index) const override;
36  Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
37  Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override;
38  Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
39  Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
40  QMimeData *mimeData(const QModelIndexList &indexes) const override;
41  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
42  Q_REQUIRED_RESULT QStringList mimeTypes() const override;
43 
44 private:
45  class MimeTreeModelPrivate;
46  std::unique_ptr<MimeTreeModelPrivate> const d;
47 };
48 }
49 
A model representing the mime part tree of a message.
Definition: mimetreemodel.h:21
UserRole
Orientation
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.