KCalendarCore

journal.cpp
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8/**
9 @file
10 This file is part of the API for handling calendar data and
11 defines the Journal class.
12
13 @brief
14 Provides a Journal in the sense of RFC2445.
15
16 @author Cornelius Schumacher <schumacher@kde.org>
17*/
18
19#include "incidence_p.h"
20#include "journal.h"
21#include "visitor.h"
22
23#include "kcalendarcore_debug.h"
24
25using namespace KCalendarCore;
26
27//@cond PRIVATE
28class KCalendarCore::JournalPrivate : public IncidencePrivate
29{
30 bool validStatus(Incidence::Status) override;
31};
32
33bool JournalPrivate::validStatus(Incidence::Status status)
34{
35 constexpr unsigned validSet
40 return validSet & (1u << status);
41}
42
43//@endcond
44
46 : Incidence(new JournalPrivate)
47{
48}
49
51 : Incidence(other, new JournalPrivate(*(other.d_func())))
52{
53}
54
55Journal::~Journal() = default;
56
61
63{
64 return QByteArrayLiteral("Journal");
65}
66
68{
69 return new Journal(*this);
70}
71
73{
74 if (&other != this) {
75 Incidence::assign(other);
76 }
77 return *this;
78}
79
80bool Journal::equals(const IncidenceBase &journal) const
81{
82 return Incidence::equals(journal);
83}
84
85bool Journal::accept(Visitor &v, const IncidenceBase::Ptr &incidence)
86{
87 return v.visit(incidence.staticCast<Journal>());
88}
89
91{
92 switch (role) {
93 case RoleEnd:
94 case RoleEndTimeZone:
95 return QDateTime();
97 case RoleDisplayEnd:
98 return dtStart();
99 default:
100 return dtStart();
101 }
102}
103
104void Journal::setDateTime(const QDateTime &dateTime, DateTimeRole role)
105{
106 switch (role) {
107 case RoleDnD: {
109 break;
110 }
111 default:
112 qCDebug(KCALCORE_LOG) << "Unhandled role" << role;
113 }
114}
115
116void Journal::virtual_hook(VirtualHook id, void *data)
117{
118 Q_UNUSED(id);
119 Q_UNUSED(data);
120}
121
126
127/* static */
129{
130 return QLatin1String("application/x-vnd.akonadi.calendar.journal");
131}
132
134{
135 return QLatin1String("view-pim-journal");
136}
137
138void Journal::serialize(QDataStream &out) const
139{
141}
142
143void Journal::deserialize(QDataStream &in)
144{
146}
147
149{
150 return false;
151}
An abstract class that provides a common base for all calendar incidence classes.
IncidenceType
The different types of incidences, per RFC2445.
@ TypeJournal
Type is a journal.
DateTimeRole
The different types of incidence date/times roles.
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid QDateTime if the incidence does not...
@ RoleDnD
Role for determining new start and end dates after a DnD.
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition incidence.h:60
Status
The different types of overall incidence status or confirmation.
Definition incidence.h:80
@ StatusCanceled
event or to-do canceled; journal removed
Definition incidence.h:86
@ StatusFinal
journal is final
Definition incidence.h:89
@ StatusDraft
journal is draft
Definition incidence.h:88
void serialize(QDataStream &out) const override
Sub-type specific serialization.
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
bool equals(const IncidenceBase &incidence) const override
Compares this with Incidence incidence for equality.
void setDtStart(const QDateTime &dt) override
Sets the incidence starting date/time.
void deserialize(QDataStream &in) override
Sub-type specific deserialization.
Provides a Journal in the sense of RFC2445.
Definition journal.h:33
IncidenceType type() const override
Definition journal.cpp:57
QByteArray typeStr() const override
Definition journal.cpp:62
QDateTime dateTime(DateTimeRole role) const override
Definition journal.cpp:90
bool equals(const IncidenceBase &journal) const override
Compare this with journal for equality.
Definition journal.cpp:80
bool supportsGroupwareCommunication() const override
Definition journal.cpp:148
static QLatin1String journalMimeType()
Returns the Akonadi specific sub MIME type of a KCalendarCore::Journal.
Definition journal.cpp:128
void virtual_hook(VirtualHook id, void *data) override
Definition journal.cpp:116
QLatin1String iconName(const QDateTime &recurrenceId={}) const override
Definition journal.cpp:133
QLatin1String mimeType() const override
Definition journal.cpp:122
IncidenceBase & assign(const IncidenceBase &other) override
Definition journal.cpp:72
Journal * clone() const override
Returns an exact copy of this journal.
Definition journal.cpp:67
Journal()
Constructs an empty journal.
Definition journal.cpp:45
~Journal() override
Destroys a journal.
void setDateTime(const QDateTime &dateTime, DateTimeRole role) override
Definition journal.cpp:104
This class provides the interface for a visitor of calendar components.
Definition visitor.h:31
virtual bool visit(const Event::Ptr &event)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition visitor.cpp:25
Q_SCRIPTABLE CaptureState status()
This file is part of the API for handling calendar data and defines the Journal class.
Namespace for all KCalendarCore types.
Definition alarm.h:37
QSharedPointer< X > staticCast() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.