summaryrefslogtreecommitdiff
path: root/libopie/pim/oevent.cpp
authorzecke <zecke>2003-02-21 23:31:52 (UTC)
committer zecke <zecke>2003-02-21 23:31:52 (UTC)
commit46f47c0a1e542a8b4222f3ced8f3304534c7509d (patch) (unidiff)
tree82dc97a07bae77387987711c0c21697691955937 /libopie/pim/oevent.cpp
parenta7448ec87d97a0128618e83ad7526bd884ef8853 (diff)
downloadopie-46f47c0a1e542a8b4222f3ced8f3304534c7509d.zip
opie-46f47c0a1e542a8b4222f3ced8f3304534c7509d.tar.gz
opie-46f47c0a1e542a8b4222f3ced8f3304534c7509d.tar.bz2
Add XML datebookresource
-clean up todoaccessxml header -implement some more stuff in the oeven tester -extend DefaultFactory to not crash and to use datebook -reading of OEvents is working nicely.. saving will be added tomorrow -fix spelling in ODateBookAcces
Diffstat (limited to 'libopie/pim/oevent.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index aaae3b2..ada596c 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -142,96 +142,101 @@ QDateTime OEvent::createdDateTime()const {
142 return data->created; 142 return data->created;
143} 143}
144void OEvent::setCreatedDateTime( const QDateTime& time ) { 144void OEvent::setCreatedDateTime( const QDateTime& time ) {
145 changeOrModify(); 145 changeOrModify();
146 data->created = time; 146 data->created = time;
147} 147}
148QDateTime OEvent::startDateTime()const { 148QDateTime OEvent::startDateTime()const {
149 if ( data->isAllDay ) 149 if ( data->isAllDay )
150 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 150 return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
151 return data->start; 151 return data->start;
152} 152}
153QDateTime OEvent::startDateTimeInZone()const { 153QDateTime OEvent::startDateTimeInZone()const {
154 /* if no timezone, or all day event or if the current and this timeZone match... */ 154 /* if no timezone, or all day event or if the current and this timeZone match... */
155 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 155 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
156 156
157 OTimeZone zone(data->timezone ); 157 OTimeZone zone(data->timezone );
158 return zone.toDateTime( data->start, OTimeZone::current() ); 158 return zone.toDateTime( data->start, OTimeZone::current() );
159} 159}
160void OEvent::setStartDateTime( const QDateTime& dt ) { 160void OEvent::setStartDateTime( const QDateTime& dt ) {
161 changeOrModify(); 161 changeOrModify();
162 data->start = dt; 162 data->start = dt;
163} 163}
164QDateTime OEvent::endDateTime()const { 164QDateTime OEvent::endDateTime()const {
165 /* 165 /*
166 * if all Day event the end time needs 166 * if all Day event the end time needs
167 * to be on the same day as the start 167 * to be on the same day as the start
168 */ 168 */
169 if ( data->isAllDay ) 169 if ( data->isAllDay )
170 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 170 return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
171 return data->end; 171 return data->end;
172} 172}
173QDateTime OEvent::endDateTimeInZone()const { 173QDateTime OEvent::endDateTimeInZone()const {
174 /* if no timezone, or all day event or if the current and this timeZone match... */ 174 /* if no timezone, or all day event or if the current and this timeZone match... */
175 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 175 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
176 176
177 OTimeZone zone(data->timezone ); 177 OTimeZone zone(data->timezone );
178 return zone.toDateTime( data->end, OTimeZone::current() ); 178 return zone.toDateTime( data->end, OTimeZone::current() );
179} 179}
180void OEvent::setEndDateTime( const QDateTime& dt ) { 180void OEvent::setEndDateTime( const QDateTime& dt ) {
181 changeOrModify(); 181 changeOrModify();
182 data->end = dt; 182 data->end = dt;
183} 183}
184bool OEvent::isMultipleDay()const { 184bool OEvent::isMultipleDay()const {
185 return data->end.date().day() - data->start.date().day(); 185 return data->end.date().day() - data->start.date().day();
186} 186}
187bool OEvent::isAllDay()const { 187bool OEvent::isAllDay()const {
188 return data->isAllDay; 188 return data->isAllDay;
189} 189}
190void OEvent::setAllDay( bool allDay ) {
191 changeOrModify();
192 data->isAllDay = allDay;
193 if (allDay ) data->timezone = "UTC";
194}
190void OEvent::setTimeZone( const QString& tz ) { 195void OEvent::setTimeZone( const QString& tz ) {
191 changeOrModify(); 196 changeOrModify();
192 data->timezone = tz; 197 data->timezone = tz;
193} 198}
194QString OEvent::timeZone()const { 199QString OEvent::timeZone()const {
195 return data->timezone; 200 return data->timezone;
196} 201}
197bool OEvent::match( const QRegExp& )const { 202bool OEvent::match( const QRegExp& )const {
198 // FIXME 203 // FIXME
199 return false; 204 return false;
200} 205}
201QString OEvent::toRichText()const { 206QString OEvent::toRichText()const {
202 // FIXME 207 // FIXME
203 return "OEvent test"; 208 return "OEvent test";
204} 209}
205QString OEvent::toShortText()const { 210QString OEvent::toShortText()const {
206 return "OEvent shotText"; 211 return "OEvent shotText";
207} 212}
208QString OEvent::type()const { 213QString OEvent::type()const {
209 return QString::fromLatin1("OEvent"); 214 return QString::fromLatin1("OEvent");
210} 215}
211QString OEvent::recordField( int /*id */ )const { 216QString OEvent::recordField( int /*id */ )const {
212 return QString::null; 217 return QString::null;
213} 218}
214int OEvent::rtti() { 219int OEvent::rtti() {
215 return OPimResolver::DateBook; 220 return OPimResolver::DateBook;
216} 221}
217bool OEvent::loadFromStream( QDataStream& ) { 222bool OEvent::loadFromStream( QDataStream& ) {
218 return true; 223 return true;
219} 224}
220bool OEvent::saveToStream( QDataStream& )const { 225bool OEvent::saveToStream( QDataStream& )const {
221 return true; 226 return true;
222} 227}
223void OEvent::changeOrModify() { 228void OEvent::changeOrModify() {
224 if ( data->count != 1 ) { 229 if ( data->count != 1 ) {
225 data->deref(); 230 data->deref();
226 Data* d2 = new Data; 231 Data* d2 = new Data;
227 d2->description = data->description; 232 d2->description = data->description;
228 d2->location = data->location; 233 d2->location = data->location;
229 d2->manager = data->manager; 234 d2->manager = data->manager;
230 d2->recur = data->recur; 235 d2->recur = data->recur;
231 d2->note = data->note; 236 d2->note = data->note;
232 d2->created = data->created; 237 d2->created = data->created;
233 d2->start = data->start; 238 d2->start = data->start;
234 d2->end = data->end; 239 d2->end = data->end;
235 d2->isAllDay = data->isAllDay; 240 d2->isAllDay = data->isAllDay;
236 d2->timezone = data->timezone; 241 d2->timezone = data->timezone;
237 242