-rw-r--r-- | libopie2/opiepim/oevent.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h index 30f442e..9218c97 100644 --- a/libopie2/opiepim/oevent.h +++ b/libopie2/opiepim/oevent.h | |||
@@ -12,155 +12,165 @@ | |||
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 | 33 | ||
34 | /** | 34 | /** |
35 | * This is the container for all Events. It encapsules all | 35 | * This is the container for all Events. It encapsules all |
36 | * available information for a single Event | 36 | * available information for a single Event |
37 | * @short container for events. | 37 | * @short container for events. |
38 | */ | 38 | */ |
39 | class OEvent : public OPimRecord { | 39 | class OEvent : public OPimRecord { |
40 | public: | 40 | public: |
41 | typedef QValueList<OEvent> ValueList; | 41 | typedef QValueList<OEvent> ValueList; |
42 | /** | 42 | /** |
43 | * RecordFields contain possible attributes | 43 | * RecordFields contain possible attributes |
44 | * used in the Results of toMap().. | ||
44 | */ | 45 | */ |
45 | enum RecordFields { | 46 | enum RecordFields { |
46 | Uid = Qtopia::UID_ID, | 47 | FUid = Qtopia::UID_ID, |
47 | Category = Qtopia::CATEGORY_ID, | 48 | FCategories = Qtopia::CATEGORY_ID, |
48 | Description, | 49 | FDescription = 0, |
49 | Location, | 50 | FLocation, |
50 | Alarm, | 51 | FType, |
51 | Reminder, | 52 | FAlarm, |
52 | Recurrence, | 53 | FSound, |
53 | Note, | 54 | FRType, |
54 | Created, | 55 | FRWeekdays, |
55 | StartDate, | 56 | FRPosition, |
56 | EndDate, | 57 | FRFreq, |
57 | AllDay, | 58 | FRHasEndDate, |
58 | TimeZone | 59 | FREndDate, |
60 | FRCreated, | ||
61 | FRExceptions, | ||
62 | FStart, | ||
63 | FEnd, | ||
64 | FNote, | ||
65 | FTimeZone, | ||
66 | FRecParent, | ||
67 | FRecChildren, | ||
59 | }; | 68 | }; |
60 | 69 | ||
61 | /** | 70 | /** |
62 | * Start with an Empty OEvent. UID == 0 means that it is empty | 71 | * Start with an Empty OEvent. UID == 0 means that it is empty |
63 | */ | 72 | */ |
64 | OEvent(int uid = 0); | 73 | OEvent(int uid = 0); |
65 | 74 | ||
66 | /** | 75 | /** |
67 | * copy c'tor | 76 | * copy c'tor |
68 | */ | 77 | */ |
69 | OEvent( const OEvent& ); | 78 | OEvent( const OEvent& ); |
70 | ~OEvent(); | 79 | ~OEvent(); |
71 | OEvent &operator=( const OEvent& ); | 80 | OEvent &operator=( const OEvent& ); |
72 | 81 | ||
73 | QString description()const; | 82 | QString description()const; |
74 | void setDescription( const QString& description ); | 83 | void setDescription( const QString& description ); |
75 | 84 | ||
76 | QString location()const; | 85 | QString location()const; |
77 | void setLocation( const QString& loc ); | 86 | void setLocation( const QString& loc ); |
78 | 87 | ||
79 | bool hasNotifiers()const; | 88 | bool hasNotifiers()const; |
80 | OPimNotifyManager ¬ifiers()const; | 89 | OPimNotifyManager ¬ifiers()const; |
81 | 90 | ||
82 | ORecur recurrence()const; | 91 | ORecur recurrence()const; |
83 | void setRecurrence( const ORecur& ); | 92 | void setRecurrence( const ORecur& ); |
84 | bool hasRecurrence()const; | 93 | bool hasRecurrence()const; |
85 | 94 | ||
86 | QString note()const; | 95 | QString note()const; |
87 | void setNote( const QString& note ); | 96 | void setNote( const QString& note ); |
88 | 97 | ||
89 | 98 | ||
90 | QDateTime createdDateTime()const; | 99 | QDateTime createdDateTime()const; |
91 | void setCreatedDateTime( const QDateTime& dt); | 100 | void setCreatedDateTime( const QDateTime& dt); |
92 | 101 | ||
93 | /** set the date to dt. dt is the QDateTime in localtime */ | 102 | /** set the date to dt. dt is the QDateTime in localtime */ |
94 | void setStartDateTime( const QDateTime& ); | 103 | void setStartDateTime( const QDateTime& ); |
95 | /** returns the datetime in the local timeZone */ | 104 | /** returns the datetime in the local timeZone */ |
96 | QDateTime startDateTime()const; | 105 | QDateTime startDateTime()const; |
97 | 106 | ||
98 | /** returns the start datetime in the current zone */ | 107 | /** returns the start datetime in the current zone */ |
99 | QDateTime startDateTimeInZone()const; | 108 | QDateTime startDateTimeInZone()const; |
100 | 109 | ||
101 | /** in current timezone */ | 110 | /** in current timezone */ |
102 | void setEndDateTime( const QDateTime& ); | 111 | void setEndDateTime( const QDateTime& ); |
103 | /** in current timezone */ | 112 | /** in current timezone */ |
104 | QDateTime endDateTime()const; | 113 | QDateTime endDateTime()const; |
105 | QDateTime endDateTimeInZone()const; | 114 | QDateTime endDateTimeInZone()const; |
106 | 115 | ||
107 | bool isMultipleDay()const; | 116 | bool isMultipleDay()const; |
108 | bool isAllDay()const; | 117 | bool isAllDay()const; |
109 | void setAllDay( bool isAllDay ); | 118 | void setAllDay( bool isAllDay ); |
110 | 119 | ||
111 | /* pin this event to a timezone! FIXME */ | 120 | /* pin this event to a timezone! FIXME */ |
112 | void setTimeZone( const QString& timeZone ); | 121 | void setTimeZone( const QString& timeZone ); |
113 | QString timeZone()const; | 122 | QString timeZone()const; |
114 | 123 | ||
115 | 124 | ||
116 | virtual bool match( const QRegExp& )const; | 125 | virtual bool match( const QRegExp& )const; |
117 | 126 | ||
118 | /** For exception to recurrence here is a list of children... */ | 127 | /** For exception to recurrence here is a list of children... */ |
119 | QArray<int> children()const; | 128 | QArray<int> children()const; |
120 | void setChildren( const QArray<int>& ); | 129 | void setChildren( const QArray<int>& ); |
121 | void addChild( int uid ); | 130 | void addChild( int uid ); |
122 | void removeChild( int uid ); | 131 | void removeChild( int uid ); |
123 | 132 | ||
124 | /** return the parent OEvent */ | 133 | /** return the parent OEvent */ |
125 | int parent()const; | 134 | int parent()const; |
126 | void setParent( int uid ); | 135 | void setParent( int uid ); |
127 | 136 | ||
128 | 137 | ||
129 | /* needed reimp */ | 138 | /* needed reimp */ |
130 | QString toRichText()const; | 139 | QString toRichText()const; |
131 | QString toShortText()const; | 140 | QString toShortText()const; |
132 | QString type()const; | 141 | QString type()const; |
133 | 142 | ||
134 | QMap<int, QString> toMap()const; | 143 | QMap<int, QString> toMap()const; |
144 | void fromMap( const QMap<int, QString>& map ); | ||
135 | QString recordField(int )const; | 145 | QString recordField(int )const; |
136 | 146 | ||
137 | static int rtti(); | 147 | static int rtti(); |
138 | 148 | ||
139 | bool loadFromStream( QDataStream& ); | 149 | bool loadFromStream( QDataStream& ); |
140 | bool saveToStream( QDataStream& )const; | 150 | bool saveToStream( QDataStream& )const; |
141 | 151 | ||
142 | /* bool operator==( const OEvent& ); | 152 | /* bool operator==( const OEvent& ); |
143 | bool operator!=( const OEvent& ); | 153 | bool operator!=( const OEvent& ); |
144 | bool operator<( const OEvent& ); | 154 | bool operator<( const OEvent& ); |
145 | bool operator<=( const OEvent& ); | 155 | bool operator<=( const OEvent& ); |
146 | bool operator>( const OEvent& ); | 156 | bool operator>( const OEvent& ); |
147 | bool operator>=(const OEvent& ); | 157 | bool operator>=(const OEvent& ); |
148 | */ | 158 | */ |
149 | private: | 159 | private: |
150 | inline void changeOrModify(); | 160 | inline void changeOrModify(); |
151 | void deref(); | 161 | void deref(); |
152 | struct Data; | 162 | struct Data; |
153 | Data* data; | 163 | Data* data; |
154 | class Private; | 164 | class Private; |
155 | Private* priv; | 165 | Private* priv; |
156 | 166 | ||
157 | }; | 167 | }; |
158 | 168 | ||
159 | /** | 169 | /** |
160 | * AN Event can span through multiple days. We split up a multiday eve | 170 | * AN Event can span through multiple days. We split up a multiday eve |
161 | */ | 171 | */ |
162 | class OEffectiveEvent { | 172 | class OEffectiveEvent { |
163 | public: | 173 | public: |
164 | typedef QValueList<OEffectiveEvent> ValueList; | 174 | typedef QValueList<OEffectiveEvent> ValueList; |
165 | enum Position { MidWay, Start, End, StartEnd }; | 175 | enum Position { MidWay, Start, End, StartEnd }; |
166 | // If we calculate the effective event of a multi-day event | 176 | // If we calculate the effective event of a multi-day event |