Akonadi

tagmodel.h
1/*
2 SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com>
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
16namespace Akonadi
17{
18class Monitor;
19class TagModelPrivate;
20
21class AKONADICORE_EXPORT TagModel : public QAbstractItemModel
22{
23 Q_OBJECT
24
25public:
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 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
43 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44
45 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
46 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
47
48 [[nodiscard]] 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 [[nodiscard]] QModelIndex parent(const QModelIndex &child) const override;
56 [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
57
58protected:
59 Q_DECLARE_PRIVATE(TagModel)
60 std::unique_ptr<TagModelPrivate> const d_ptr;
61
62 TagModel(Monitor *recorder, TagModelPrivate *dd, QObject *parent);
63
64Q_SIGNALS:
65 void populated();
66
67private:
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}
An Akonadi Tag.
Definition tag.h:26
Helper integration between Akonadi and Qt.
UserRole
typedef ItemFlags
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.