Eventviews

timelineitem.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
4 SPDX-FileCopyrightText: 2010 Andras Mantia <andras@kdab.com>
5
6 SPDX-License-Identifier: GPL-2.0-or-later
7*/
8
9#pragma once
10
11#include <KCalendarCore/Incidence>
12
13#include <Akonadi/CollectionCalendar>
14#include <Akonadi/Item>
15
16#include <QDateTime>
17#include <QList>
18#include <QMap>
19#include <QStandardItemModel>
20
21namespace EventViews
22{
23class TimelineSubItem;
24
25class TimelineItem : public QObject
26{
28public:
29 TimelineItem(const Akonadi::CollectionCalendar::Ptr &calendar, uint index, QStandardItemModel *model, QObject *parent);
30 ~TimelineItem() override;
31
32 void insertIncidence(const Akonadi::Item &incidence, const QDateTime &start = QDateTime(), const QDateTime &end = QDateTime());
33 void removeIncidence(const Akonadi::Item &incidence);
34
35 void moveItems(const Akonadi::Item &incidence, int delta, int duration);
36
37 void setColor(const QColor &color);
38
39 [[nodiscard]] Akonadi::CollectionCalendar::Ptr calendar() const;
40
41private:
44 QStandardItemModel *const mModel;
45 QColor mColor;
46 const uint mIndex;
47};
48
49class TimelineSubItem : public QStandardItem
50{
51public:
52 TimelineSubItem(const Akonadi::Item &incidence, TimelineItem *parent);
53 ~TimelineSubItem() override;
54
55 [[nodiscard]] Akonadi::Item incidence() const
56 {
57 return mIncidence;
58 }
59
60 [[nodiscard]] QDateTime originalStart() const
61 {
62 return mStart;
63 }
64
65 void setOriginalStart(const QDateTime &dt)
66 {
67 mStart = dt;
68 }
69
70 void setStartTime(const QDateTime &dt);
71 [[nodiscard]] QDateTime startTime() const;
72
73 void setEndTime(const QDateTime &dt);
74 [[nodiscard]] QDateTime endTime() const;
75
76 [[nodiscard]] TimelineItem *parent() const
77 {
78 return mParent;
79 }
80
81 void updateToolTip();
82
83private:
84 Akonadi::Item mIncidence;
85 QDateTime mStart;
86 TimelineItem *const mParent = nullptr;
87 bool mToolTipNeedsUpdate;
88};
89}
Q_SCRIPTABLE Q_NOREPLY void start()
AKONADI_CALENDAR_EXPORT KCalendarCore::Incidence::Ptr incidence(const Akonadi::Item &item)
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.