Akonadi

tagmodel.h
1 /*
2  Copyright (c) 2014 Daniel Vrátil <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_TAGMODEL_H
21 #define AKONADI_TAGMODEL_H
22 
23 #include <QAbstractItemModel>
24 
25 #include "akonadicore_export.h"
26 #include "tag.h"
27 
28 class KJob;
29 
30 namespace Akonadi
31 {
32 
33 class Monitor;
34 class TagModelPrivate;
35 
36 class AKONADICORE_EXPORT TagModel : public QAbstractItemModel
37 {
38  Q_OBJECT
39 
40 public:
41  enum Roles {
42  IdRole = Qt::UserRole + 1,
43  NameRole,
44  TypeRole,
45  GIDRole,
46  ParentRole,
47  TagRole,
48 
49  UserRole = Qt::UserRole + 500,
50  TerminalUserRole = 2000,
51  EndRole = 65535
52  };
53 
54  explicit TagModel(Monitor *recorder, QObject *parent = nullptr);
55  ~TagModel() override;
56 
57  Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override;
58  Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
59 
60  Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role) const override;
61  Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
62 
63  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
64  /*
65  virtual Qt::DropActions supportedDropActions() const;
66  virtual QMimeData* mimeData( const QModelIndexList &indexes ) const;
67  virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
68  */
69 
70  Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &child) const override;
71  Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
72 
73 protected:
74  Q_DECLARE_PRIVATE(TagModel)
75  TagModelPrivate *d_ptr;
76 
77  TagModel(Monitor *recorder, TagModelPrivate *dd, QObject *parent);
78 
79 Q_SIGNALS:
80  void populated();
81 
82 private:
83  bool insertRows(int row, int count, const QModelIndex &index = QModelIndex()) override;
84  bool insertColumns(int column, int count, const QModelIndex &index = QModelIndex()) override;
85  bool removeColumns(int column, int count, const QModelIndex &index = QModelIndex()) override;
86  bool removeRows(int row, int count, const QModelIndex &index = QModelIndex()) override;
87 };
88 }
89 
90 #endif // AKONADI_TAGMODEL_H
Helper integration between Akonadi and Qt.
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.