-rw-r--r-- | libopie2/opiepim/oevent.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h index 585515c..57d32d0 100644 --- a/libopie2/opiepim/oevent.h +++ b/libopie2/opiepim/oevent.h | |||
@@ -9,68 +9,84 @@ | |||
9 | 9 | ||
10 | #include <qpe/recordfields.h> | 10 | #include <qpe/recordfields.h> |
11 | #include <qpe/palmtopuidgen.h> | 11 | #include <qpe/palmtopuidgen.h> |
12 | 12 | ||
13 | #include "otimezone.h" | 13 | #include "otimezone.h" |
14 | #include "opimrecord.h" | 14 | #include "opimrecord.h" |
15 | 15 | ||
16 | struct OCalendarHelper { | 16 | struct OCalendarHelper { |
17 | /** calculate the week number of the date */ | 17 | /** calculate the week number of the date */ |
18 | static int week( const QDate& ); | 18 | static int week( const QDate& ); |
19 | /** calculate the occurence of week days since the start of the month */ | 19 | /** calculate the occurence of week days since the start of the month */ |
20 | static int ocurrence( const QDate& ); | 20 | static int ocurrence( const QDate& ); |
21 | 21 | ||
22 | // returns the dayOfWeek for the *first* day it finds (ignores | 22 | // returns the dayOfWeek for the *first* day it finds (ignores |
23 | // any further days!). Returns 1 (Monday) if there isn't any day found | 23 | // any further days!). Returns 1 (Monday) if there isn't any day found |
24 | static int dayOfWeek( char day ); | 24 | static int dayOfWeek( char day ); |
25 | 25 | ||
26 | /** returns the diff of month */ | 26 | /** returns the diff of month */ |
27 | static int monthDiff( const QDate& first, const QDate& second ); | 27 | static int monthDiff( const QDate& first, const QDate& second ); |
28 | 28 | ||
29 | }; | 29 | }; |
30 | 30 | ||
31 | class OPimNotifyManager; | 31 | class OPimNotifyManager; |
32 | class ORecur; | 32 | class ORecur; |
33 | |||
34 | /** | ||
35 | * This is the container for all Events. It encapsules all | ||
36 | * available information for a single Event | ||
37 | * @short container for events. | ||
38 | */ | ||
33 | class OEvent : public OPimRecord { | 39 | class OEvent : public OPimRecord { |
34 | public: | 40 | public: |
35 | typedef QValueList<OEvent> ValueList; | 41 | typedef QValueList<OEvent> ValueList; |
42 | /** | ||
43 | * RecordFields contain possible attributes | ||
44 | */ | ||
36 | enum RecordFields { | 45 | enum RecordFields { |
37 | Uid = Qtopia::UID_ID, | 46 | Uid = Qtopia::UID_ID, |
38 | Category = Qtopia::CATEGORY_ID, | 47 | Category = Qtopia::CATEGORY_ID, |
39 | Description, | 48 | Description, |
40 | Location, | 49 | Location, |
41 | Alarm, | 50 | Alarm, |
42 | Reminder, | 51 | Reminder, |
43 | Recurrence, | 52 | Recurrence, |
44 | Note, | 53 | Note, |
45 | Created, | 54 | Created, |
46 | StartDate, | 55 | StartDate, |
47 | EndDate, | 56 | EndDate, |
48 | AllDay, | 57 | AllDay, |
49 | TimeZone | 58 | TimeZone |
50 | }; | 59 | }; |
51 | 60 | ||
61 | /** | ||
62 | * Start with an Empty OEvent. UID == 0 means that it is empty | ||
63 | */ | ||
52 | OEvent(int uid = 0); | 64 | OEvent(int uid = 0); |
65 | |||
66 | /** | ||
67 | * copy c'tor | ||
68 | */ | ||
53 | OEvent( const OEvent& ); | 69 | OEvent( const OEvent& ); |
54 | ~OEvent(); | 70 | ~OEvent(); |
55 | OEvent &operator=( const OEvent& ); | 71 | OEvent &operator=( const OEvent& ); |
56 | 72 | ||
57 | QString description()const; | 73 | QString description()const; |
58 | void setDescription( const QString& description ); | 74 | void setDescription( const QString& description ); |
59 | 75 | ||
60 | QString location()const; | 76 | QString location()const; |
61 | void setLocation( const QString& loc ); | 77 | void setLocation( const QString& loc ); |
62 | 78 | ||
63 | bool hasNotifiers()const; | 79 | bool hasNotifiers()const; |
64 | OPimNotifyManager ¬ifiers()const; | 80 | OPimNotifyManager ¬ifiers()const; |
65 | 81 | ||
66 | ORecur recurrence()const; | 82 | ORecur recurrence()const; |
67 | void setRecurrence( const ORecur& ); | 83 | void setRecurrence( const ORecur& ); |
68 | bool hasRecurrence()const; | 84 | bool hasRecurrence()const; |
69 | 85 | ||
70 | QString note()const; | 86 | QString note()const; |
71 | void setNote( const QString& note ); | 87 | void setNote( const QString& note ); |
72 | 88 | ||
73 | 89 | ||
74 | QDateTime createdDateTime()const; | 90 | QDateTime createdDateTime()const; |
75 | void setCreatedDateTime( const QDateTime& dt); | 91 | void setCreatedDateTime( const QDateTime& dt); |
76 | 92 | ||
@@ -123,49 +139,48 @@ public: | |||
123 | 139 | ||
124 | bool loadFromStream( QDataStream& ); | 140 | bool loadFromStream( QDataStream& ); |
125 | bool saveToStream( QDataStream& )const; | 141 | bool saveToStream( QDataStream& )const; |
126 | 142 | ||
127 | /* bool operator==( const OEvent& ); | 143 | /* bool operator==( const OEvent& ); |
128 | bool operator!=( const OEvent& ); | 144 | bool operator!=( const OEvent& ); |
129 | bool operator<( const OEvent& ); | 145 | bool operator<( const OEvent& ); |
130 | bool operator<=( const OEvent& ); | 146 | bool operator<=( const OEvent& ); |
131 | bool operator>( const OEvent& ); | 147 | bool operator>( const OEvent& ); |
132 | bool operator>=(const OEvent& ); | 148 | bool operator>=(const OEvent& ); |
133 | */ | 149 | */ |
134 | private: | 150 | private: |
135 | inline void changeOrModify(); | 151 | inline void changeOrModify(); |
136 | void deref(); | 152 | void deref(); |
137 | struct Data; | 153 | struct Data; |
138 | Data* data; | 154 | Data* data; |
139 | class Private; | 155 | class Private; |
140 | Private* priv; | 156 | Private* priv; |
141 | 157 | ||
142 | }; | 158 | }; |
143 | 159 | ||
144 | /** | 160 | /** |
145 | * AN Event can span through multiple days. We split up a multiday eve | 161 | * AN Event can span through multiple days. We split up a multiday eve |
146 | */ | 162 | */ |
147 | |||
148 | class OEffectiveEvent { | 163 | class OEffectiveEvent { |
149 | public: | 164 | public: |
150 | typedef QValueList<OEffectiveEvent> ValueList; | 165 | typedef QValueList<OEffectiveEvent> ValueList; |
151 | enum Position { MidWay, Start, End, StartEnd }; | 166 | enum Position { MidWay, Start, End, StartEnd }; |
152 | // If we calculate the effective event of a multi-day event | 167 | // If we calculate the effective event of a multi-day event |
153 | // we have to figure out whether we are at the first day, | 168 | // we have to figure out whether we are at the first day, |
154 | // at the end, or anywhere else ("middle"). This is important | 169 | // at the end, or anywhere else ("middle"). This is important |
155 | // for the start/end times (00:00/23:59) | 170 | // for the start/end times (00:00/23:59) |
156 | // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi- | 171 | // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi- |
157 | // day event | 172 | // day event |
158 | // Start: start time -> 23:59 | 173 | // Start: start time -> 23:59 |
159 | // End: 00:00 -> end time | 174 | // End: 00:00 -> end time |
160 | // Start | End == StartEnd: for single-day events (default) | 175 | // Start | End == StartEnd: for single-day events (default) |
161 | // here we draw start time -> end time | 176 | // here we draw start time -> end time |
162 | OEffectiveEvent(); | 177 | OEffectiveEvent(); |
163 | OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd ); | 178 | OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd ); |
164 | OEffectiveEvent( const OEffectiveEvent& ); | 179 | OEffectiveEvent( const OEffectiveEvent& ); |
165 | OEffectiveEvent &operator=(const OEffectiveEvent& ); | 180 | OEffectiveEvent &operator=(const OEffectiveEvent& ); |
166 | ~OEffectiveEvent(); | 181 | ~OEffectiveEvent(); |
167 | 182 | ||
168 | void setStartTime( const QTime& ); | 183 | void setStartTime( const QTime& ); |
169 | void setEndTime( const QTime& ); | 184 | void setEndTime( const QTime& ); |
170 | void setEvent( const OEvent& ); | 185 | void setEvent( const OEvent& ); |
171 | void setDate( const QDate& ); | 186 | void setDate( const QDate& ); |