Akonadi Calendar

todomodel.h
1/*
2 SPDX-FileCopyrightText: 2008 Thomas Thrainer <tom_t@gmx.at>
3 SPDX-FileCopyrightText: 2012 Sérgio Martins <iamsergio@gmail.com>
4
5 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
6*/
7
8#pragma once
9
10#include "akonadi-calendar_export.h"
11
12#include <Akonadi/ETMCalendar>
13#include <Akonadi/IncidenceChanger>
14#include <Akonadi/Item>
15
16#include <Akonadi/EntityTreeModel>
17#include <KCalendarCore/Todo>
18
19#include <KExtraColumnsProxyModel>
20
21#include <memory>
22
23class QMimeData;
24
25namespace Akonadi
26{
27class TodoModelPrivate;
28
29/** Expands an IncidenceTreeModel by additional columns for showing todos. */
30class AKONADI_CALENDAR_EXPORT TodoModel : public KExtraColumnsProxyModel
31{
32 Q_OBJECT
33
34public:
35 /** This enum defines all columns this model provides */
36 enum {
37 SummaryColumn = 0,
38 RecurColumn,
39 PriorityColumn,
40 PercentColumn,
41 StartDateColumn,
42 DueDateColumn,
43 CategoriesColumn,
44 DescriptionColumn,
45 CalendarColumn,
46 CompletedDateColumn,
47 ColumnCount // Just for iteration/column count purposes. Always keep at the end of enum.
48 };
49
50 /** This enum defines the user defined roles of the items in this model */
51 enum {
53 TodoPtrRole,
54 IsRichTextRole,
55 SummaryRole,
56 RecurRole,
57 PriorityRole,
58 PercentRole,
59 StartDateRole,
60 DueDateRole,
61 CategoriesRole,
62 DescriptionRole,
63 CalendarRole,
64 };
65
66 explicit TodoModel(QObject *parent = nullptr);
67
68 ~TodoModel() override;
69
70 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
71
72 void setSourceModel(QAbstractItemModel *sourceModel) override;
73
74 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
75 [[nodiscard]] QVariant extraColumnData(const QModelIndex &parent, int row, int extraColumn, int role = Qt::DisplayRole) const override;
76
77 [[nodiscard]] bool setData(const QModelIndex &index, const QVariant &value, int role) override;
78
79 [[nodiscard]] QVariant headerData(int section, Qt::Orientation, int role) const override;
80
81 AKONADI_CALENDAR_DECL_DEPRECATED_TEXT("Setting calendar is no longer necessary.")
82 void setCalendar(const Akonadi::ETMCalendar::Ptr &calendar);
83
84 void setIncidenceChanger(Akonadi::IncidenceChanger *changer);
85
86 [[nodiscard]] QMimeData *mimeData(const QModelIndexList &indexes) const override;
87
88 [[nodiscard]] bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
89
90 [[nodiscard]] QStringList mimeTypes() const override;
91
92 [[nodiscard]] Qt::DropActions supportedDropActions() const override;
93
94 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
95
96 [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
97
98Q_SIGNALS:
99 /** Emitted when dropMimeData() rejected a drop
100 * on the same item or any of its children.
101 */
103
104private:
105 friend class TodoModelPrivate;
106 std::unique_ptr<TodoModelPrivate> const d;
107};
108}
Expands an IncidenceTreeModel by additional columns for showing todos.
Definition todomodel.h:31
void dropOnSelfRejected()
Emitted when dropMimeData() rejected a drop on the same item or any of its children.
FreeBusyManager::Singleton.
DropAction
DisplayRole
typedef ItemFlags
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:10:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.