Incidenceeditor

attendeetablemodel.h
1/*
2 * SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#pragma once
8
9#include <KCalendarCore/Attendee>
10
11#include <QAbstractTableModel>
12#include <QModelIndex>
13#include <QSortFilterProxyModel>
14
15namespace IncidenceEditorNG
16{
17class AttendeeTableModel : public QAbstractTableModel
18{
20
21public:
22 enum Roles {
23 AttendeeRole = Qt::UserRole
24 };
25
26 enum Columns {
27 CuType,
28 Role,
29 FullName,
30 Name,
31 Email,
32 Available,
33 Status,
34 Response
35 };
36
37 enum AvailableStatus {
38 Unknown,
39 Free,
40 Accepted,
41 Busy,
42 Tentative
43 };
44
45 explicit AttendeeTableModel(QObject *parent = nullptr);
46
47 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
48 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
49 [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
50 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
51
52 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
53 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
54
55 bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
56 bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
57
58 bool insertAttendee(int position, const KCalendarCore::Attendee &attendee);
59
60 void setAttendees(const KCalendarCore::Attendee::List &resources);
61 [[nodiscard]] KCalendarCore::Attendee::List attendees() const;
62
63 void setKeepEmpty(bool keepEmpty);
64 [[nodiscard]] bool keepEmpty() const;
65
66 void setRemoveEmptyLines(bool removeEmptyLines);
67 [[nodiscard]] bool removeEmptyLines() const;
68
69private:
70 void addEmptyAttendee();
71
73 std::vector<AvailableStatus> mAttendeeAvailable;
74 bool mKeepEmpty = false;
75 bool mRemoveEmptyLines = false;
76};
77
78class ResourceFilterProxyModel : public QSortFilterProxyModel
79{
81public:
82 explicit ResourceFilterProxyModel(QObject *parent = nullptr);
83 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
84};
85
86class AttendeeFilterProxyModel : public QSortFilterProxyModel
87{
89public:
90 explicit AttendeeFilterProxyModel(QObject *parent = nullptr);
91 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
92};
93}
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
QObject * parent() const const
UserRole
typedef ItemFlags
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.