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 <[email protected]>
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 <[email protected]>
17 */
18 
19 #include "incidence_p.h"
20 #include "journal.h"
21 #include "visitor.h"
22 
23 #include "kcalendarcore_debug.h"
24 
25 using namespace KCalendarCore;
26 
27 //@cond PRIVATE
28 class KCalendarCore::JournalPrivate : public IncidencePrivate
29 {
30 };
31 
32 //@endcond
33 
35  : Incidence(new JournalPrivate)
36 {
37 }
38 
40  : Incidence(other, new JournalPrivate(*(other.d_func())))
41 {
42 }
43 
44 Journal::~Journal() = default;
45 
47 {
48  return TypeJournal;
49 }
50 
52 {
53  return QByteArrayLiteral("Journal");
54 }
55 
57 {
58  return new Journal(*this);
59 }
60 
62 {
63  if (&other != this) {
64  Incidence::assign(other);
65  }
66  return *this;
67 }
68 
69 bool Journal::equals(const IncidenceBase &journal) const
70 {
71  return Incidence::equals(journal);
72 }
73 
74 bool Journal::accept(Visitor &v, const IncidenceBase::Ptr &incidence)
75 {
76  return v.visit(incidence.staticCast<Journal>());
77 }
78 
80 {
81  switch (role) {
82  case RoleEnd:
83  case RoleEndTimeZone:
84  return QDateTime();
85  case RoleDisplayStart:
86  case RoleDisplayEnd:
87  return dtStart();
88  default:
89  return dtStart();
90  }
91 }
92 
93 void Journal::setDateTime(const QDateTime &dateTime, DateTimeRole role)
94 {
95  switch (role) {
96  case RoleDnD: {
98  break;
99  }
100  default:
101  qCDebug(KCALCORE_LOG) << "Unhandled role" << role;
102  }
103 }
104 
105 void Journal::virtual_hook(VirtualHook id, void *data)
106 {
107  Q_UNUSED(id);
108  Q_UNUSED(data);
109 }
110 
112 {
113  return Journal::journalMimeType();
114 }
115 
116 /* static */
118 {
119  return QLatin1String("application/x-vnd.akonadi.calendar.journal");
120 }
121 
123 {
124  return QLatin1String("view-pim-journal");
125 }
126 
127 void Journal::serialize(QDataStream &out) const
128 {
130 }
131 
132 void Journal::deserialize(QDataStream &in)
133 {
135 }
136 
138 {
139  return false;
140 }
IncidenceBase & assign(const IncidenceBase &other) override
Definition: journal.cpp:61
void serialize(QDataStream &out) const override
Sub-type specific serialization.
Definition: incidence.cpp:1197
IncidenceType type() const override
Definition: journal.cpp:46
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
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
QDateTime dateTime(DateTimeRole role) const override
Definition: journal.cpp:79
DateTimeRole
The different types of incidence date/times roles.
Namespace for all KCalendarCore types.
Definition: alarm.h:36
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:59
void virtual_hook(VirtualHook id, void *data) override
Definition: journal.cpp:105
Provides a Journal in the sense of RFC2445.
Definition: journal.h:32
Journal * clone() const override
Returns an exact copy of this journal.
Definition: journal.cpp:56
QLatin1String iconName(const QDateTime &recurrenceId={}) const override
Definition: journal.cpp:122
An abstract class that provides a common base for all calendar incidence classes.
Definition: incidencebase.h:98
QLatin1String mimeType() const override
Definition: journal.cpp:111
bool equals(const IncidenceBase &journal) const override
Compare this with journal for equality.
Definition: journal.cpp:69
Journal()
Constructs an empty journal.
Definition: journal.cpp:34
bool equals(const IncidenceBase &incidence) const override
Compares this with Incidence incidence for equality.
Definition: incidence.cpp:193
void deserialize(QDataStream &in) override
Sub-type specific deserialization.
Definition: incidence.cpp:1225
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
bool supportsGroupwareCommunication() const override
Definition: journal.cpp:137
This class provides the interface for a visitor of calendar components.
Definition: visitor.h:30
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid QDateTime if the incidence does not...
void setDtStart(const QDateTime &dt) override
Sets the incidence starting date/time.
Definition: incidence.cpp:371
static QLatin1String journalMimeType()
Returns the Akonadi specific sub MIME type of a KCalendarCore::Journal.
Definition: journal.cpp:117
IncidenceType
The different types of incidences, per RFC2445.
~Journal() override
Destroys a journal.
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
QByteArray typeStr() const override
Definition: journal.cpp:51
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
Definition: incidence.cpp:179
@ TypeJournal
Type is a journal.
@ RoleDnD
Role for determining new start and end dates after a DnD.
void setDateTime(const QDateTime &dateTime, DateTimeRole role) override
Definition: journal.cpp:93
QSharedPointer< X > staticCast() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Jun 29 2022 04:02:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.