Diffstat (limited to 'libopie2/opiepim/core/orecur.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/orecur.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp index 6c81f8f..257d4fd 100644 --- a/libopie2/opiepim/core/orecur.cpp +++ b/libopie2/opiepim/core/orecur.cpp | |||
@@ -12,24 +12,25 @@ struct ORecur::Data : public QShared { | |||
12 | pos = 0; | 12 | pos = 0; |
13 | create = -1; | 13 | create = -1; |
14 | hasEnd = FALSE; | 14 | hasEnd = FALSE; |
15 | end = 0; | 15 | end = 0; |
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 | time_t end; |
23 | time_t create; | 23 | time_t create; |
24 | int rep; | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | 27 | ||
27 | ORecur::ORecur() { | 28 | ORecur::ORecur() { |
28 | data = new Data; | 29 | data = new Data; |
29 | } | 30 | } |
30 | ORecur::ORecur( const ORecur& rec) | 31 | ORecur::ORecur( const ORecur& rec) |
31 | : data( rec.data ) | 32 | : data( rec.data ) |
32 | { | 33 | { |
33 | data->ref(); | 34 | data->ref(); |
34 | } | 35 | } |
35 | ORecur::~ORecur() { | 36 | ORecur::~ORecur() { |
@@ -69,24 +70,27 @@ char ORecur::days() const{ | |||
69 | bool ORecur::hasEndDate()const { | 70 | bool ORecur::hasEndDate()const { |
70 | return data->hasEnd; | 71 | return data->hasEnd; |
71 | } | 72 | } |
72 | QDate ORecur::endDate()const { | 73 | QDate ORecur::endDate()const { |
73 | return TimeConversion::fromUTC( data->end ).date(); | 74 | return TimeConversion::fromUTC( data->end ).date(); |
74 | } | 75 | } |
75 | time_t ORecur::endDateUTC()const { | 76 | time_t ORecur::endDateUTC()const { |
76 | return data->end; | 77 | return data->end; |
77 | } | 78 | } |
78 | time_t ORecur::createTime()const { | 79 | time_t ORecur::createTime()const { |
79 | return data->create; | 80 | return data->create; |
80 | } | 81 | } |
82 | int ORecur::repetition()const { | ||
83 | return data->rep; | ||
84 | } | ||
81 | void ORecur::setType( const RepeatType& z) { | 85 | void ORecur::setType( const RepeatType& z) { |
82 | checkOrModify(); | 86 | checkOrModify(); |
83 | data->type = z; | 87 | data->type = z; |
84 | } | 88 | } |
85 | void ORecur::setFrequency( int freq ) { | 89 | void ORecur::setFrequency( int freq ) { |
86 | checkOrModify(); | 90 | checkOrModify(); |
87 | data->freq = freq; | 91 | data->freq = freq; |
88 | } | 92 | } |
89 | void ORecur::setPosition( int pos ) { | 93 | void ORecur::setPosition( int pos ) { |
90 | checkOrModify(); | 94 | checkOrModify(); |
91 | data->pos = pos; | 95 | data->pos = pos; |
92 | } | 96 | } |
@@ -101,27 +105,32 @@ void ORecur::setEndDate( const QDate& dt) { | |||
101 | void ORecur::setEndDateUTC( time_t t) { | 105 | void ORecur::setEndDateUTC( time_t t) { |
102 | checkOrModify(); | 106 | checkOrModify(); |
103 | data->end = t; | 107 | data->end = t; |
104 | } | 108 | } |
105 | void ORecur::setCreateTime( time_t t) { | 109 | void ORecur::setCreateTime( time_t t) { |
106 | checkOrModify(); | 110 | checkOrModify(); |
107 | data->create = t; | 111 | data->create = t; |
108 | } | 112 | } |
109 | void ORecur::setHasEndDate( bool b) { | 113 | void ORecur::setHasEndDate( bool b) { |
110 | checkOrModify(); | 114 | checkOrModify(); |
111 | data->hasEnd = b; | 115 | data->hasEnd = b; |
112 | } | 116 | } |
117 | void ORecur::setRepitition( int rep ) { | ||
118 | checkOrModify(); | ||
119 | data->rep = rep; | ||
120 | } | ||
113 | void ORecur::checkOrModify() { | 121 | void ORecur::checkOrModify() { |
114 | if ( data->count != 1 ) { | 122 | if ( data->count != 1 ) { |
115 | data->deref(); | 123 | data->deref(); |
116 | Data* d2 = new Data; | 124 | Data* d2 = new Data; |
117 | d2->days = data->days; | 125 | d2->days = data->days; |
118 | d2->type = data->type; | 126 | d2->type = data->type; |
119 | d2->freq = data->freq; | 127 | d2->freq = data->freq; |
120 | d2->pos = data->pos; | 128 | d2->pos = data->pos; |
121 | d2->hasEnd = data->hasEnd; | 129 | d2->hasEnd = data->hasEnd; |
122 | d2->end = data->end; | 130 | d2->end = data->end; |
123 | d2->create = data->create; | 131 | d2->create = data->create; |
132 | d2->rep = data->rep; | ||
124 | data = d2; | 133 | data = d2; |
125 | } | 134 | } |
126 | } | 135 | } |
127 | 136 | ||