libkcal

incidencebase.h
1/*
2 This file is part of libkcal.
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#ifndef KCAL_INCIDENCEBASE_H
23#define KCAL_INCIDENCEBASE_H
24
25#include <tqdatetime.h>
26#include <tqstringlist.h>
27#include <tqvaluelist.h>
28#include <tqptrlist.h>
29
30#include "customproperties.h"
31#include "attendee.h"
32
33namespace KCal {
34
35typedef TQValueList<TQDate> DateList;
36typedef TQValueList<TQDateTime> DateTimeList;
37class Event;
38class Todo;
39class Journal;
40class FreeBusy;
41
45class LIBKCAL_EXPORT IncidenceBase : public CustomProperties
46{
47 public:
54 class Visitor
55 {
56 public:
58 virtual ~Visitor() {}
59
64 virtual bool visit(Event *) { return false; }
69 virtual bool visit(Todo *) { return false; }
74 virtual bool visit(Journal *) { return false; }
79 virtual bool visit(FreeBusy *) { return false; }
80
81 protected:
84 };
85
86 class Observer {
87 public:
88 virtual ~Observer() {}
89 virtual void incidenceUpdated( IncidenceBase * ) = 0;
90 virtual void incidenceUpdatedSilent( IncidenceBase * ) {};
91 };
92
93 IncidenceBase();
94 IncidenceBase( const IncidenceBase & );
95 virtual ~IncidenceBase();
96
97 IncidenceBase& operator=( const IncidenceBase &i );
98 bool operator==( const IncidenceBase & ) const;
99
107 virtual bool accept(Visitor &) { return false; }
108
109 virtual TQCString type() const = 0;
110
112 void setUid( const TQString & );
114 TQString uid() const;
115
117 void setLastModified( const TQDateTime &lm );
119 TQDateTime lastModified() const;
120
122 void setOrganizer( const Person &o );
123 void setOrganizer( const TQString &o );
124 Person organizer() const;
125
127 virtual void setReadOnly( bool );
129 bool isReadOnly() const { return mReadOnly; }
130
132 virtual void setDtStart( const TQDateTime &dtStart );
135 virtual TQDateTime dtStart() const;
136
142 virtual TDE_DEPRECATED TQString dtStartTimeStr() const;
143
149 virtual TDE_DEPRECATED TQString dtStartDateStr( bool shortfmt = true ) const;
155 virtual TDE_DEPRECATED TQString dtStartStr() const;
156
157 virtual void setDuration( int seconds );
158 int duration() const;
159 void setHasDuration( bool );
160 bool hasDuration() const;
161
164 bool doesFloat() const;
166 void setFloats( bool f );
167
168 //
169 // Comments
170 //
171
179 void addComment(const TQString& comment);
180
189 bool removeComment( const TQString& comment );
190
192 void clearComments();
193
195 TQStringList comments() const;
196
204 void addAttendee( Attendee *attendee, bool doUpdate = true );
208 void clearAttendees();
212 const Attendee::List &attendees() const { return mAttendees; };
216 int attendeeCount() const { return mAttendees.count(); };
220 Attendee *attendeeByMail( const TQString & ) const;
224 Attendee *attendeeByMails( const TQStringList &,
225 const TQString &email = TQString() ) const;
229 Attendee *attendeeByUid( const TQString &uid ) const;
230
234 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
238 void setSyncStatus( int status );
239 void setSyncStatusSilent( int status );
243 int syncStatus() const;
244
248 void setPilotId( unsigned long id );
252 unsigned long pilotId() const;
253
258 void registerObserver( Observer * );
262 void unRegisterObserver( Observer * );
267 void updated();
268 void updatedSilent();
269
270 protected:
275 virtual void customPropertyUpdated();
276
277 bool mReadOnly;
278
279 private:
280 // base components
281 TQDateTime mDtStart;
282 Person mOrganizer;
283 TQString mUid;
284 TQDateTime mLastModified;
285 Attendee::List mAttendees;
286 TQStringList mComments;
287
288 bool mFloats;
289
290 int mDuration;
291 bool mHasDuration;
292
293 // PILOT SYNCHRONIZATION STUFF
294 unsigned long mPilotId; // unique id for pilot sync
295 int mSyncStatus; // status (for sync)
296
297 TQPtrList<Observer> mObservers;
298
299 class Private;
300 Private *d;
301};
302
303}
304
305#endif
This class represents information related to an attendee of an event.
Definition: attendee.h:37
This class represents custom calendar properties.
This class provides an Event in the sense of RFC2445.
Definition: event.h:33
This class provides information about free/busy time of a calendar user.
Definition: freebusy.h:41
This class provides the interface for a visitor of calendar components.
Definition: incidencebase.h:55
virtual bool visit(FreeBusy *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: incidencebase.h:79
virtual bool visit(Todo *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: incidencebase.h:69
virtual bool visit(Journal *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: incidencebase.h:74
virtual bool visit(Event *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: incidencebase.h:64
Visitor()
Constructor is protected to prevent direct creation of visitor base class.
Definition: incidencebase.h:83
virtual ~Visitor()
Destruct Incidence::Visitor.
Definition: incidencebase.h:58
This class provides the base class common to all calendar components.
Definition: incidencebase.h:46
int attendeeCount() const
Return number of attendees.
const Attendee::List & attendees() const
Return list of attendees.
virtual bool accept(Visitor &)
Accept IncidenceVisitor.
bool isReadOnly() const
Return if the object is read-only.
This class provides a Journal in the sense of RFC2445.
Definition: journal.h:34
This class represents a person.
Definition: person.h:35
This class provides a Todo in the sense of RFC2445.
Definition: todo.h:32
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38