summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.h
Unidiff
Diffstat (limited to 'libkcal/incidencebase.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 665c1f6..444d4c4 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -1,187 +1,189 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KCAL_INCIDENCEBASE_H 20#ifndef KCAL_INCIDENCEBASE_H
21#define KCAL_INCIDENCEBASE_H 21#define KCAL_INCIDENCEBASE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "attendee.h" 32#include "attendee.h"
33 33
34namespace KCal { 34namespace KCal {
35 35
36typedef QValueList<QDate> DateList; 36typedef QValueList<QDate> DateList;
37 enum IncTypeID { eventID,todoID,journalID,freebusyID }; 37 enum IncTypeID { eventID,todoID,journalID,freebusyID };
38 38
39/** 39/**
40 This class provides the base class common to all calendar components. 40 This class provides the base class common to all calendar components.
41*/ 41*/
42class IncidenceBase : public CustomProperties 42class IncidenceBase : public CustomProperties
43{ 43{
44 public: 44 public:
45 class Observer { 45 class Observer {
46 public: 46 public:
47 virtual void incidenceUpdated( IncidenceBase * ) = 0; 47 virtual void incidenceUpdated( IncidenceBase * ) = 0;
48 }; 48 };
49 49
50 IncidenceBase(); 50 IncidenceBase();
51 IncidenceBase(const IncidenceBase &); 51 IncidenceBase(const IncidenceBase &);
52 virtual ~IncidenceBase(); 52 virtual ~IncidenceBase();
53 53
54 virtual QCString type() const = 0; 54 virtual QCString type() const = 0;
55 virtual IncTypeID typeID() const = 0; 55 virtual IncTypeID typeID() const = 0;
56 56
57 /** Set the unique id for the event */ 57 /** Set the unique id for the event */
58 void setUid(const QString &); 58 void setUid(const QString &);
59 /** Return the unique id for the event */ 59 /** Return the unique id for the event */
60 QString uid() const; 60 QString uid() const;
61 61
62 /** Sets the time the incidence was last modified. */ 62 /** Sets the time the incidence was last modified. */
63 void setLastModified(const QDateTime &lm); 63 void setLastModified(const QDateTime &lm);
64 /** Return the time the incidence was last modified. */ 64 /** Return the time the incidence was last modified. */
65 QDateTime lastModified() const; 65 QDateTime lastModified() const;
66 QString lastModifiedSortKey() const;
66 67
67 /** sets the organizer for the event */ 68 /** sets the organizer for the event */
68 void setOrganizer(const QString &o); 69 void setOrganizer(const QString &o);
69 QString organizer() const; 70 QString organizer() const;
70 71
71 /** Set readonly status. */ 72 /** Set readonly status. */
72 virtual void setReadOnly( bool ); 73 virtual void setReadOnly( bool );
73 /** Return if the object is read-only. */ 74 /** Return if the object is read-only. */
74 bool isReadOnly() const { return mReadOnly; } 75 bool isReadOnly() const { return mReadOnly; }
75 76
76 /** for setting the event's starting date/time with a QDateTime. */ 77 /** for setting the event's starting date/time with a QDateTime. */
77 virtual void setDtStart(const QDateTime &dtStart); 78 virtual void setDtStart(const QDateTime &dtStart);
78 /** returns an event's starting date/time as a QDateTime. */ 79 /** returns an event's starting date/time as a QDateTime. */
79 virtual QDateTime dtStart() const; 80 virtual QDateTime dtStart() const;
80 /** returns an event's starting time as a string formatted according to the 81 /** returns an event's starting time as a string formatted according to the
81 users locale settings */ 82 users locale settings */
82 QString dtStartTimeStr() const; 83 QString dtStartTimeStr() const;
83 /** returns an event's starting date as a string formatted according to the 84 /** returns an event's starting date as a string formatted according to the
84 users locale settings */ 85 users locale settings */
85 QString dtStartDateStr(bool shortfmt=true) const; 86 QString dtStartDateStr(bool shortfmt=true) const;
86 /** returns an event's starting date and time as a string formatted according 87 /** returns an event's starting date and time as a string formatted according
87 to the users locale settings */ 88 to the users locale settings */
88 QString dtStartStr(bool shortfmt=true) const; 89 QString dtStartStr(bool shortfmt=true) const;
89 90
90 virtual void setDuration(int seconds); 91 virtual void setDuration(int seconds);
91 int duration() const; 92 int duration() const;
92 void setHasDuration(bool); 93 void setHasDuration(bool);
93 bool hasDuration() const; 94 bool hasDuration() const;
94 95
95 /** Return true or false depending on whether the incidence "floats," 96 /** Return true or false depending on whether the incidence "floats,"
96 * i.e. has a date but no time attached to it. */ 97 * i.e. has a date but no time attached to it. */
97 bool doesFloat() const; 98 bool doesFloat() const;
98 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ 99 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */
99 void setFloats(bool f); 100 void setFloats(bool f);
100 101
101 /** 102 /**
102 Add Attendee to this incidence. IncidenceBase takes ownership of the 103 Add Attendee to this incidence. IncidenceBase takes ownership of the
103 Attendee object. 104 Attendee object.
104 */ 105 */
105 bool addAttendee(Attendee *a, bool doupdate=true ); 106 bool addAttendee(Attendee *a, bool doupdate=true );
106// void removeAttendee(Attendee *a); 107// void removeAttendee(Attendee *a);
107// void removeAttendee(const char *n); 108// void removeAttendee(const char *n);
108 /** Remove all Attendees. */ 109 /** Remove all Attendees. */
109 void clearAttendees(); 110 void clearAttendees();
110 /** Return list of attendees. */ 111 /** Return list of attendees. */
111 QPtrList<Attendee> attendees() const { return mAttendees; }; 112 QPtrList<Attendee> attendees() const { return mAttendees; };
112 /** Return number of attendees. */ 113 /** Return number of attendees. */
113 int attendeeCount() const { return mAttendees.count(); }; 114 int attendeeCount() const { return mAttendees.count(); };
114 /** Return the Attendee with this email */ 115 /** Return the Attendee with this email */
115 Attendee* attendeeByMail(const QString &); 116 Attendee* attendeeByMail(const QString &);
116 /** Return first Attendee with one of this emails */ 117 /** Return first Attendee with one of this emails */
117 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); 118 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null);
118 119
119 /** pilot syncronization states */ 120 /** pilot syncronization states */
120 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; 121 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
121 /** Set synchronisation satus. */ 122 /** Set synchronisation satus. */
122 void setSyncStatus(int stat); 123 void setSyncStatus(int stat);
123 /** Return synchronisation status. */ 124 /** Return synchronisation status. */
124 int syncStatus() const; 125 int syncStatus() const;
125 126
126 /** Set Pilot Id. */ 127 /** Set Pilot Id. */
127 void setPilotId(int id); 128 void setPilotId(int id);
128 /** Return Pilot Id. */ 129 /** Return Pilot Id. */
129 int pilotId() const; 130 int pilotId() const;
130 131
131 void setTempSyncStat(int id); 132 void setTempSyncStat(int id);
132 int tempSyncStat() const; 133 int tempSyncStat() const;
133 void setIDStr( const QString & ); 134 void setIDStr( const QString & );
134 QString IDStr() const; 135 QString IDStr() const;
135 void setID( const QString &, const QString & ); 136 void setID( const QString &, const QString & );
136 QString getID( const QString & ); 137 QString getID( const QString & );
137 void setCsum( const QString &, const QString & ); 138 void setCsum( const QString &, const QString & );
138 QString getCsum( const QString & ); 139 QString getCsum( const QString & );
139 void removeID(const QString &); 140 void removeID(const QString &);
140 141
141 void registerObserver( Observer * ); 142 void registerObserver( Observer * );
142 void unRegisterObserver( Observer * ); 143 void unRegisterObserver( Observer * );
143 void updated(); 144 void updated();
144 void setCalID( int id ); 145 void setCalID( int id );
145 int calID() const; 146 int calID() const;
146 void setCalEnabled( bool ); 147 void setCalEnabled( bool );
147 bool calEnabled() const; 148 bool calEnabled() const;
148 void setAlarmEnabled( bool ); 149 void setAlarmEnabled( bool );
149 bool alarmEnabled() const; 150 bool alarmEnabled() const;
150 bool isTagged() const; 151 bool isTagged() const;
151 void setTagged( bool ); 152 void setTagged( bool );
152 virtual void setLastModifiedSubInvalid(); 153 virtual void setLastModifiedSubInvalid();
153 protected: 154 protected:
154 bool blockLastModified; 155 bool blockLastModified;
155 bool mIsTagged; 156 bool mIsTagged;
156 QDateTime mDtStart; 157 QDateTime mDtStart;
157 bool mReadOnly; 158 bool mReadOnly;
158 QDateTime getEvenTime( QDateTime ); 159 QDateTime getEvenTime( QDateTime );
159 160
160 private: 161 private:
161 // base components 162 // base components
162 QString mOrganizer; 163 QString mOrganizer;
164 QString mLastModifiedKey;
163 QString mUid; 165 QString mUid;
164 int mCalID; 166 int mCalID;
165 bool mCalEnabled; 167 bool mCalEnabled;
166 bool mAlarmEnabled; 168 bool mAlarmEnabled;
167 QDateTime mLastModified; 169 QDateTime mLastModified;
168 QPtrList<Attendee> mAttendees; 170 QPtrList<Attendee> mAttendees;
169 171
170 bool mFloats; 172 bool mFloats;
171 173
172 int mDuration; 174 int mDuration;
173 bool mHasDuration; 175 bool mHasDuration;
174 QString mExternalId; 176 QString mExternalId;
175 int mTempSyncStat; 177 int mTempSyncStat;
176 178
177 // PILOT SYNCHRONIZATION STUFF 179 // PILOT SYNCHRONIZATION STUFF
178 int mPilotId; // unique id for pilot sync 180 int mPilotId; // unique id for pilot sync
179 int mSyncStatus; // status (for sync) 181 int mSyncStatus; // status (for sync)
180 182
181 QPtrList<Observer> mObservers; 183 QPtrList<Observer> mObservers;
182}; 184};
183 185
184bool operator==( const IncidenceBase&, const IncidenceBase& ); 186bool operator==( const IncidenceBase&, const IncidenceBase& );
185} 187}
186 188
187#endif 189#endif