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

KDE's Doxygen guidelines are available online.