summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/oevent.h
authorzecke <zecke>2003-02-21 16:52:49 (UTC)
committer zecke <zecke>2003-02-21 16:52:49 (UTC)
commit0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 (patch) (unidiff)
treef3ce9c9441a1073762f3e0c61cc85f0d5a1fd81d /libopie2/opiepim/oevent.h
parenta298235aa1489937e7657079e6352adfc8746acf (diff)
downloadopie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.zip
opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.gz
opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.bz2
-Remove old Todo classes they're deprecated and today I already using the
new API -Guard against self assignment in OTodo -Add test apps for OPIM -Opiefied Event classes -Added TimeZone handling and pinning of TimeZones to OEvent -Adjust ORecur and the widget to better timezone behaviour
Diffstat (limited to 'libopie2/opiepim/oevent.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/oevent.h198
1 files changed, 198 insertions, 0 deletions
diff --git a/libopie2/opiepim/oevent.h b/libopie2/opiepim/oevent.h
new file mode 100644
index 0000000..4489be7
--- a/dev/null
+++ b/libopie2/opiepim/oevent.h
@@ -0,0 +1,198 @@
1// CONTAINS GPLed code of TT
2
3#ifndef OPIE_PIM_EVENT_H
4#define OPIE_PIM_EVENT_H
5
6#include <qstring.h>
7#include <qdatetime.h>
8#include <qvaluelist.h>
9
10#include <qpe/recordfields.h>
11#include <qpe/palmtopuidgen.h>
12
13#include "otimezone.h"
14#include "opimrecord.h"
15
16namespace OCalendarHelper {
17 /** calculate the week number of the date */
18 static int week( const QDate& );
19 /** calculate the occurence of week days since the start of the month */
20 static int ocurrence( const QDate& );
21
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
24 static int dayOfWeek( char day );
25
26 /** returns the diff of month */
27 static int monthDiff( const QDate& first, const QDate& second );
28
29}
30
31class OPimNotifyManager;
32class ORecur;
33class OEvent : public OPimRecord {
34public:
35 typedef QValueList<OEvent> ValueList;
36 enum RecordFields {
37 Uid = Qtopia::UID_ID,
38 Category = Qtopia::CATEGORY_ID,
39 Description,
40 Location,
41 Alarm,
42 Reminder,
43 Recurrence,
44 Note,
45 Created,
46 StartDate,
47 EndDate,
48 AllDay,
49 TimeZone
50 };
51
52 OEvent(int uid = 0);
53 OEvent( const OEvent& );
54 ~OEvent();
55 OEvent &operator=( const OEvent& );
56
57 QString description()const;
58 void setDescription( const QString& description );
59
60 QString location()const;
61 void setLocation( const QString& loc );
62
63 bool hasNotifiers()const;
64 OPimNotifyManager &notifiers();
65
66 ORecur recurrence()const;
67 void setRecurrence( const ORecur& );
68 bool hasRecurrence()const;
69
70 QString note()const;
71 void setNote( const QString& note );
72
73
74 QDateTime createdDateTime()const;
75 void setCreatedDateTime( const QDateTime& dt);
76
77 /** set the date to dt. dt is the QDateTime in localtime */
78 void setStartDateTime( const QDateTime& );
79 /** returns the datetime in the local timeZone */
80 QDateTime startDateTime()const;
81
82 /** returns the start datetime in the current zone */
83 QDateTime startDateTimeInZone()const;
84
85 /** in current timezone */
86 void setEndDateTime( const QDateTime& );
87 /** in current timezone */
88 QDateTime endDateTime()const;
89 QDateTime endDateTimeInZone()const;
90
91 bool isMultipleDay()const;
92 bool isAllDay()const;
93 void setAllDay( bool isAllDay );
94
95 /* pin this event to a timezone! FIXME */
96 void setTimeZone( const QString& timeZone );
97 QString timeZone()const;
98
99
100 bool match( const QRegExp& )const;
101
102
103
104
105 /* needed reimp */
106 QString toRichText()const;
107 QString toShortText()const;
108 QString type()const;
109
110 QMap<int, QString> toMap()const;
111 QMap<QString, QString> toExtraMap()const;
112 QString recordField(int )const;
113
114 static int rtti();
115
116 bool loadFromStream( QDataStream& );
117 bool saveToStream( QDataStream& )const;
118
119/* bool operator==( const OEvent& );
120 bool operator!=( const OEvent& );
121 bool operator<( const OEvent& );
122 bool operator<=( const OEvent& );
123 bool operator>( const OEvent& );
124 bool operator>=(const OEvent& );
125*/
126private:
127 inline void changeOrModify();
128 void deref();
129 struct Data;
130 Data* data;
131 class Private;
132 Private* priv;
133
134};
135
136/**
137 * AN Event can span through multiple days. We split up a multiday eve
138 */
139
140class OEffectiveEvent {
141public:
142 QValueList<OEffectiveEvent> ValueList;
143 enum Position { MidWay, Start, End, StartEnd };
144 // If we calculate the effective event of a multi-day event
145 // we have to figure out whether we are at the first day,
146 // at the end, or anywhere else ("middle"). This is important
147 // for the start/end times (00:00/23:59)
148 // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi-
149 // day event
150 // Start: start time -> 23:59
151 // End: 00:00 -> end time
152 // Start | End == StartEnd: for single-day events (default)
153 // here we draw start time -> end time
154 OEffectiveEvent();
155 OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd );
156 OEffectiveEvent( const OEffectiveEvent& );
157 OEffectiveEvent &operator=(const OEffectiveEvent& );
158 ~OEffectiveEvent();
159
160 void setStartTime( const QTime& );
161 void setEndTime( const QTime& );
162 void setEvent( const OEvent& );
163 void setDate( const QDate& );
164
165 void setEffectiveDates( const QDate& from, const QDate& to );
166
167 QString description()const;
168 QString location()const;
169 QString note()const;
170 OEvent event()const;
171 QTime startTime()const;
172 QTime endTime()const;
173 QDate date()const;
174
175 /* return the length in hours */
176 int length()const;
177 int size()const;
178
179 QDate startDate()const;
180 QDate endDate()const;
181
182 bool operator<( const OEffectiveEvent &e ) const;
183 bool operator<=( const OEffectiveEvent &e ) const;
184 bool operator==( const OEffectiveEvent &e ) const;
185 bool operator!=( const OEffectiveEvent &e ) const;
186 bool operator>( const OEffectiveEvent &e ) const;
187 bool operator>= ( const OEffectiveEvent &e ) const;
188
189private:
190 void deref();
191 inline void changeOrModify();
192 class Private;
193 Private* priv;
194 struct Data;
195 Data* data;
196
197};
198#endif