1/*
2 This file is part of the kcalcore library.
3
4 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22/**
23 @file
24 This file is part of the API for handling calendar data and
25 defines the Journal class.
26
27 @author Cornelius Schumacher \<schumacher@kde.org\>
28 @author Reinhold Kainhofer \<reinhold@kainhofer.com\>
29*/
30#ifndef KCALCORE_JOURNAL_H
31#define KCALCORE_JOURNAL_H
32
33#include "kcalcore_export.h"
34#include "incidence.h"
35#include "supertrait.h"
36
37namespace KCalCore {
38
39/**
40 @brief
41 Provides a Journal in the sense of RFC2445.
42*/
43class KCALCORE_EXPORT Journal : public Incidence
44{
45public:
46 /**
47 A shared pointer to a Journal object.
48 */
49 typedef QSharedPointer<Journal> Ptr;
50
51 /**
52 List of journals.
53 */
54 typedef QVector<Ptr> List;
55
56 /**
57 Constructs an empty journal.
58 */
59 Journal();
60
61 /**
62 Destroys a journal.
63 */
64 ~Journal();
65
66 /**
67 @copydoc
68 IncidenceBase::type()
69 */
70 IncidenceType type() const;
71
72 /**
73 @copydoc
74 IncidenceBase::typeStr()
75 */
76 QByteArray typeStr() const;
77
78 /**
79 Returns an exact copy of this journal. The returned object is owned
80 by the caller.
81 */
82 Journal *clone() const;
83
84 /**
85 @copydoc
86 IncidenceBase::dateTime(DateTimeRole)const
87 */
88 KDateTime dateTime(DateTimeRole role) const;
89
90 /**
91 @copydoc
92 IncidenceBase::setDateTime(const KDateTime &, DateTimeRole )
93 */
94 void setDateTime(const KDateTime &dateTime, DateTimeRole role);
95
96 /**
97 @copydoc
98 IncidenceBase::mimeType()
99 */
100 QLatin1String mimeType() const;
101
102 /**
103 @copydoc
104 Incidence::iconName()
105 */
106 QLatin1String iconName(const KDateTime &recurrenceId = KDateTime()) const;
107
108 /**
109 Returns the Akonadi specific sub MIME type of a KCalCore::Journal.
110 */
111 static QLatin1String journalMimeType();
112
113protected:
114 /**
115 Compare this with @p journal for equality.
116
117 @param journal is the journal to compare.
118 */
119 bool equals(const IncidenceBase &journal) const;
120
121 /**
122 @copydoc
123 IncidenceBase::assign()
124 */
125 virtual IncidenceBase &assign(const IncidenceBase &other);
126
127 /**
128 @copydoc
129 IncidenceBase::virtual_hook()
130 */
131 virtual void virtual_hook(int id, void *data);
132
133private:
134 /**
135 @copydoc
136 IncidenceBase::accept(Visitor &, IncidenceBase::Ptr)
137 */
138 bool accept(Visitor &v, IncidenceBase::Ptr incidence);
139
140 /**
141 Disabled, otherwise could be dangerous if you subclass Journal.
142 Use IncidenceBase::operator= which is safe because it calls
143 virtual function assign().
144 @param other is another Journal object to assign to this one.
145 */
146 Journal &operator=(const Journal &other);
147
148 // For polymorfic serialization
149 void serialize(QDataStream &out);
150 void deserialize(QDataStream &in);
151
152 //@cond PRIVATE
153 class Private;
154 Private *const d;
155 //@endcond
156};
157
158
159} // namespace KCalCore
160
161//@cond PRIVATE
162Q_DECLARE_TYPEINFO(KCalCore::Journal::Ptr, Q_MOVABLE_TYPE);
163Q_DECLARE_METATYPE(KCalCore::Journal::Ptr)
164//@endcond
165
166//@cond PRIVATE
167namespace KPIMUtils {
168// super class trait specialization
169template <> struct SuperClass<KCalCore::Journal> : public SuperClassTrait<KCalCore::Incidence> {};
170}
171//@endcond
172
173#endif
174