summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodo.cpp81
-rw-r--r--libopie/pim/otodo.h16
-rw-r--r--libopie2/opiepim/otodo.cpp81
-rw-r--r--libopie2/opiepim/otodo.h16
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
@@ -24,4 +24,8 @@
24struct OTodo::OTodoData : public QShared { 24struct OTodo::OTodoData : public QShared {
25 OTodoData() : QShared() { 25 OTodoData() : QShared() {
26 recur = 0;
27 state = 0;
28 maintainer = 0;
29 notifiers = 0;
26 }; 30 };
27 31
@@ -34,10 +38,10 @@ struct OTodo::OTodoData : public QShared {
34 QMap<QString, QString> extra; 38 QMap<QString, QString> extra;
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};
43 47
@@ -152,12 +156,34 @@ QString OTodo::description()const
152 return data->desc; 156 return data->desc;
153} 157}
158bool OTodo::hasState() const{
159 if (!data->state ) return false;
160 return ( data->state->state() != OPimState::Undefined );
161}
154OPimState OTodo::state()const { 162OPimState OTodo::state()const {
155 return data->state; 163 if (!data->state ) {
164 OPimState state;
165 return state;
166 }
167
168 return (*data->state);
169}
170bool OTodo::hasRecurrence()const {
171 if (!data->recur) return false;
172 return data->recur->doesRecur();
156} 173}
157ORecur OTodo::recurrence()const { 174ORecur OTodo::recurrence()const {
158 return data->recur; 175 if (!data->recur) return ORecur();
176
177 return (*data->recur);
178}
179bool OTodo::hasMaintainer()const {
180 if (!data->maintainer) return false;
181
182 return (data->maintainer->mode() != OPimMaintainer::Undefined );
159} 183}
160OPimMaintainer OTodo::maintainer()const { 184OPimMaintainer OTodo::maintainer()const {
161 return data->maintainer; 185 if (!data->maintainer) return OPimMaintainer();
186
187 return (*data->maintainer);
162} 188}
163void OTodo::setCompleted( bool completed ) 189void OTodo::setCompleted( bool completed )
@@ -202,13 +228,23 @@ void OTodo::setCompletedDate( const QDate& date ) {
202void OTodo::setState( const OPimState& state ) { 228void 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}
206void OTodo::setRecurrence( const ORecur& rec) { 235void 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}
210void OTodo::setMaintainer( const OPimMaintainer& pim ) { 242void 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}
214bool OTodo::isOverdue( ) 250bool OTodo::isOverdue( )
@@ -261,6 +297,12 @@ QString OTodo::toRichText() const
261 return text; 297 return text;
262} 298}
299bool OTodo::hasNotifiers()const {
300 if (!data->notifiers) return false;
301 return data->notifiers->isEmpty();
302}
263OPimNotifyManager& OTodo::notifiers() { 303OPimNotifyManager& OTodo::notifiers() {
264 return data->notifiers; 304 if (!data->notifiers )
305 data->notifiers = new OPimNotifyManager;
306 return (*data->notifiers);
265} 307}
266 308
@@ -406,10 +448,19 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
406 dest->extra = src->extra; 448 dest->extra = src->extra;
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}
415QString OTodo::type() const { 466QString OTodo::type() const {
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
@@ -129,4 +129,9 @@ public:
129 129
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?
132 */ 137 */
@@ -134,4 +139,9 @@ public:
134 139
135 /** 140 /**
141 * has recurrence?
142 */
143 bool hasRecurrence()const;
144
145 /**
136 * the recurrance of this 146 * the recurrance of this
137 */ 147 */
@@ -139,4 +149,9 @@ public:
139 149
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
142 */ 157 */
@@ -159,4 +174,5 @@ public:
159 QString toRichText() const; 174 QString toRichText() const;
160 175
176 bool hasNotifiers()const;
161 /* 177 /*
162 * check if the sharing is still fine!! -zecke 178 * check if the sharing is still fine!! -zecke
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
@@ -24,4 +24,8 @@
24struct OTodo::OTodoData : public QShared { 24struct OTodo::OTodoData : public QShared {
25 OTodoData() : QShared() { 25 OTodoData() : QShared() {
26 recur = 0;
27 state = 0;
28 maintainer = 0;
29 notifiers = 0;
26 }; 30 };
27 31
@@ -34,10 +38,10 @@ struct OTodo::OTodoData : public QShared {
34 QMap<QString, QString> extra; 38 QMap<QString, QString> extra;
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};
43 47
@@ -152,12 +156,34 @@ QString OTodo::description()const
152 return data->desc; 156 return data->desc;
153} 157}
158bool OTodo::hasState() const{
159 if (!data->state ) return false;
160 return ( data->state->state() != OPimState::Undefined );
161}
154OPimState OTodo::state()const { 162OPimState OTodo::state()const {
155 return data->state; 163 if (!data->state ) {
164 OPimState state;
165 return state;
166 }
167
168 return (*data->state);
169}
170bool OTodo::hasRecurrence()const {
171 if (!data->recur) return false;
172 return data->recur->doesRecur();
156} 173}
157ORecur OTodo::recurrence()const { 174ORecur OTodo::recurrence()const {
158 return data->recur; 175 if (!data->recur) return ORecur();
176
177 return (*data->recur);
178}
179bool OTodo::hasMaintainer()const {
180 if (!data->maintainer) return false;
181
182 return (data->maintainer->mode() != OPimMaintainer::Undefined );
159} 183}
160OPimMaintainer OTodo::maintainer()const { 184OPimMaintainer OTodo::maintainer()const {
161 return data->maintainer; 185 if (!data->maintainer) return OPimMaintainer();
186
187 return (*data->maintainer);
162} 188}
163void OTodo::setCompleted( bool completed ) 189void OTodo::setCompleted( bool completed )
@@ -202,13 +228,23 @@ void OTodo::setCompletedDate( const QDate& date ) {
202void OTodo::setState( const OPimState& state ) { 228void 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}
206void OTodo::setRecurrence( const ORecur& rec) { 235void 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}
210void OTodo::setMaintainer( const OPimMaintainer& pim ) { 242void 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}
214bool OTodo::isOverdue( ) 250bool OTodo::isOverdue( )
@@ -261,6 +297,12 @@ QString OTodo::toRichText() const
261 return text; 297 return text;
262} 298}
299bool OTodo::hasNotifiers()const {
300 if (!data->notifiers) return false;
301 return data->notifiers->isEmpty();
302}
263OPimNotifyManager& OTodo::notifiers() { 303OPimNotifyManager& OTodo::notifiers() {
264 return data->notifiers; 304 if (!data->notifiers )
305 data->notifiers = new OPimNotifyManager;
306 return (*data->notifiers);
265} 307}
266 308
@@ -406,10 +448,19 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
406 dest->extra = src->extra; 448 dest->extra = src->extra;
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}
415QString OTodo::type() const { 466QString OTodo::type() const {
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
@@ -129,4 +129,9 @@ public:
129 129
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?
132 */ 137 */
@@ -134,4 +139,9 @@ public:
134 139
135 /** 140 /**
141 * has recurrence?
142 */
143 bool hasRecurrence()const;
144
145 /**
136 * the recurrance of this 146 * the recurrance of this
137 */ 147 */
@@ -139,4 +149,9 @@ public:
139 149
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
142 */ 157 */
@@ -159,4 +174,5 @@ public:
159 QString toRichText() const; 174 QString toRichText() const;
160 175
176 bool hasNotifiers()const;
161 /* 177 /*
162 * check if the sharing is still fine!! -zecke 178 * check if the sharing is still fine!! -zecke