-rw-r--r-- | libkcal/incidencebase.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 8624786..05209e0 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -1,172 +1,174 @@ | |||
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 | ||
34 | namespace KCal { | 34 | namespace KCal { |
35 | 35 | ||
36 | typedef QValueList<QDate> DateList; | 36 | typedef QValueList<QDate> DateList; |
37 | enum IncTypeID { eventID,todoID,journalID,freebusyID }; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | This class provides the base class common to all calendar components. | 40 | This class provides the base class common to all calendar components. |
40 | */ | 41 | */ |
41 | class IncidenceBase : public CustomProperties | 42 | class IncidenceBase : public CustomProperties |
42 | { | 43 | { |
43 | public: | 44 | public: |
44 | class Observer { | 45 | class Observer { |
45 | public: | 46 | public: |
46 | virtual void incidenceUpdated( IncidenceBase * ) = 0; | 47 | virtual void incidenceUpdated( IncidenceBase * ) = 0; |
47 | }; | 48 | }; |
48 | 49 | ||
49 | IncidenceBase(); | 50 | IncidenceBase(); |
50 | IncidenceBase(const IncidenceBase &); | 51 | IncidenceBase(const IncidenceBase &); |
51 | virtual ~IncidenceBase(); | 52 | virtual ~IncidenceBase(); |
52 | 53 | ||
53 | virtual QCString type() const = 0; | 54 | virtual QCString type() const = 0; |
55 | virtual IncTypeID typeID() const = 0; | ||
54 | 56 | ||
55 | /** Set the unique id for the event */ | 57 | /** Set the unique id for the event */ |
56 | void setUid(const QString &); | 58 | void setUid(const QString &); |
57 | /** Return the unique id for the event */ | 59 | /** Return the unique id for the event */ |
58 | QString uid() const; | 60 | QString uid() const; |
59 | 61 | ||
60 | /** Sets the time the incidence was last modified. */ | 62 | /** Sets the time the incidence was last modified. */ |
61 | void setLastModified(const QDateTime &lm); | 63 | void setLastModified(const QDateTime &lm); |
62 | /** Return the time the incidence was last modified. */ | 64 | /** Return the time the incidence was last modified. */ |
63 | QDateTime lastModified() const; | 65 | QDateTime lastModified() const; |
64 | 66 | ||
65 | /** sets the organizer for the event */ | 67 | /** sets the organizer for the event */ |
66 | void setOrganizer(const QString &o); | 68 | void setOrganizer(const QString &o); |
67 | QString organizer() const; | 69 | QString organizer() const; |
68 | 70 | ||
69 | /** Set readonly status. */ | 71 | /** Set readonly status. */ |
70 | virtual void setReadOnly( bool ); | 72 | virtual void setReadOnly( bool ); |
71 | /** Return if the object is read-only. */ | 73 | /** Return if the object is read-only. */ |
72 | bool isReadOnly() const { return mReadOnly; } | 74 | bool isReadOnly() const { return mReadOnly; } |
73 | 75 | ||
74 | /** for setting the event's starting date/time with a QDateTime. */ | 76 | /** for setting the event's starting date/time with a QDateTime. */ |
75 | virtual void setDtStart(const QDateTime &dtStart); | 77 | virtual void setDtStart(const QDateTime &dtStart); |
76 | /** returns an event's starting date/time as a QDateTime. */ | 78 | /** returns an event's starting date/time as a QDateTime. */ |
77 | virtual QDateTime dtStart() const; | 79 | virtual QDateTime dtStart() const; |
78 | /** returns an event's starting time as a string formatted according to the | 80 | /** returns an event's starting time as a string formatted according to the |
79 | users locale settings */ | 81 | users locale settings */ |
80 | QString dtStartTimeStr() const; | 82 | QString dtStartTimeStr() const; |
81 | /** returns an event's starting date as a string formatted according to the | 83 | /** returns an event's starting date as a string formatted according to the |
82 | users locale settings */ | 84 | users locale settings */ |
83 | QString dtStartDateStr(bool shortfmt=true) const; | 85 | QString dtStartDateStr(bool shortfmt=true) const; |
84 | /** returns an event's starting date and time as a string formatted according | 86 | /** returns an event's starting date and time as a string formatted according |
85 | to the users locale settings */ | 87 | to the users locale settings */ |
86 | QString dtStartStr(bool shortfmt=true) const; | 88 | QString dtStartStr(bool shortfmt=true) const; |
87 | 89 | ||
88 | virtual void setDuration(int seconds); | 90 | virtual void setDuration(int seconds); |
89 | int duration() const; | 91 | int duration() const; |
90 | void setHasDuration(bool); | 92 | void setHasDuration(bool); |
91 | bool hasDuration() const; | 93 | bool hasDuration() const; |
92 | 94 | ||
93 | /** Return true or false depending on whether the incidence "floats," | 95 | /** Return true or false depending on whether the incidence "floats," |
94 | * i.e. has a date but no time attached to it. */ | 96 | * i.e. has a date but no time attached to it. */ |
95 | bool doesFloat() const; | 97 | bool doesFloat() const; |
96 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ | 98 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ |
97 | void setFloats(bool f); | 99 | void setFloats(bool f); |
98 | 100 | ||
99 | /** | 101 | /** |
100 | Add Attendee to this incidence. IncidenceBase takes ownership of the | 102 | Add Attendee to this incidence. IncidenceBase takes ownership of the |
101 | Attendee object. | 103 | Attendee object. |
102 | */ | 104 | */ |
103 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
104 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
105 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
106 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
107 | void clearAttendees(); | 109 | void clearAttendees(); |
108 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
109 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
110 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
111 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
112 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
113 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
114 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
115 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
116 | 118 | ||
117 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
118 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; | 120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; |
119 | /** Set synchronisation satus. */ | 121 | /** Set synchronisation satus. */ |
120 | void setSyncStatus(int stat); | 122 | void setSyncStatus(int stat); |
121 | /** Return synchronisation status. */ | 123 | /** Return synchronisation status. */ |
122 | int syncStatus() const; | 124 | int syncStatus() const; |
123 | 125 | ||
124 | /** Set Pilot Id. */ | 126 | /** Set Pilot Id. */ |
125 | void setPilotId(int id); | 127 | void setPilotId(int id); |
126 | /** Return Pilot Id. */ | 128 | /** Return Pilot Id. */ |
127 | int pilotId() const; | 129 | int pilotId() const; |
128 | 130 | ||
129 | void setTempSyncStat(int id); | 131 | void setTempSyncStat(int id); |
130 | int tempSyncStat() const; | 132 | int tempSyncStat() const; |
131 | void setIDStr( const QString & ); | 133 | void setIDStr( const QString & ); |
132 | QString IDStr() const; | 134 | QString IDStr() const; |
133 | void setID( const QString &, const QString & ); | 135 | void setID( const QString &, const QString & ); |
134 | QString getID( const QString & ); | 136 | QString getID( const QString & ); |
135 | void setCsum( const QString &, const QString & ); | 137 | void setCsum( const QString &, const QString & ); |
136 | QString getCsum( const QString & ); | 138 | QString getCsum( const QString & ); |
137 | void removeID(const QString &); | 139 | void removeID(const QString &); |
138 | 140 | ||
139 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
140 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
141 | void updated(); | 143 | void updated(); |
142 | 144 | ||
143 | protected: | 145 | protected: |
144 | QDateTime mDtStart; | 146 | QDateTime mDtStart; |
145 | bool mReadOnly; | 147 | bool mReadOnly; |
146 | QDateTime getEvenTime( QDateTime ); | 148 | QDateTime getEvenTime( QDateTime ); |
147 | 149 | ||
148 | private: | 150 | private: |
149 | // base components | 151 | // base components |
150 | QString mOrganizer; | 152 | QString mOrganizer; |
151 | QString mUid; | 153 | QString mUid; |
152 | QDateTime mLastModified; | 154 | QDateTime mLastModified; |
153 | QPtrList<Attendee> mAttendees; | 155 | QPtrList<Attendee> mAttendees; |
154 | 156 | ||
155 | bool mFloats; | 157 | bool mFloats; |
156 | 158 | ||
157 | int mDuration; | 159 | int mDuration; |
158 | bool mHasDuration; | 160 | bool mHasDuration; |
159 | QString mExternalId; | 161 | QString mExternalId; |
160 | int mTempSyncStat; | 162 | int mTempSyncStat; |
161 | 163 | ||
162 | // PILOT SYNCHRONIZATION STUFF | 164 | // PILOT SYNCHRONIZATION STUFF |
163 | int mPilotId; // unique id for pilot sync | 165 | int mPilotId; // unique id for pilot sync |
164 | int mSyncStatus; // status (for sync) | 166 | int mSyncStatus; // status (for sync) |
165 | 167 | ||
166 | QPtrList<Observer> mObservers; | 168 | QPtrList<Observer> mObservers; |
167 | }; | 169 | }; |
168 | 170 | ||
169 | bool operator==( const IncidenceBase&, const IncidenceBase& ); | 171 | bool operator==( const IncidenceBase&, const IncidenceBase& ); |
170 | } | 172 | } |
171 | 173 | ||
172 | #endif | 174 | #endif |