-rw-r--r-- | libopie2/opiepim/oevent.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h index 9eb948f..9502efa 100644 --- a/libopie2/opiepim/oevent.h +++ b/libopie2/opiepim/oevent.h | |||
@@ -1,63 +1,92 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | // CONTAINS GPLed code of TT | 29 | // CONTAINS GPLed code of TT |
2 | 30 | ||
3 | #ifndef OPIE_PIM_EVENT_H | 31 | #ifndef OPIE_PIM_EVENT_H |
4 | #define OPIE_PIM_EVENT_H | 32 | #define OPIE_PIM_EVENT_H |
5 | 33 | ||
6 | #include <qstring.h> | 34 | #include <qstring.h> |
7 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
8 | #include <qvaluelist.h> | 36 | #include <qvaluelist.h> |
9 | 37 | ||
10 | #include <qpe/recordfields.h> | 38 | #include <qpe/recordfields.h> |
11 | #include <qpe/palmtopuidgen.h> | 39 | #include <qpe/palmtopuidgen.h> |
12 | 40 | ||
13 | #include "otimezone.h" | 41 | #include <opie2/otimezone.h> |
14 | #include "opimrecord.h" | 42 | #include <opie2/opimrecord.h> |
15 | 43 | ||
44 | namespace Opie { | ||
16 | struct OCalendarHelper { | 45 | struct OCalendarHelper { |
17 | /** calculate the week number of the date */ | 46 | /** calculate the week number of the date */ |
18 | static int week( const QDate& ); | 47 | static int week( const QDate& ); |
19 | /** calculate the occurence of week days since the start of the month */ | 48 | /** calculate the occurence of week days since the start of the month */ |
20 | static int ocurrence( const QDate& ); | 49 | static int ocurrence( const QDate& ); |
21 | 50 | ||
22 | // returns the dayOfWeek for the *first* day it finds (ignores | 51 | // returns the dayOfWeek for the *first* day it finds (ignores |
23 | // any further days!). Returns 1 (Monday) if there isn't any day found | 52 | // any further days!). Returns 1 (Monday) if there isn't any day found |
24 | static int dayOfWeek( char day ); | 53 | static int dayOfWeek( char day ); |
25 | 54 | ||
26 | /** returns the diff of month */ | 55 | /** returns the diff of month */ |
27 | static int monthDiff( const QDate& first, const QDate& second ); | 56 | static int monthDiff( const QDate& first, const QDate& second ); |
28 | 57 | ||
29 | }; | 58 | }; |
30 | 59 | ||
31 | class OPimNotifyManager; | 60 | class OPimNotifyManager; |
32 | class ORecur; | 61 | class ORecur; |
33 | 62 | ||
34 | /** | 63 | /** |
35 | * This is the container for all Events. It encapsules all | 64 | * This is the container for all Events. It encapsules all |
36 | * available information for a single Event | 65 | * available information for a single Event |
37 | * @short container for events. | 66 | * @short container for events. |
38 | */ | 67 | */ |
39 | class OEvent : public OPimRecord { | 68 | class OEvent : public OPimRecord { |
40 | public: | 69 | public: |
41 | typedef QValueList<OEvent> ValueList; | 70 | typedef QValueList<OEvent> ValueList; |
42 | /** | 71 | /** |
43 | * RecordFields contain possible attributes | 72 | * RecordFields contain possible attributes |
44 | * used in the Results of toMap().. | 73 | * used in the Results of toMap().. |
45 | */ | 74 | */ |
46 | enum RecordFields { | 75 | enum RecordFields { |
47 | FUid = Qtopia::UID_ID, | 76 | FUid = Qtopia::UID_ID, |
48 | FCategories = Qtopia::CATEGORY_ID, | 77 | FCategories = Qtopia::CATEGORY_ID, |
49 | FDescription = 0, | 78 | FDescription = 0, |
50 | FLocation, | 79 | FLocation, |
51 | FType, | 80 | FType, |
52 | FAlarm, | 81 | FAlarm, |
53 | FSound, | 82 | FSound, |
54 | FRType, | 83 | FRType, |
55 | FRWeekdays, | 84 | FRWeekdays, |
56 | FRPosition, | 85 | FRPosition, |
57 | FRFreq, | 86 | FRFreq, |
58 | FRHasEndDate, | 87 | FRHasEndDate, |
59 | FREndDate, | 88 | FREndDate, |
60 | FRCreated, | 89 | FRCreated, |
61 | FRExceptions, | 90 | FRExceptions, |
62 | FStart, | 91 | FStart, |
63 | FEnd, | 92 | FEnd, |
@@ -188,49 +217,52 @@ public: | |||
188 | // Start: start time -> 23:59 | 217 | // Start: start time -> 23:59 |
189 | // End: 00:00 -> end time | 218 | // End: 00:00 -> end time |
190 | // Start | End == StartEnd: for single-day events (default) | 219 | // Start | End == StartEnd: for single-day events (default) |
191 | // here we draw start time -> end time | 220 | // here we draw start time -> end time |
192 | OEffectiveEvent(); | 221 | OEffectiveEvent(); |
193 | OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd ); | 222 | OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd ); |
194 | OEffectiveEvent( const OEffectiveEvent& ); | 223 | OEffectiveEvent( const OEffectiveEvent& ); |
195 | OEffectiveEvent &operator=(const OEffectiveEvent& ); | 224 | OEffectiveEvent &operator=(const OEffectiveEvent& ); |
196 | ~OEffectiveEvent(); | 225 | ~OEffectiveEvent(); |
197 | 226 | ||
198 | void setStartTime( const QTime& ); | 227 | void setStartTime( const QTime& ); |
199 | void setEndTime( const QTime& ); | 228 | void setEndTime( const QTime& ); |
200 | void setEvent( const OEvent& ); | 229 | void setEvent( const OEvent& ); |
201 | void setDate( const QDate& ); | 230 | void setDate( const QDate& ); |
202 | 231 | ||
203 | void setEffectiveDates( const QDate& from, const QDate& to ); | 232 | void setEffectiveDates( const QDate& from, const QDate& to ); |
204 | 233 | ||
205 | QString description()const; | 234 | QString description()const; |
206 | QString location()const; | 235 | QString location()const; |
207 | QString note()const; | 236 | QString note()const; |
208 | OEvent event()const; | 237 | OEvent event()const; |
209 | QTime startTime()const; | 238 | QTime startTime()const; |
210 | QTime endTime()const; | 239 | QTime endTime()const; |
211 | QDate date()const; | 240 | QDate date()const; |
212 | 241 | ||
213 | /* return the length in hours */ | 242 | /* return the length in hours */ |
214 | int length()const; | 243 | int length()const; |
215 | int size()const; | 244 | int size()const; |
216 | 245 | ||
217 | QDate startDate()const; | 246 | QDate startDate()const; |
218 | QDate endDate()const; | 247 | QDate endDate()const; |
219 | 248 | ||
220 | bool operator<( const OEffectiveEvent &e ) const; | 249 | bool operator<( const OEffectiveEvent &e ) const; |
221 | bool operator<=( const OEffectiveEvent &e ) const; | 250 | bool operator<=( const OEffectiveEvent &e ) const; |
222 | bool operator==( const OEffectiveEvent &e ) const; | 251 | bool operator==( const OEffectiveEvent &e ) const; |
223 | bool operator!=( const OEffectiveEvent &e ) const; | 252 | bool operator!=( const OEffectiveEvent &e ) const; |
224 | bool operator>( const OEffectiveEvent &e ) const; | 253 | bool operator>( const OEffectiveEvent &e ) const; |
225 | bool operator>= ( const OEffectiveEvent &e ) const; | 254 | bool operator>= ( const OEffectiveEvent &e ) const; |
226 | 255 | ||
227 | private: | 256 | private: |
228 | void deref(); | 257 | void deref(); |
229 | inline void changeOrModify(); | 258 | inline void changeOrModify(); |
230 | class Private; | 259 | class Private; |
231 | Private* priv; | 260 | Private* priv; |
232 | struct Data; | 261 | struct Data; |
233 | Data* data; | 262 | Data* data; |
234 | 263 | ||
235 | }; | 264 | }; |
265 | |||
266 | } | ||
267 | |||
236 | #endif | 268 | #endif |