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

KDE's Doxygen guidelines are available online.