summaryrefslogtreecommitdiff
path: root/libopie/pim/orecur.cpp
Unidiff
Diffstat (limited to 'libopie/pim/orecur.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/orecur.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/libopie/pim/orecur.cpp b/libopie/pim/orecur.cpp
index daf3506..e6a4787 100644
--- a/libopie/pim/orecur.cpp
+++ b/libopie/pim/orecur.cpp
@@ -1,35 +1,35 @@
1#include <qshared.h> 1#include <qshared.h>
2 2
3#include <qtopia/timeconversion.h> 3#include <qtopia/timeconversion.h>
4 4
5#include "orecur.h" 5#include "orecur.h"
6 6
7struct ORecur::Data : public QShared { 7struct ORecur::Data : public QShared {
8 Data() : QShared() { 8 Data() : QShared() {
9 type = ORecur::NoRepeat; 9 type = ORecur::NoRepeat;
10 freq = -1; 10 freq = -1;
11 days = 0; 11 days = 0;
12 pos = 0; 12 pos = 0;
13 create = -1; 13 create = QDateTime::currentDateTime();
14 hasEnd = FALSE; 14 hasEnd = FALSE;
15 end = 0; 15 end = QDate::currentDate();
16 } 16 }
17 char days; // Q_UINT8 for 8 seven days;) 17 char days; // Q_UINT8 for 8 seven days;)
18 ORecur::RepeatType type; 18 ORecur::RepeatType type;
19 int freq; 19 int freq;
20 int pos; 20 int pos;
21 bool hasEnd : 1; 21 bool hasEnd : 1;
22 time_t end; 22 QDate end;
23 time_t create; 23 QDateTime create;
24 int rep; 24 int rep;
25 QString app; 25 QString app;
26 ExceptionList list; 26 ExceptionList list;
27 QDate start; 27 QDate start;
28}; 28};
29 29
30 30
31ORecur::ORecur() { 31ORecur::ORecur() {
32 data = new Data; 32 data = new Data;
33} 33}
34ORecur::ORecur( const ORecur& rec) 34ORecur::ORecur( const ORecur& rec)
35 : data( rec.data ) 35 : data( rec.data )
@@ -43,24 +43,26 @@ ORecur::~ORecur() {
43 } 43 }
44} 44}
45void ORecur::deref() { 45void ORecur::deref() {
46 if ( data->deref() ) { 46 if ( data->deref() ) {
47 delete data; 47 delete data;
48 data = 0l; 48 data = 0l;
49 } 49 }
50} 50}
51bool ORecur::operator==( const ORecur& )const { 51bool ORecur::operator==( const ORecur& )const {
52 return false; 52 return false;
53} 53}
54ORecur &ORecur::operator=( const ORecur& re) { 54ORecur &ORecur::operator=( const ORecur& re) {
55 if ( *this == re ) return *this;
56
55 re.data->ref(); 57 re.data->ref();
56 deref(); 58 deref();
57 data = re.data; 59 data = re.data;
58 60
59 return *this; 61 return *this;
60} 62}
61bool ORecur::doesRecur()const { 63bool ORecur::doesRecur()const {
62 return !( type() == NoRepeat ); 64 return !( type() == NoRepeat );
63} 65}
64/* 66/*
65 * we try to be smart here 67 * we try to be smart here
66 * 68 *
@@ -357,33 +359,30 @@ int ORecur::frequency()const {
357 return data->freq; 359 return data->freq;
358} 360}
359int ORecur::position()const { 361int ORecur::position()const {
360 return data->pos; 362 return data->pos;
361} 363}
362char ORecur::days() const{ 364char ORecur::days() const{
363 return data->days; 365 return data->days;
364} 366}
365bool ORecur::hasEndDate()const { 367bool ORecur::hasEndDate()const {
366 return data->hasEnd; 368 return data->hasEnd;
367} 369}
368QDate ORecur::endDate()const { 370QDate ORecur::endDate()const {
369 return TimeConversion::fromUTC( data->end ).date(); 371 return data->end;
370} 372}
371QDate ORecur::start()const{ 373QDate ORecur::start()const{
372 return data->start; 374 return data->start;
373} 375}
374time_t ORecur::endDateUTC()const { 376QDateTime ORecur::createdDateTime()const {
375 return data->end;
376}
377time_t ORecur::createTime()const {
378 return data->create; 377 return data->create;
379} 378}
380int ORecur::repetition()const { 379int ORecur::repetition()const {
381 return data->rep; 380 return data->rep;
382} 381}
383QString ORecur::service()const { 382QString ORecur::service()const {
384 return data->app; 383 return data->app;
385} 384}
386ORecur::ExceptionList& ORecur::exceptions() { 385ORecur::ExceptionList& ORecur::exceptions() {
387 return data->list; 386 return data->list;
388} 387}
389void ORecur::setType( const RepeatType& z) { 388void ORecur::setType( const RepeatType& z) {
@@ -395,31 +394,27 @@ void ORecur::setFrequency( int freq ) {
395 data->freq = freq; 394 data->freq = freq;
396} 395}
397void ORecur::setPosition( int pos ) { 396void ORecur::setPosition( int pos ) {
398 checkOrModify(); 397 checkOrModify();
399 data->pos = pos; 398 data->pos = pos;
400} 399}
401void ORecur::setDays( char c ) { 400void ORecur::setDays( char c ) {
402 checkOrModify(); 401 checkOrModify();
403 data->days = c; 402 data->days = c;
404} 403}
405void ORecur::setEndDate( const QDate& dt) { 404void ORecur::setEndDate( const QDate& dt) {
406 checkOrModify(); 405 checkOrModify();
407 data->end = TimeConversion::toUTC( dt ); 406 data->end = dt;
408}
409void ORecur::setEndDateUTC( time_t t) {
410 checkOrModify();
411 data->end = t;
412} 407}
413void ORecur::setCreateTime( time_t t) { 408void ORecur::setCreatedDateTime( const QDateTime& t) {
414 checkOrModify(); 409 checkOrModify();
415 data->create = t; 410 data->create = t;
416} 411}
417void ORecur::setHasEndDate( bool b) { 412void ORecur::setHasEndDate( bool b) {
418 checkOrModify(); 413 checkOrModify();
419 data->hasEnd = b; 414 data->hasEnd = b;
420} 415}
421void ORecur::setRepitition( int rep ) { 416void ORecur::setRepitition( int rep ) {
422 checkOrModify(); 417 checkOrModify();
423 data->rep = rep; 418 data->rep = rep;
424} 419}
425void ORecur::setService( const QString& app ) { 420void ORecur::setService( const QString& app ) {