• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
journal.cpp
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
32#include "journal.h"
33#include "visitor.h"
34
35#include <KDebug>
36
37using namespace KCalCore;
38
39Journal::Journal() : d(0)
40{
41}
42
43Journal::~Journal()
44{
45}
46
47Incidence::IncidenceType Journal::type() const
48{
49 return TypeJournal;
50}
51
52QByteArray Journal::typeStr() const
53{
54 return "Journal";
55}
56
57Journal *Journal::clone() const
58{
59 return new Journal(*this);
60}
61
62IncidenceBase &Journal::assign(const IncidenceBase &other)
63{
64 Incidence::assign(other);
65 return *this;
66}
67
68bool Journal::equals(const IncidenceBase &journal) const
69{
70 return Incidence::equals(journal);
71}
72
73bool Journal::accept(Visitor &v, IncidenceBase::Ptr incidence)
74{
75 return v.visit(incidence.staticCast<Journal>());
76}
77
78KDateTime Journal::dateTime(DateTimeRole role) const
79{
80 switch (role) {
81 case RoleEnd:
82 case RoleEndTimeZone:
83 return KDateTime();
84 case RoleDisplayStart:
85 case RoleDisplayEnd:
86 return dtStart();
87 default:
88 return dtStart();
89 }
90}
91
92void Journal::setDateTime(const KDateTime &dateTime, DateTimeRole role)
93{
94 switch (role) {
95 case RoleDnD:
96 {
97 setDtStart(dateTime);
98 break;
99 }
100 default:
101 kDebug() << "Unhandled role" << role;
102 }
103}
104
105void Journal::virtual_hook(int id, void *data)
106{
107 switch (static_cast<IncidenceBase::VirtualHook>(id)) {
108 case IncidenceBase::SerializerHook:
109 serialize(*reinterpret_cast<QDataStream*>(data));
110 break;
111 case IncidenceBase::DeserializerHook:
112 deserialize(*reinterpret_cast<QDataStream*>(data));
113 break;
114 default:
115 Q_ASSERT(false);
116 }
117}
118
119QLatin1String Journal::mimeType() const
120{
121 return Journal::journalMimeType();
122}
123
124/* static */
125QLatin1String Journal::journalMimeType()
126{
127 return QLatin1String("application/x-vnd.akonadi.calendar.journal");
128}
129
130QLatin1String Journal::iconName(const KDateTime &) const
131{
132 return QLatin1String("view-pim-journal");
133}
134
135void Journal::serialize(QDataStream &out)
136{
137 Incidence::serialize(out);
138}
139
140void Journal::deserialize(QDataStream &in)
141{
142 Incidence::deserialize(in);
143}
KCalCore::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes.
Definition: incidencebase.h:110
KCalCore::IncidenceBase::IncidenceType
IncidenceType
The different types of incidences, per RFC2445.
Definition: incidencebase.h:121
KCalCore::IncidenceBase::TypeJournal
@ TypeJournal
Type is a journal.
Definition: incidencebase.h:124
KCalCore::IncidenceBase::dtStart
virtual KDateTime dtStart() const
Returns an incidence's starting date/time as a KDateTime.
Definition: incidencebase.cpp:321
KCalCore::IncidenceBase::Ptr
QSharedPointer< IncidenceBase > Ptr
A shared pointer to an IncidenceBase.
Definition: incidencebase.h:115
KCalCore::IncidenceBase::DateTimeRole
DateTimeRole
The different types of incidence date/times roles.
Definition: incidencebase.h:133
KCalCore::IncidenceBase::RoleDisplayEnd
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
Definition: incidencebase.h:143
KCalCore::IncidenceBase::RoleDnD
@ RoleDnD
Role for determining new start and end dates after a DnD.
Definition: incidencebase.h:154
KCalCore::IncidenceBase::RoleDisplayStart
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Definition: incidencebase.h:152
KCalCore::IncidenceBase::RoleEnd
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid KDateTime if the incidence does not...
Definition: incidencebase.h:141
KCalCore::IncidenceBase::RoleEndTimeZone
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
Definition: incidencebase.h:139
KCalCore::Incidence::assign
virtual IncidenceBase & assign(const IncidenceBase &other)
Provides polymorfic assignment.
Definition: incidence.cpp:218
KCalCore::Incidence::equals
virtual bool equals(const IncidenceBase &incidence) const
Compares this with Incidence incidence for equality.
Definition: incidence.cpp:231
KCalCore::Incidence::setDtStart
virtual void setDtStart(const KDateTime &dt)
Sets the incidence starting date/time.
Definition: incidence.cpp:393
KCalCore::Journal
Provides a Journal in the sense of RFC2445.
Definition: journal.h:44
KCalCore::Journal::setDateTime
void setDateTime(const KDateTime &dateTime, DateTimeRole role)
Definition: journal.cpp:92
KCalCore::Journal::~Journal
~Journal()
Destroys a journal.
Definition: journal.cpp:43
KCalCore::Journal::dateTime
KDateTime dateTime(DateTimeRole role) const
Definition: journal.cpp:78
KCalCore::Journal::assign
virtual IncidenceBase & assign(const IncidenceBase &other)
Definition: journal.cpp:62
KCalCore::Journal::equals
bool equals(const IncidenceBase &journal) const
Compare this with journal for equality.
Definition: journal.cpp:68
KCalCore::Journal::iconName
QLatin1String iconName(const KDateTime &recurrenceId=KDateTime()) const
Definition: journal.cpp:130
KCalCore::Journal::mimeType
QLatin1String mimeType() const
Definition: journal.cpp:119
KCalCore::Journal::journalMimeType
static QLatin1String journalMimeType()
Returns the Akonadi specific sub MIME type of a KCalCore::Journal.
Definition: journal.cpp:125
KCalCore::Journal::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: journal.cpp:105
KCalCore::Journal::clone
Journal * clone() const
Returns an exact copy of this journal.
Definition: journal.cpp:57
KCalCore::Journal::typeStr
QByteArray typeStr() const
Definition: journal.cpp:52
KCalCore::Journal::Journal
Journal()
Constructs an empty journal.
Definition: journal.cpp:39
KCalCore::Journal::type
IncidenceType type() const
Definition: journal.cpp:47
KCalCore::Visitor
This class provides the interface for a visitor of calendar components.
Definition: visitor.h:44
KCalCore::Visitor::visit
virtual bool visit(Event::Ptr event)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: visitor.cpp:42
journal.h
This file is part of the API for handling calendar data and defines the Journal class.
KCalCore
TODO: KDE5:
Definition: alarm.h:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal