-rw-r--r-- | libopie2/opiepim/otodo.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 189bf94..3eb0026 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -1,70 +1,98 @@ | |||
1 | 1 | /* | |
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
2 | #include <qobject.h> | 29 | #include <qobject.h> |
3 | #include <qshared.h> | 30 | #include <qshared.h> |
4 | 31 | ||
5 | 32 | ||
6 | 33 | ||
7 | #include <qpe/palmtopuidgen.h> | 34 | #include <qpe/palmtopuidgen.h> |
8 | #include <qpe/stringutil.h> | 35 | #include <qpe/stringutil.h> |
9 | #include <qpe/palmtoprecord.h> | 36 | #include <qpe/palmtoprecord.h> |
10 | #include <qpe/stringutil.h> | 37 | #include <qpe/stringutil.h> |
11 | #include <qpe/categories.h> | 38 | #include <qpe/categories.h> |
12 | #include <qpe/categoryselect.h> | 39 | #include <qpe/categoryselect.h> |
13 | 40 | ||
14 | 41 | ||
15 | #include "opimstate.h" | 42 | #include <opie2/opimstate.h> |
16 | #include "orecur.h" | 43 | #include <opie2/orecur.h> |
17 | #include "opimmaintainer.h" | 44 | #include <opie2/opimmaintainer.h> |
18 | #include "opimnotifymanager.h" | 45 | #include <opie2/opimnotifymanager.h> |
19 | #include "opimresolver.h" | 46 | #include <opie2/opimresolver.h> |
20 | 47 | ||
21 | #include "otodo.h" | 48 | #include <opie2/otodo.h> |
22 | 49 | ||
50 | namespace Opie { | ||
23 | 51 | ||
24 | struct OTodo::OTodoData : public QShared { | 52 | struct OTodo::OTodoData : public QShared { |
25 | OTodoData() : QShared() { | 53 | OTodoData() : QShared() { |
26 | recur = 0; | 54 | recur = 0; |
27 | state = 0; | 55 | state = 0; |
28 | maintainer = 0; | 56 | maintainer = 0; |
29 | notifiers = 0; | 57 | notifiers = 0; |
30 | }; | 58 | }; |
31 | ~OTodoData() { | 59 | ~OTodoData() { |
32 | delete recur; | 60 | delete recur; |
33 | delete maintainer; | 61 | delete maintainer; |
34 | delete notifiers; | 62 | delete notifiers; |
35 | } | 63 | } |
36 | 64 | ||
37 | QDate date; | 65 | QDate date; |
38 | bool isCompleted:1; | 66 | bool isCompleted:1; |
39 | bool hasDate:1; | 67 | bool hasDate:1; |
40 | int priority; | 68 | int priority; |
41 | QString desc; | 69 | QString desc; |
42 | QString sum; | 70 | QString sum; |
43 | QMap<QString, QString> extra; | 71 | QMap<QString, QString> extra; |
44 | ushort prog; | 72 | ushort prog; |
45 | OPimState *state; | 73 | OPimState *state; |
46 | ORecur *recur; | 74 | ORecur *recur; |
47 | OPimMaintainer *maintainer; | 75 | OPimMaintainer *maintainer; |
48 | QDate start; | 76 | QDate start; |
49 | QDate completed; | 77 | QDate completed; |
50 | OPimNotifyManager *notifiers; | 78 | OPimNotifyManager *notifiers; |
51 | }; | 79 | }; |
52 | 80 | ||
53 | OTodo::OTodo(const OTodo &event ) | 81 | OTodo::OTodo(const OTodo &event ) |
54 | : OPimRecord( event ), data( event.data ) | 82 | : OPimRecord( event ), data( event.data ) |
55 | { | 83 | { |
56 | data->ref(); | 84 | data->ref(); |
57 | // qWarning("ref up"); | 85 | // qWarning("ref up"); |
58 | } | 86 | } |
59 | OTodo::~OTodo() { | 87 | OTodo::~OTodo() { |
60 | 88 | ||
61 | // qWarning("~OTodo " ); | 89 | // qWarning("~OTodo " ); |
62 | if ( data->deref() ) { | 90 | if ( data->deref() ) { |
63 | // qWarning("OTodo::dereffing"); | 91 | // qWarning("OTodo::dereffing"); |
64 | delete data; | 92 | delete data; |
65 | data = 0l; | 93 | data = 0l; |
66 | } | 94 | } |
67 | } | 95 | } |
68 | OTodo::OTodo(bool completed, int priority, | 96 | OTodo::OTodo(bool completed, int priority, |
69 | const QArray<int> &category, | 97 | const QArray<int> &category, |
70 | const QString& summary, | 98 | const QString& summary, |
@@ -473,48 +501,50 @@ void OTodo::changeOrModify() { | |||
473 | if ( data->count != 1 ) { | 501 | if ( data->count != 1 ) { |
474 | qWarning("changeOrModify"); | 502 | qWarning("changeOrModify"); |
475 | data->deref(); | 503 | data->deref(); |
476 | OTodoData* d2 = new OTodoData(); | 504 | OTodoData* d2 = new OTodoData(); |
477 | copy(data, d2 ); | 505 | copy(data, d2 ); |
478 | data = d2; | 506 | data = d2; |
479 | } | 507 | } |
480 | } | 508 | } |
481 | // WATCHOUT | 509 | // WATCHOUT |
482 | /* | 510 | /* |
483 | * if you add something to the Data struct | 511 | * if you add something to the Data struct |
484 | * be sure to copy it here | 512 | * be sure to copy it here |
485 | */ | 513 | */ |
486 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { | 514 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { |
487 | dest->date = src->date; | 515 | dest->date = src->date; |
488 | dest->isCompleted = src->isCompleted; | 516 | dest->isCompleted = src->isCompleted; |
489 | dest->hasDate = src->hasDate; | 517 | dest->hasDate = src->hasDate; |
490 | dest->priority = src->priority; | 518 | dest->priority = src->priority; |
491 | dest->desc = src->desc; | 519 | dest->desc = src->desc; |
492 | dest->sum = src->sum; | 520 | dest->sum = src->sum; |
493 | dest->extra = src->extra; | 521 | dest->extra = src->extra; |
494 | dest->prog = src->prog; | 522 | dest->prog = src->prog; |
495 | 523 | ||
496 | if (src->state ) | 524 | if (src->state ) |
497 | dest->state = new OPimState( *src->state ); | 525 | dest->state = new OPimState( *src->state ); |
498 | 526 | ||
499 | if (src->recur ) | 527 | if (src->recur ) |
500 | dest->recur = new ORecur( *src->recur ); | 528 | dest->recur = new ORecur( *src->recur ); |
501 | 529 | ||
502 | if (src->maintainer ) | 530 | if (src->maintainer ) |
503 | dest->maintainer = new OPimMaintainer( *src->maintainer ) | 531 | dest->maintainer = new OPimMaintainer( *src->maintainer ) |
504 | ; | 532 | ; |
505 | dest->start = src->start; | 533 | dest->start = src->start; |
506 | dest->completed = src->completed; | 534 | dest->completed = src->completed; |
507 | 535 | ||
508 | if (src->notifiers ) | 536 | if (src->notifiers ) |
509 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); | 537 | dest->notifiers = new OPimNotifyManager( *src->notifiers ); |
510 | } | 538 | } |
511 | QString OTodo::type() const { | 539 | QString OTodo::type() const { |
512 | return QString::fromLatin1("OTodo"); | 540 | return QString::fromLatin1("OTodo"); |
513 | } | 541 | } |
514 | QString OTodo::recordField(int /*id*/ )const { | 542 | QString OTodo::recordField(int /*id*/ )const { |
515 | return QString::null; | 543 | return QString::null; |
516 | } | 544 | } |
517 | 545 | ||
518 | int OTodo::rtti(){ | 546 | int OTodo::rtti(){ |
519 | return OPimResolver::TodoList; | 547 | return OPimResolver::TodoList; |
520 | } | 548 | } |
549 | |||
550 | } | ||