Akonadi

tagmodel.h
1 /*
2  SPDX-FileCopyrightText: 2014 Daniel Vr├ítil <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QAbstractItemModel>
10 
11 #include "akonadicore_export.h"
12 #include "tag.h"
13 
14 #include <memory>
15 
16 namespace Akonadi
17 {
18 class Monitor;
19 class TagModelPrivate;
20 
21 class AKONADICORE_EXPORT TagModel : public QAbstractItemModel
22 {
23  Q_OBJECT
24 
25 public:
26  enum Roles {
27  IdRole = Qt::UserRole + 1,
28  NameRole,
29  TypeRole,
30  GIDRole,
31  ParentRole,
32  TagRole,
33 
34  UserRole = Qt::UserRole + 500,
35  TerminalUserRole = 2000,
36  EndRole = 65535
37  };
38 
39  explicit TagModel(Monitor *recorder, QObject *parent = nullptr);
40  ~TagModel() override;
41 
42  Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override;
43  Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44 
45  Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role) const override;
46  Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
47 
48  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
49  /*
50  virtual Qt::DropActions supportedDropActions() const;
51  virtual QMimeData* mimeData( const QModelIndexList &indexes ) const;
52  virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
53  */
54 
55  Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &child) const override;
56  Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
57 
58 protected:
59  Q_DECLARE_PRIVATE(TagModel)
60  std::unique_ptr<TagModelPrivate> const d_ptr;
61 
62  TagModel(Monitor *recorder, TagModelPrivate *dd, QObject *parent);
63 
64 Q_SIGNALS:
65  void populated();
66 
67 private:
68  bool insertRows(int row, int count, const QModelIndex &index = QModelIndex()) override;
69  bool insertColumns(int column, int count, const QModelIndex &index = QModelIndex()) override;
70  bool removeColumns(int column, int count, const QModelIndex &index = QModelIndex()) override;
71  bool removeRows(int row, int count, const QModelIndex &index = QModelIndex()) override;
72  // Used by FakeAkonadiServerCommand::connectForwardingSignals (tagmodeltest)
73  Q_PRIVATE_SLOT(d_func(), void tagsFetched(const Akonadi::Tag::List &tags))
74  Q_PRIVATE_SLOT(d_func(), void monitoredTagAdded(const Akonadi::Tag &tag))
75  Q_PRIVATE_SLOT(d_func(), void monitoredTagRemoved(const Akonadi::Tag &tag))
76  Q_PRIVATE_SLOT(d_func(), void monitoredTagChanged(const Akonadi::Tag &tag))
77 };
78 }
79 
UserRole
An Akonadi Tag.
Definition: tag.h:25
typedef ItemFlags
Orientation
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.