-rw-r--r-- | libopie/pim/otodo.cpp | 81 | ||||
-rw-r--r-- | libopie/pim/otodo.h | 16 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 81 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.h | 16 |
4 files changed, 164 insertions, 30 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index ea66d39..f3df119 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -25,2 +25,6 @@ struct OTodo::OTodoData : public QShared { | |||
25 | OTodoData() : QShared() { | 25 | OTodoData() : QShared() { |
26 | recur = 0; | ||
27 | state = 0; | ||
28 | maintainer = 0; | ||
29 | notifiers = 0; | ||
26 | }; | 30 | }; |
@@ -35,8 +39,8 @@ struct OTodo::OTodoData : public QShared { | |||
35 | ushort prog; | 39 | ushort prog; |
36 | OPimState state; | 40 | OPimState *state; |
37 | ORecur recur; | 41 | ORecur *recur; |
38 | OPimMaintainer maintainer; | 42 | OPimMaintainer *maintainer; |
39 | QDate start; | 43 | QDate start; |
40 | QDate completed; | 44 | QDate completed; |
41 | OPimNotifyManager notifiers; | 45 | OPimNotifyManager *notifiers; |
42 | }; | 46 | }; |
@@ -153,10 +157,32 @@ QString OTodo::description()const | |||
153 | } | 157 | } |
158 | bool OTodo::hasState() const{ | ||
159 | if (!data->state ) return false; | ||
160 | return ( data->state->state() != OPimState::Undefined ); | ||
161 | } | ||
154 | OPimState OTodo::state()const { | 162 | OPimState OTodo::state()const { |
155 | return data->state; | 163 | if (!data->state ) { |
164 | OPimState state; | ||
165 | return state; | ||
166 | } | ||
167 | |||
168 | return (*data->state); | ||
169 | } | ||
170 | bool OTodo::hasRecurrence()const { | ||
171 | if (!data->recur) return false; | ||
172 | return data->recur->doesRecur(); | ||
156 | } | 173 | } |
157 | ORecur OTodo::recurrence()const { | 174 | ORecur OTodo::recurrence()const { |
158 | return data->recur; | 175 | if (!data->recur) return ORecur(); |
176 | |||
177 | return (*data->recur); | ||
178 | } | ||
179 | bool OTodo::hasMaintainer()const { | ||
180 | if (!data->maintainer) return false; | ||
181 | |||
182 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); | ||
159 | } | 183 | } |
160 | OPimMaintainer OTodo::maintainer()const { | 184 | OPimMaintainer OTodo::maintainer()const { |
161 | return data->maintainer; | 185 | if (!data->maintainer) return OPimMaintainer(); |
186 | |||
187 | return (*data->maintainer); | ||
162 | } | 188 | } |
@@ -203,3 +229,6 @@ void OTodo::setState( const OPimState& state ) { | |||
203 | changeOrModify(); | 229 | changeOrModify(); |
204 | data->state = state; | 230 | if (data->state ) |
231 | (*data->state) = state; | ||
232 | else | ||
233 | data->state = new OPimState( state ); | ||
205 | } | 234 | } |
@@ -207,3 +236,6 @@ void OTodo::setRecurrence( const ORecur& rec) { | |||
207 | changeOrModify(); | 236 | changeOrModify(); |
208 | data->recur = rec; | 237 | if (data->recur ) |
238 | (*data->recur) = rec; | ||
239 | else | ||
240 | data->recur = new ORecur( rec ); | ||
209 | } | 241 | } |
@@ -211,3 +243,7 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) { | |||
211 | changeOrModify(); | 243 | changeOrModify(); |
212 | data->maintainer = pim; | 244 | |
245 | if (data->maintainer ) | ||
246 | (*data->maintainer) = pim; | ||
247 | else | ||
248 | data->maintainer = new OPimMaintainer( pim ); | ||
213 | } | 249 | } |
@@ -262,4 +298,10 @@ QString OTodo::toRichText() const | |||
262 | } | 298 | } |
299 | bool OTodo::hasNotifiers()const { | ||
300 | if (!data->notifiers) return false; | ||
301 | return data->notifiers->isEmpty(); | ||
302 | } | ||
263 | OPimNotifyManager& OTodo::notifiers() { | 303 | OPimNotifyManager& OTodo::notifiers() { |
264 | return data->notifiers; | 304 | if (!data->notifiers ) |
305 | data->notifiers = new OPimNotifyManager; | ||
306 | return (*data->notifiers); | ||
265 | } | 307 | } |
@@ -407,8 +449,17 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { | |||
407 | dest->prog = src->prog; | 449 | dest->prog = src->prog; |
408 | dest->state = src->state; | 450 | |
409 | dest->recur = src->recur; | 451 | if (src->state ) |
410 | dest->maintainer = src->maintainer; | 452 | dest->state = new OPimState( *src->state ); |
453 | |||
454 | if (src->recur ) | ||
455 | dest->recur = new ORecur( *src->recur ); | ||
456 | |||
457 | if (src->maintainer ) | ||
458 | dest->maintainer = new OPimMaintainer( *src->maintainer ) | ||
459 | ; | ||
411 | dest->start = src->start; | 460 | dest->start = src->start; |
412 | dest->completed = src->completed; | 461 | dest->completed = src->completed; |
413 | dest->notifiers = src->notifiers; | 462 | |
463 | if (src->notifiers ) | ||
464 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); | ||
414 | } | 465 | } |
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h index 2f66f55..a58d9aa 100644 --- a/libopie/pim/otodo.h +++ b/libopie/pim/otodo.h | |||
@@ -130,2 +130,7 @@ public: | |||
130 | /** | 130 | /** |
131 | * does it have a state? | ||
132 | */ | ||
133 | bool hasState()const; | ||
134 | |||
135 | /** | ||
131 | * What is the state of this OTodo? | 136 | * What is the state of this OTodo? |
@@ -135,2 +140,7 @@ public: | |||
135 | /** | 140 | /** |
141 | * has recurrence? | ||
142 | */ | ||
143 | bool hasRecurrence()const; | ||
144 | |||
145 | /** | ||
136 | * the recurrance of this | 146 | * the recurrance of this |
@@ -140,2 +150,7 @@ public: | |||
140 | /** | 150 | /** |
151 | * does this OTodo have a maintainer? | ||
152 | */ | ||
153 | bool hasMaintainer()const; | ||
154 | |||
155 | /** | ||
141 | * the Maintainer of this OTodo | 156 | * the Maintainer of this OTodo |
@@ -160,2 +175,3 @@ public: | |||
160 | 175 | ||
176 | bool hasNotifiers()const; | ||
161 | /* | 177 | /* |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index ea66d39..f3df119 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -25,2 +25,6 @@ struct OTodo::OTodoData : public QShared { | |||
25 | OTodoData() : QShared() { | 25 | OTodoData() : QShared() { |
26 | recur = 0; | ||
27 | state = 0; | ||
28 | maintainer = 0; | ||
29 | notifiers = 0; | ||
26 | }; | 30 | }; |
@@ -35,8 +39,8 @@ struct OTodo::OTodoData : public QShared { | |||
35 | ushort prog; | 39 | ushort prog; |
36 | OPimState state; | 40 | OPimState *state; |
37 | ORecur recur; | 41 | ORecur *recur; |
38 | OPimMaintainer maintainer; | 42 | OPimMaintainer *maintainer; |
39 | QDate start; | 43 | QDate start; |
40 | QDate completed; | 44 | QDate completed; |
41 | OPimNotifyManager notifiers; | 45 | OPimNotifyManager *notifiers; |
42 | }; | 46 | }; |
@@ -153,10 +157,32 @@ QString OTodo::description()const | |||
153 | } | 157 | } |
158 | bool OTodo::hasState() const{ | ||
159 | if (!data->state ) return false; | ||
160 | return ( data->state->state() != OPimState::Undefined ); | ||
161 | } | ||
154 | OPimState OTodo::state()const { | 162 | OPimState OTodo::state()const { |
155 | return data->state; | 163 | if (!data->state ) { |
164 | OPimState state; | ||
165 | return state; | ||
166 | } | ||
167 | |||
168 | return (*data->state); | ||
169 | } | ||
170 | bool OTodo::hasRecurrence()const { | ||
171 | if (!data->recur) return false; | ||
172 | return data->recur->doesRecur(); | ||
156 | } | 173 | } |
157 | ORecur OTodo::recurrence()const { | 174 | ORecur OTodo::recurrence()const { |
158 | return data->recur; | 175 | if (!data->recur) return ORecur(); |
176 | |||
177 | return (*data->recur); | ||
178 | } | ||
179 | bool OTodo::hasMaintainer()const { | ||
180 | if (!data->maintainer) return false; | ||
181 | |||
182 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); | ||
159 | } | 183 | } |
160 | OPimMaintainer OTodo::maintainer()const { | 184 | OPimMaintainer OTodo::maintainer()const { |
161 | return data->maintainer; | 185 | if (!data->maintainer) return OPimMaintainer(); |
186 | |||
187 | return (*data->maintainer); | ||
162 | } | 188 | } |
@@ -203,3 +229,6 @@ void OTodo::setState( const OPimState& state ) { | |||
203 | changeOrModify(); | 229 | changeOrModify(); |
204 | data->state = state; | 230 | if (data->state ) |
231 | (*data->state) = state; | ||
232 | else | ||
233 | data->state = new OPimState( state ); | ||
205 | } | 234 | } |
@@ -207,3 +236,6 @@ void OTodo::setRecurrence( const ORecur& rec) { | |||
207 | changeOrModify(); | 236 | changeOrModify(); |
208 | data->recur = rec; | 237 | if (data->recur ) |
238 | (*data->recur) = rec; | ||
239 | else | ||
240 | data->recur = new ORecur( rec ); | ||
209 | } | 241 | } |
@@ -211,3 +243,7 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) { | |||
211 | changeOrModify(); | 243 | changeOrModify(); |
212 | data->maintainer = pim; | 244 | |
245 | if (data->maintainer ) | ||
246 | (*data->maintainer) = pim; | ||
247 | else | ||
248 | data->maintainer = new OPimMaintainer( pim ); | ||
213 | } | 249 | } |
@@ -262,4 +298,10 @@ QString OTodo::toRichText() const | |||
262 | } | 298 | } |
299 | bool OTodo::hasNotifiers()const { | ||
300 | if (!data->notifiers) return false; | ||
301 | return data->notifiers->isEmpty(); | ||
302 | } | ||
263 | OPimNotifyManager& OTodo::notifiers() { | 303 | OPimNotifyManager& OTodo::notifiers() { |
264 | return data->notifiers; | 304 | if (!data->notifiers ) |
305 | data->notifiers = new OPimNotifyManager; | ||
306 | return (*data->notifiers); | ||
265 | } | 307 | } |
@@ -407,8 +449,17 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { | |||
407 | dest->prog = src->prog; | 449 | dest->prog = src->prog; |
408 | dest->state = src->state; | 450 | |
409 | dest->recur = src->recur; | 451 | if (src->state ) |
410 | dest->maintainer = src->maintainer; | 452 | dest->state = new OPimState( *src->state ); |
453 | |||
454 | if (src->recur ) | ||
455 | dest->recur = new ORecur( *src->recur ); | ||
456 | |||
457 | if (src->maintainer ) | ||
458 | dest->maintainer = new OPimMaintainer( *src->maintainer ) | ||
459 | ; | ||
411 | dest->start = src->start; | 460 | dest->start = src->start; |
412 | dest->completed = src->completed; | 461 | dest->completed = src->completed; |
413 | dest->notifiers = src->notifiers; | 462 | |
463 | if (src->notifiers ) | ||
464 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); | ||
414 | } | 465 | } |
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 2f66f55..a58d9aa 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h | |||
@@ -130,2 +130,7 @@ public: | |||
130 | /** | 130 | /** |
131 | * does it have a state? | ||
132 | */ | ||
133 | bool hasState()const; | ||
134 | |||
135 | /** | ||
131 | * What is the state of this OTodo? | 136 | * What is the state of this OTodo? |
@@ -135,2 +140,7 @@ public: | |||
135 | /** | 140 | /** |
141 | * has recurrence? | ||
142 | */ | ||
143 | bool hasRecurrence()const; | ||
144 | |||
145 | /** | ||
136 | * the recurrance of this | 146 | * the recurrance of this |
@@ -140,2 +150,7 @@ public: | |||
140 | /** | 150 | /** |
151 | * does this OTodo have a maintainer? | ||
152 | */ | ||
153 | bool hasMaintainer()const; | ||
154 | |||
155 | /** | ||
141 | * the Maintainer of this OTodo | 156 | * the Maintainer of this OTodo |
@@ -160,2 +175,3 @@ public: | |||
160 | 175 | ||
176 | bool hasNotifiers()const; | ||
161 | /* | 177 | /* |