author | ar <ar> | 2004-06-01 21:38:07 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-01 21:38:07 (UTC) |
commit | baed1d5ab8589aef14440009bc4e7380bcc5a741 (patch) (unidiff) | |
tree | c636e892c5eec0df2b36d16cb601a7da41a2ef0f /libopie2/opiepim/core/opimtodo.cpp | |
parent | 4438393d8eef624565e840b798429071829adea8 (diff) | |
download | opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.zip opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.gz opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.bz2 |
- convert to odebug framework
Diffstat (limited to 'libopie2/opiepim/core/opimtodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimtodo.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp index 47433e0..27b36a6 100644 --- a/libopie2/opiepim/core/opimtodo.cpp +++ b/libopie2/opiepim/core/opimtodo.cpp | |||
@@ -1,184 +1,186 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimtodo.h" | 30 | #include "opimtodo.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimstate.h> | 33 | #include <opie2/opimstate.h> |
34 | #include <opie2/opimrecurrence.h> | 34 | #include <opie2/opimrecurrence.h> |
35 | #include <opie2/opimmaintainer.h> | 35 | #include <opie2/opimmaintainer.h> |
36 | #include <opie2/opimnotifymanager.h> | 36 | #include <opie2/opimnotifymanager.h> |
37 | #include <opie2/opimresolver.h> | 37 | #include <opie2/opimresolver.h> |
38 | #include <opie2/odebug.h> | ||
39 | |||
38 | #include <qpe/palmtopuidgen.h> | 40 | #include <qpe/palmtopuidgen.h> |
39 | #include <qpe/palmtoprecord.h> | 41 | #include <qpe/palmtoprecord.h> |
40 | #include <qpe/categories.h> | 42 | #include <qpe/categories.h> |
41 | #include <qpe/categoryselect.h> | 43 | #include <qpe/categoryselect.h> |
42 | #include <qpe/stringutil.h> | 44 | #include <qpe/stringutil.h> |
43 | 45 | ||
44 | /* QT */ | 46 | /* QT */ |
45 | #include <qobject.h> | 47 | #include <qobject.h> |
46 | #include <qshared.h> | 48 | #include <qshared.h> |
47 | 49 | ||
48 | namespace Opie | 50 | namespace Opie |
49 | { | 51 | { |
50 | 52 | ||
51 | struct OPimTodo::OPimTodoData : public QShared | 53 | struct OPimTodo::OPimTodoData : public QShared |
52 | { | 54 | { |
53 | OPimTodoData() : QShared() | 55 | OPimTodoData() : QShared() |
54 | { | 56 | { |
55 | recur = 0; | 57 | recur = 0; |
56 | state = 0; | 58 | state = 0; |
57 | maintainer = 0; | 59 | maintainer = 0; |
58 | notifiers = 0; | 60 | notifiers = 0; |
59 | }; | 61 | }; |
60 | ~OPimTodoData() | 62 | ~OPimTodoData() |
61 | { | 63 | { |
62 | delete recur; | 64 | delete recur; |
63 | delete maintainer; | 65 | delete maintainer; |
64 | delete notifiers; | 66 | delete notifiers; |
65 | } | 67 | } |
66 | 68 | ||
67 | QDate date; | 69 | QDate date; |
68 | bool isCompleted: 1; | 70 | bool isCompleted: 1; |
69 | bool hasDate: 1; | 71 | bool hasDate: 1; |
70 | int priority; | 72 | int priority; |
71 | QString desc; | 73 | QString desc; |
72 | QString sum; | 74 | QString sum; |
73 | QMap<QString, QString> extra; | 75 | QMap<QString, QString> extra; |
74 | ushort prog; | 76 | ushort prog; |
75 | OPimState *state; | 77 | OPimState *state; |
76 | OPimRecurrence *recur; | 78 | OPimRecurrence *recur; |
77 | OPimMaintainer *maintainer; | 79 | OPimMaintainer *maintainer; |
78 | QDate start; | 80 | QDate start; |
79 | QDate completed; | 81 | QDate completed; |
80 | OPimNotifyManager *notifiers; | 82 | OPimNotifyManager *notifiers; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | 85 | ||
84 | OPimTodo::OPimTodo( const OPimTodo &event ) | 86 | OPimTodo::OPimTodo( const OPimTodo &event ) |
85 | : OPimRecord( event ), data( event.data ) | 87 | : OPimRecord( event ), data( event.data ) |
86 | { | 88 | { |
87 | data->ref(); | 89 | data->ref(); |
88 | // qWarning("ref up"); | 90 | // owarn << "ref up" << oendl; |
89 | } | 91 | } |
90 | 92 | ||
91 | 93 | ||
92 | OPimTodo::~OPimTodo() | 94 | OPimTodo::~OPimTodo() |
93 | { | 95 | { |
94 | 96 | ||
95 | // qWarning("~OPimTodo " ); | 97 | // owarn << "~OPimTodo " << oendl; |
96 | if ( data->deref() ) | 98 | if ( data->deref() ) |
97 | { | 99 | { |
98 | // qWarning("OPimTodo::dereffing"); | 100 | // owarn << "OPimTodo::dereffing" << oendl; |
99 | delete data; | 101 | delete data; |
100 | data = 0l; | 102 | data = 0l; |
101 | } | 103 | } |
102 | } | 104 | } |
103 | 105 | ||
104 | 106 | ||
105 | OPimTodo::OPimTodo( bool completed, int priority, | 107 | OPimTodo::OPimTodo( bool completed, int priority, |
106 | const QArray<int> &category, | 108 | const QArray<int> &category, |
107 | const QString& summary, | 109 | const QString& summary, |
108 | const QString &description, | 110 | const QString &description, |
109 | ushort progress, | 111 | ushort progress, |
110 | bool hasDate, QDate date, int uid ) | 112 | bool hasDate, QDate date, int uid ) |
111 | : OPimRecord( uid ) | 113 | : OPimRecord( uid ) |
112 | { | 114 | { |
113 | // qWarning("OPimTodoData " + summary); | 115 | // owarn << "OPimTodoData " + summary << oendl; |
114 | setCategories( category ); | 116 | setCategories( category ); |
115 | 117 | ||
116 | data = new OPimTodoData; | 118 | data = new OPimTodoData; |
117 | 119 | ||
118 | data->date = date; | 120 | data->date = date; |
119 | data->isCompleted = completed; | 121 | data->isCompleted = completed; |
120 | data->hasDate = hasDate; | 122 | data->hasDate = hasDate; |
121 | data->priority = priority; | 123 | data->priority = priority; |
122 | data->sum = summary; | 124 | data->sum = summary; |
123 | data->prog = progress; | 125 | data->prog = progress; |
124 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 126 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
125 | } | 127 | } |
126 | 128 | ||
127 | 129 | ||
128 | OPimTodo::OPimTodo( bool completed, int priority, | 130 | OPimTodo::OPimTodo( bool completed, int priority, |
129 | const QStringList &category, | 131 | const QStringList &category, |
130 | const QString& summary, | 132 | const QString& summary, |
131 | const QString &description, | 133 | const QString &description, |
132 | ushort progress, | 134 | ushort progress, |
133 | bool hasDate, QDate date, int uid ) | 135 | bool hasDate, QDate date, int uid ) |
134 | : OPimRecord( uid ) | 136 | : OPimRecord( uid ) |
135 | { | 137 | { |
136 | // qWarning("OPimTodoData" + summary); | 138 | // owarn << "OPimTodoData" + summary << oendl; |
137 | setCategories( idsFromString( category.join( ";" ) ) ); | 139 | setCategories( idsFromString( category.join( ";" ) ) ); |
138 | 140 | ||
139 | data = new OPimTodoData; | 141 | data = new OPimTodoData; |
140 | 142 | ||
141 | data->date = date; | 143 | data->date = date; |
142 | data->isCompleted = completed; | 144 | data->isCompleted = completed; |
143 | data->hasDate = hasDate; | 145 | data->hasDate = hasDate; |
144 | data->priority = priority; | 146 | data->priority = priority; |
145 | data->sum = summary; | 147 | data->sum = summary; |
146 | data->prog = progress; | 148 | data->prog = progress; |
147 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 149 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
148 | } | 150 | } |
149 | 151 | ||
150 | 152 | ||
151 | bool OPimTodo::match( const QRegExp ®Exp ) const | 153 | bool OPimTodo::match( const QRegExp ®Exp ) const |
152 | { | 154 | { |
153 | if ( QString::number( data->priority ).find( regExp ) != -1 ) | 155 | if ( QString::number( data->priority ).find( regExp ) != -1 ) |
154 | { | 156 | { |
155 | setLastHitField( Priority ); | 157 | setLastHitField( Priority ); |
156 | return true; | 158 | return true; |
157 | } | 159 | } |
158 | else if ( data->hasDate && data->date.toString().find( regExp ) != -1 ) | 160 | else if ( data->hasDate && data->date.toString().find( regExp ) != -1 ) |
159 | { | 161 | { |
160 | setLastHitField( HasDate ); | 162 | setLastHitField( HasDate ); |
161 | return true; | 163 | return true; |
162 | } | 164 | } |
163 | else if ( data->desc.find( regExp ) != -1 ) | 165 | else if ( data->desc.find( regExp ) != -1 ) |
164 | { | 166 | { |
165 | setLastHitField( Description ); | 167 | setLastHitField( Description ); |
166 | return true; | 168 | return true; |
167 | } | 169 | } |
168 | else if ( data->sum.find( regExp ) != -1 ) | 170 | else if ( data->sum.find( regExp ) != -1 ) |
169 | { | 171 | { |
170 | setLastHitField( Summary ); | 172 | setLastHitField( Summary ); |
171 | return true; | 173 | return true; |
172 | } | 174 | } |
173 | return false; | 175 | return false; |
174 | } | 176 | } |
175 | 177 | ||
176 | 178 | ||
177 | bool OPimTodo::isCompleted() const | 179 | bool OPimTodo::isCompleted() const |
178 | { | 180 | { |
179 | return data->isCompleted; | 181 | return data->isCompleted; |
180 | } | 182 | } |
181 | 183 | ||
182 | 184 | ||
183 | bool OPimTodo::hasDueDate() const | 185 | bool OPimTodo::hasDueDate() const |
184 | { | 186 | { |
@@ -261,97 +263,97 @@ OPimState OPimTodo::state() const | |||
261 | 263 | ||
262 | bool OPimTodo::hasRecurrence() const | 264 | bool OPimTodo::hasRecurrence() const |
263 | { | 265 | { |
264 | if ( !data->recur ) return false; | 266 | if ( !data->recur ) return false; |
265 | return data->recur->doesRecur(); | 267 | return data->recur->doesRecur(); |
266 | } | 268 | } |
267 | 269 | ||
268 | 270 | ||
269 | OPimRecurrence OPimTodo::recurrence() const | 271 | OPimRecurrence OPimTodo::recurrence() const |
270 | { | 272 | { |
271 | if ( !data->recur ) return OPimRecurrence(); | 273 | if ( !data->recur ) return OPimRecurrence(); |
272 | 274 | ||
273 | return ( *data->recur ); | 275 | return ( *data->recur ); |
274 | } | 276 | } |
275 | 277 | ||
276 | 278 | ||
277 | bool OPimTodo::hasMaintainer() const | 279 | bool OPimTodo::hasMaintainer() const |
278 | { | 280 | { |
279 | if ( !data->maintainer ) return false; | 281 | if ( !data->maintainer ) return false; |
280 | 282 | ||
281 | return ( data->maintainer->mode() != OPimMaintainer::Undefined ); | 283 | return ( data->maintainer->mode() != OPimMaintainer::Undefined ); |
282 | } | 284 | } |
283 | 285 | ||
284 | 286 | ||
285 | OPimMaintainer OPimTodo::maintainer() const | 287 | OPimMaintainer OPimTodo::maintainer() const |
286 | { | 288 | { |
287 | if ( !data->maintainer ) return OPimMaintainer(); | 289 | if ( !data->maintainer ) return OPimMaintainer(); |
288 | 290 | ||
289 | return ( *data->maintainer ); | 291 | return ( *data->maintainer ); |
290 | } | 292 | } |
291 | 293 | ||
292 | 294 | ||
293 | void OPimTodo::setCompleted( bool completed ) | 295 | void OPimTodo::setCompleted( bool completed ) |
294 | { | 296 | { |
295 | changeOrModify(); | 297 | changeOrModify(); |
296 | data->isCompleted = completed; | 298 | data->isCompleted = completed; |
297 | } | 299 | } |
298 | 300 | ||
299 | 301 | ||
300 | void OPimTodo::setHasDueDate( bool hasDate ) | 302 | void OPimTodo::setHasDueDate( bool hasDate ) |
301 | { | 303 | { |
302 | changeOrModify(); | 304 | changeOrModify(); |
303 | data->hasDate = hasDate; | 305 | data->hasDate = hasDate; |
304 | } | 306 | } |
305 | 307 | ||
306 | 308 | ||
307 | void OPimTodo::setDescription( const QString &desc ) | 309 | void OPimTodo::setDescription( const QString &desc ) |
308 | { | 310 | { |
309 | // qWarning( "desc " + desc ); | 311 | // owarn << "desc " + desc << oendl; |
310 | changeOrModify(); | 312 | changeOrModify(); |
311 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); | 313 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); |
312 | } | 314 | } |
313 | 315 | ||
314 | 316 | ||
315 | void OPimTodo::setSummary( const QString& sum ) | 317 | void OPimTodo::setSummary( const QString& sum ) |
316 | { | 318 | { |
317 | changeOrModify(); | 319 | changeOrModify(); |
318 | data->sum = sum; | 320 | data->sum = sum; |
319 | } | 321 | } |
320 | 322 | ||
321 | 323 | ||
322 | void OPimTodo::setPriority( int prio ) | 324 | void OPimTodo::setPriority( int prio ) |
323 | { | 325 | { |
324 | changeOrModify(); | 326 | changeOrModify(); |
325 | data->priority = prio; | 327 | data->priority = prio; |
326 | } | 328 | } |
327 | 329 | ||
328 | 330 | ||
329 | void OPimTodo::setDueDate( const QDate& date ) | 331 | void OPimTodo::setDueDate( const QDate& date ) |
330 | { | 332 | { |
331 | changeOrModify(); | 333 | changeOrModify(); |
332 | data->date = date; | 334 | data->date = date; |
333 | } | 335 | } |
334 | 336 | ||
335 | 337 | ||
336 | void OPimTodo::setStartDate( const QDate& date ) | 338 | void OPimTodo::setStartDate( const QDate& date ) |
337 | { | 339 | { |
338 | changeOrModify(); | 340 | changeOrModify(); |
339 | data->start = date; | 341 | data->start = date; |
340 | } | 342 | } |
341 | 343 | ||
342 | 344 | ||
343 | void OPimTodo::setCompletedDate( const QDate& date ) | 345 | void OPimTodo::setCompletedDate( const QDate& date ) |
344 | { | 346 | { |
345 | changeOrModify(); | 347 | changeOrModify(); |
346 | data->completed = date; | 348 | data->completed = date; |
347 | } | 349 | } |
348 | 350 | ||
349 | 351 | ||
350 | void OPimTodo::setState( const OPimState& state ) | 352 | void OPimTodo::setState( const OPimState& state ) |
351 | { | 353 | { |
352 | changeOrModify(); | 354 | changeOrModify(); |
353 | if ( data->state ) | 355 | if ( data->state ) |
354 | ( *data->state ) = state; | 356 | ( *data->state ) = state; |
355 | else | 357 | else |
356 | data->state = new OPimState( state ); | 358 | data->state = new OPimState( state ); |
357 | } | 359 | } |
@@ -546,155 +548,155 @@ bool OPimTodo::operator>( const OPimTodo &toDoEvent ) const | |||
546 | } | 548 | } |
547 | else | 549 | else |
548 | { | 550 | { |
549 | return dueDate() > toDoEvent.dueDate(); | 551 | return dueDate() > toDoEvent.dueDate(); |
550 | } | 552 | } |
551 | } | 553 | } |
552 | return false; | 554 | return false; |
553 | } | 555 | } |
554 | 556 | ||
555 | 557 | ||
556 | bool OPimTodo::operator>=( const OPimTodo &toDoEvent ) const | 558 | bool OPimTodo::operator>=( const OPimTodo &toDoEvent ) const |
557 | { | 559 | { |
558 | if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 560 | if ( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
559 | if ( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 561 | if ( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
560 | if ( hasDueDate() && toDoEvent.hasDueDate() ) | 562 | if ( hasDueDate() && toDoEvent.hasDueDate() ) |
561 | { | 563 | { |
562 | if ( dueDate() == toDoEvent.dueDate() ) | 564 | if ( dueDate() == toDoEvent.dueDate() ) |
563 | { // let's the priority decide | 565 | { // let's the priority decide |
564 | return priority() > toDoEvent.priority(); | 566 | return priority() > toDoEvent.priority(); |
565 | } | 567 | } |
566 | else | 568 | else |
567 | { | 569 | { |
568 | return dueDate() > toDoEvent.dueDate(); | 570 | return dueDate() > toDoEvent.dueDate(); |
569 | } | 571 | } |
570 | } | 572 | } |
571 | return true; | 573 | return true; |
572 | } | 574 | } |
573 | 575 | ||
574 | 576 | ||
575 | bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const | 577 | bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const |
576 | { | 578 | { |
577 | if ( data->priority != toDoEvent.data->priority ) return false; | 579 | if ( data->priority != toDoEvent.data->priority ) return false; |
578 | if ( data->priority != toDoEvent.data->prog ) return false; | 580 | if ( data->priority != toDoEvent.data->prog ) return false; |
579 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 581 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
580 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 582 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
581 | if ( data->date != toDoEvent.data->date ) return false; | 583 | if ( data->date != toDoEvent.data->date ) return false; |
582 | if ( data->sum != toDoEvent.data->sum ) return false; | 584 | if ( data->sum != toDoEvent.data->sum ) return false; |
583 | if ( data->desc != toDoEvent.data->desc ) return false; | 585 | if ( data->desc != toDoEvent.data->desc ) return false; |
584 | if ( data->maintainer != toDoEvent.data->maintainer ) | 586 | if ( data->maintainer != toDoEvent.data->maintainer ) |
585 | return false; | 587 | return false; |
586 | 588 | ||
587 | return OPimRecord::operator==( toDoEvent ); | 589 | return OPimRecord::operator==( toDoEvent ); |
588 | } | 590 | } |
589 | 591 | ||
590 | 592 | ||
591 | void OPimTodo::deref() | 593 | void OPimTodo::deref() |
592 | { | 594 | { |
593 | 595 | ||
594 | // qWarning("deref in ToDoEvent"); | 596 | // owarn << "deref in ToDoEvent" << oendl; |
595 | if ( data->deref() ) | 597 | if ( data->deref() ) |
596 | { | 598 | { |
597 | // qWarning("deleting"); | 599 | // owarn << "deleting" << oendl; |
598 | delete data; | 600 | delete data; |
599 | data = 0; | 601 | data = 0; |
600 | } | 602 | } |
601 | } | 603 | } |
602 | 604 | ||
603 | 605 | ||
604 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) | 606 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) |
605 | { | 607 | { |
606 | if ( this == &item ) return * this; | 608 | if ( this == &item ) return * this; |
607 | 609 | ||
608 | OPimRecord::operator=( item ); | 610 | OPimRecord::operator=( item ); |
609 | //qWarning("operator= ref "); | 611 | //owarn << "operator= ref " << oendl; |
610 | item.data->ref(); | 612 | item.data->ref(); |
611 | deref(); | 613 | deref(); |
612 | data = item.data; | 614 | data = item.data; |
613 | 615 | ||
614 | return *this; | 616 | return *this; |
615 | } | 617 | } |
616 | 618 | ||
617 | 619 | ||
618 | QMap<int, QString> OPimTodo::toMap() const | 620 | QMap<int, QString> OPimTodo::toMap() const |
619 | { | 621 | { |
620 | QMap<int, QString> map; | 622 | QMap<int, QString> map; |
621 | 623 | ||
622 | map.insert( Uid, QString::number( uid() ) ); | 624 | map.insert( Uid, QString::number( uid() ) ); |
623 | map.insert( Category, idsToString( categories() ) ); | 625 | map.insert( Category, idsToString( categories() ) ); |
624 | map.insert( HasDate, QString::number( data->hasDate ) ); | 626 | map.insert( HasDate, QString::number( data->hasDate ) ); |
625 | map.insert( Completed, QString::number( data->isCompleted ) ); | 627 | map.insert( Completed, QString::number( data->isCompleted ) ); |
626 | map.insert( Description, data->desc ); | 628 | map.insert( Description, data->desc ); |
627 | map.insert( Summary, data->sum ); | 629 | map.insert( Summary, data->sum ); |
628 | map.insert( Priority, QString::number( data->priority ) ); | 630 | map.insert( Priority, QString::number( data->priority ) ); |
629 | map.insert( DateDay, QString::number( data->date.day() ) ); | 631 | map.insert( DateDay, QString::number( data->date.day() ) ); |
630 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 632 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
631 | map.insert( DateYear, QString::number( data->date.year() ) ); | 633 | map.insert( DateYear, QString::number( data->date.year() ) ); |
632 | map.insert( Progress, QString::number( data->prog ) ); | 634 | map.insert( Progress, QString::number( data->prog ) ); |
633 | // map.insert( CrossReference, crossToString() ); | 635 | // map.insert( CrossReference, crossToString() ); |
634 | /* FIXME!!! map.insert( State, ); | 636 | /* FIXME!!! map.insert( State, ); |
635 | map.insert( Recurrence, ); | 637 | map.insert( Recurrence, ); |
636 | map.insert( Reminders, ); | 638 | map.insert( Reminders, ); |
637 | map. | 639 | map. |
638 | */ | 640 | */ |
639 | return map; | 641 | return map; |
640 | } | 642 | } |
641 | 643 | ||
642 | 644 | ||
643 | /** | 645 | /** |
644 | * change or modify looks at the ref count and either | 646 | * change or modify looks at the ref count and either |
645 | * creates a new QShared Object or it can modify it | 647 | * creates a new QShared Object or it can modify it |
646 | * right in place | 648 | * right in place |
647 | */ | 649 | */ |
648 | void OPimTodo::changeOrModify() | 650 | void OPimTodo::changeOrModify() |
649 | { | 651 | { |
650 | if ( data->count != 1 ) | 652 | if ( data->count != 1 ) |
651 | { | 653 | { |
652 | qWarning( "changeOrModify" ); | 654 | owarn << "changeOrModify" << oendl; |
653 | data->deref(); | 655 | data->deref(); |
654 | OPimTodoData* d2 = new OPimTodoData(); | 656 | OPimTodoData* d2 = new OPimTodoData(); |
655 | copy( data, d2 ); | 657 | copy( data, d2 ); |
656 | data = d2; | 658 | data = d2; |
657 | } | 659 | } |
658 | } | 660 | } |
659 | 661 | ||
660 | 662 | ||
661 | // WATCHOUT | 663 | // WATCHOUT |
662 | /* | 664 | /* |
663 | * if you add something to the Data struct | 665 | * if you add something to the Data struct |
664 | * be sure to copy it here | 666 | * be sure to copy it here |
665 | */ | 667 | */ |
666 | void OPimTodo::copy( OPimTodoData* src, OPimTodoData* dest ) | 668 | void OPimTodo::copy( OPimTodoData* src, OPimTodoData* dest ) |
667 | { | 669 | { |
668 | dest->date = src->date; | 670 | dest->date = src->date; |
669 | dest->isCompleted = src->isCompleted; | 671 | dest->isCompleted = src->isCompleted; |
670 | dest->hasDate = src->hasDate; | 672 | dest->hasDate = src->hasDate; |
671 | dest->priority = src->priority; | 673 | dest->priority = src->priority; |
672 | dest->desc = src->desc; | 674 | dest->desc = src->desc; |
673 | dest->sum = src->sum; | 675 | dest->sum = src->sum; |
674 | dest->extra = src->extra; | 676 | dest->extra = src->extra; |
675 | dest->prog = src->prog; | 677 | dest->prog = src->prog; |
676 | 678 | ||
677 | if ( src->state ) | 679 | if ( src->state ) |
678 | dest->state = new OPimState( *src->state ); | 680 | dest->state = new OPimState( *src->state ); |
679 | 681 | ||
680 | if ( src->recur ) | 682 | if ( src->recur ) |
681 | dest->recur = new OPimRecurrence( *src->recur ); | 683 | dest->recur = new OPimRecurrence( *src->recur ); |
682 | 684 | ||
683 | if ( src->maintainer ) | 685 | if ( src->maintainer ) |
684 | dest->maintainer = new OPimMaintainer( *src->maintainer ) | 686 | dest->maintainer = new OPimMaintainer( *src->maintainer ) |
685 | ; | 687 | ; |
686 | dest->start = src->start; | 688 | dest->start = src->start; |
687 | dest->completed = src->completed; | 689 | dest->completed = src->completed; |
688 | 690 | ||
689 | if ( src->notifiers ) | 691 | if ( src->notifiers ) |
690 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); | 692 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); |
691 | } | 693 | } |
692 | 694 | ||
693 | 695 | ||
694 | QString OPimTodo::type() const | 696 | QString OPimTodo::type() const |
695 | { | 697 | { |
696 | return QString::fromLatin1( "OPimTodo" ); | 698 | return QString::fromLatin1( "OPimTodo" ); |
697 | } | 699 | } |
698 | 700 | ||
699 | 701 | ||
700 | QString OPimTodo::recordField( int /*id*/ ) const | 702 | QString OPimTodo::recordField( int /*id*/ ) const |