author | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
commit | 6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff) | |
tree | 6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/backend/event.h | |
parent | d10cddb3c9ce75bc90b14add14bc133737fe35aa (diff) | |
download | opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2 |
Qtopia1-6 merge
still to test
bic changes to be resolved
more changes to be made?
-rw-r--r-- | library/backend/event.h | 173 |
1 files changed, 157 insertions, 16 deletions
diff --git a/library/backend/event.h b/library/backend/event.h index 277aadd..7fe41a5 100644 --- a/library/backend/event.h +++ b/library/backend/event.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
@@ -25,2 +25,3 @@ | |||
25 | #include <qvaluelist.h> | 25 | #include <qvaluelist.h> |
26 | #include <qcolor.h> | ||
26 | 27 | ||
@@ -29,3 +30,3 @@ | |||
29 | #endif | 30 | #endif |
30 | #include <qpe/palmtoprecord.h> | 31 | #include <qtopia/private/palmtoprecord.h> |
31 | 32 | ||
@@ -33,2 +34,7 @@ | |||
33 | 34 | ||
35 | static const QColor colorNormal = QColor(255, 0 , 0 ); | ||
36 | static const QColor colorRepeat = QColor(0 , 0 , 255); | ||
37 | static const QColor colorNormalLight = QColor(255, 220, 220); | ||
38 | static const QColor colorRepeatLight = QColor(200, 200, 255); | ||
39 | |||
34 | class EventPrivate; | 40 | class EventPrivate; |
@@ -39,4 +45,7 @@ public: | |||
39 | MonthlyDate, Yearly }; | 45 | MonthlyDate, Yearly }; |
46 | |||
47 | // Don't use this. | ||
40 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, | 48 | enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08, |
41 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; | 49 | FRI = 0x10, SAT = 0x20, SUN = 0x40 }; |
50 | // Don't use this. | ||
42 | struct QPC_EXPORT RepeatPattern | 51 | struct QPC_EXPORT RepeatPattern |
@@ -72,2 +81,3 @@ public: | |||
72 | 81 | ||
82 | // Don't use these, there are essentially meaningless. | ||
73 | bool operator<( const Event &e1) const { return start() < e1.start(); }; | 83 | bool operator<( const Event &e1) const { return start() < e1.start(); }; |
@@ -85,18 +95,45 @@ public: | |||
85 | 95 | ||
86 | void setType( Type t ); | 96 | void setNotes( const QString &n ); |
87 | Type type() const; | 97 | const QString ¬es() const; |
98 | |||
99 | void setType( Type t ); // Don't use me. | ||
100 | Type type() const; // Don't use me. | ||
101 | |||
102 | void setAllDay(bool); | ||
103 | bool isAllDay() const; | ||
104 | |||
88 | void setStart( const QDateTime &d ); | 105 | void setStart( const QDateTime &d ); |
89 | void setStart( time_t time ); | 106 | void setStart( time_t time ); // don't use me. |
90 | QDateTime start( bool actual = FALSE ) const; | 107 | QDateTime start( ) const; |
91 | time_t startTime() const { return startUTC; } | 108 | QDateTime start( bool actual ) const; // don't use me. |
109 | time_t startTime() const { return startUTC; } // don't use me. | ||
92 | void setEnd( const QDateTime &e ); | 110 | void setEnd( const QDateTime &e ); |
93 | void setEnd( time_t time ); | 111 | void setEnd( time_t time ); // don't use me |
94 | QDateTime end( bool actual = FALSE ) const; | 112 | QDateTime end( ) const; |
95 | time_t endTime() const { return endUTC; } | 113 | QDateTime end( bool actual ) const; // don't use me. |
114 | time_t endTime() const { return endUTC; } // don't use me. | ||
96 | void setTimeZone( const QString & ); | 115 | void setTimeZone( const QString & ); |
97 | const QString &timeZone() const; | 116 | const QString &timeZone() const; |
98 | void setAlarm( bool b, int minutes, SoundTypeChoice ); | 117 | void setAlarm( int minutes, SoundTypeChoice ); |
118 | void clearAlarm(); | ||
119 | void setAlarm( bool b, int minutes, SoundTypeChoice ); // Don't use me. | ||
99 | bool hasAlarm() const; | 120 | bool hasAlarm() const; |
100 | int alarmTime() const; | 121 | int alarmDelay() const; |
122 | int alarmTime() const; // Don't use me. | ||
101 | SoundTypeChoice alarmSound() const; | 123 | SoundTypeChoice alarmSound() const; |
124 | |||
125 | RepeatType repeatType() const; | ||
126 | int frequency() const; | ||
127 | int weekOffset() const; | ||
128 | QDate repeatTill() const; | ||
129 | bool repeatForever() const; | ||
130 | bool repeatOnWeekDay(int day) const; | ||
131 | |||
132 | void setRepeatType(RepeatType); | ||
133 | void setFrequency(int); | ||
134 | void setRepeatTill(const QDate &); | ||
135 | void setRepeatForever(bool); | ||
136 | void setRepeatOnWeekDay(int day, bool enable); | ||
137 | |||
138 | // Don't use any of these. | ||
102 | void setRepeat( bool b, const RepeatPattern &p ); | 139 | void setRepeat( bool b, const RepeatPattern &p ); |
@@ -106,4 +143,2 @@ public: | |||
106 | RepeatPattern &repeatPattern(); | 143 | RepeatPattern &repeatPattern(); |
107 | void setNotes( const QString &n ); | ||
108 | const QString ¬es() const; | ||
109 | bool doRepeat() const { return pattern.type != NoRepeat; } | 144 | bool doRepeat() const { return pattern.type != NoRepeat; } |
@@ -113,2 +148,6 @@ public: | |||
113 | 148 | ||
149 | bool match( const QRegExp &r ) const; | ||
150 | |||
151 | // Don't use these either. Functionality will be moved elsewhere. | ||
152 | |||
114 | // helper function to calculate the week of the given date | 153 | // helper function to calculate the week of the given date |
@@ -125,3 +164,2 @@ public: | |||
125 | static int monthDiff( const QDate& first, const QDate& second ); | 164 | static int monthDiff( const QDate& first, const QDate& second ); |
126 | bool match( const QRegExp &r ) const; | ||
127 | 165 | ||
@@ -213,2 +251,105 @@ private: | |||
213 | 251 | ||
252 | inline void Event::setAlarm( int minutes, SoundTypeChoice s ) | ||
253 | { | ||
254 | setAlarm(TRUE, minutes, s); | ||
255 | } | ||
256 | |||
257 | inline void Event::clearAlarm() | ||
258 | { | ||
259 | setAlarm(FALSE, 0, Silent); | ||
260 | } | ||
261 | |||
262 | inline int Event::alarmDelay() const | ||
263 | { | ||
264 | return alarmTime(); | ||
265 | } | ||
266 | |||
267 | inline void Event::setAllDay(bool enable) | ||
268 | { | ||
269 | if (enable) | ||
270 | setType(AllDay); | ||
271 | else | ||
272 | setType(Normal); | ||
273 | }; | ||
274 | |||
275 | inline bool Event::isAllDay() const | ||
276 | { | ||
277 | return type() == AllDay; | ||
278 | } | ||
279 | |||
280 | inline Event::RepeatType Event::repeatType() const | ||
281 | { | ||
282 | return repeatPattern().type; | ||
283 | } | ||
284 | |||
285 | inline int Event::frequency() const | ||
286 | { | ||
287 | return repeatPattern().frequency; | ||
288 | } | ||
289 | |||
290 | inline int Event::weekOffset() const | ||
291 | { | ||
292 | if (start().date().day() == 1) | ||
293 | return 1; | ||
294 | return (start().date().day() - 1) / 7 + 1; | ||
295 | } | ||
296 | |||
297 | inline QDate Event::repeatTill() const | ||
298 | { | ||
299 | return repeatPattern().endDate(); | ||
300 | } | ||
301 | |||
302 | inline bool Event::repeatForever() const | ||
303 | { | ||
304 | return !repeatPattern().hasEndDate; | ||
305 | } | ||
306 | |||
307 | inline void Event::setRepeatType(RepeatType t) | ||
308 | { | ||
309 | pattern.type = t; | ||
310 | } | ||
311 | |||
312 | inline void Event::setFrequency(int f) | ||
313 | { | ||
314 | pattern.frequency = f; | ||
315 | } | ||
316 | |||
317 | inline void Event::setRepeatTill(const QDate &d) | ||
318 | { | ||
319 | pattern.setEndDate(d); | ||
320 | pattern.hasEndDate = TRUE; | ||
321 | } | ||
322 | |||
323 | inline void Event::setRepeatForever(bool b) | ||
324 | { | ||
325 | if (!b == pattern.hasEndDate) | ||
326 | return; | ||
327 | if (!b && !pattern.hasEndDate) | ||
328 | pattern.setEndDate(end().date()); | ||
329 | pattern.hasEndDate = !b; | ||
330 | } | ||
331 | |||
332 | inline bool Event::repeatOnWeekDay(int day) const | ||
333 | { | ||
334 | if (pattern.type != Weekly) | ||
335 | return FALSE; | ||
336 | return ( (1 << (day - 1)) & pattern.days ) != 0; | ||
337 | } | ||
338 | |||
339 | inline void Event::setRepeatOnWeekDay(int day, bool enable) | ||
340 | { | ||
341 | if ( repeatOnWeekDay( day ) != enable ) | ||
342 | pattern.days ^= 1 << (day - 1); | ||
343 | } | ||
344 | |||
345 | inline QDateTime Event::start( ) const | ||
346 | { | ||
347 | return start(FALSE); | ||
348 | } | ||
349 | |||
350 | inline QDateTime Event::end( ) const | ||
351 | { | ||
352 | return end(FALSE); | ||
353 | } | ||
354 | |||
214 | #ifdef PALMTOPCENTER | 355 | #ifdef PALMTOPCENTER |