summaryrefslogtreecommitdiff
path: root/core/pim/todo/smalltodo.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/smalltodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/smalltodo.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/pim/todo/smalltodo.cpp b/core/pim/todo/smalltodo.cpp
index 412fe9e..504256d 100644
--- a/core/pim/todo/smalltodo.cpp
+++ b/core/pim/todo/smalltodo.cpp
@@ -1,114 +1,113 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28#include <qshared.h>
29 28
30#include "smalltodo.h" 29#include "smalltodo.h"
31 30
32using namespace Todo; 31using namespace Todo;
33 32
34struct SmallTodo::SmallTodoPrivate : public QShared{ 33struct SmallTodo::SmallTodoPrivate : public QShared{
35 34
36 SmallTodoPrivate() : QShared(), uid(-1) {}; 35 SmallTodoPrivate() : QShared(), uid(-1) {};
37 QString name; 36 QString name;
38 QStringList categories; // as real Names 37 QStringList categories; // as real Names
39 int uid; 38 int uid;
40 bool complete:1; 39 bool complete:1;
41 QDate date; 40 QDate date;
42 41
43 42
44 void deleteSelf() { delete this; }; 43 void deleteSelf() { delete this; };
45}; 44};
46 45
47SmallTodo::SmallTodo(int uid, 46SmallTodo::SmallTodo(int uid,
48 bool comp, 47 bool comp,
49 const QDate& date, 48 const QDate& date,
50 const QString& name, 49 const QString& name,
51 const QStringList& cats) { 50 const QStringList& cats) {
52 d = new SmallTodoPrivate(); 51 d = new SmallTodoPrivate();
53 d->name = name; 52 d->name = name;
54 d->uid = uid; 53 d->uid = uid;
55 d->categories = cats; 54 d->categories = cats;
56 d->complete = comp; 55 d->complete = comp;
57 d->date = date; 56 d->date = date;
58} 57}
59SmallTodo::SmallTodo( const SmallTodo& s ) : d(s.d) { 58SmallTodo::SmallTodo( const SmallTodo& s ) : d(s.d) {
60 d->ref(); 59 d->ref();
61} 60}
62SmallTodo::~SmallTodo() { 61SmallTodo::~SmallTodo() {
63 /* deref and if last one delete */ 62 /* deref and if last one delete */
64 if ( d->deref() ) { 63 if ( d->deref() ) {
65 d->deleteSelf(); 64 d->deleteSelf();
66 } 65 }
67} 66}
68bool SmallTodo::operator==( const SmallTodo& todo ) { 67bool SmallTodo::operator==( const SmallTodo& todo ) {
69 if ( d->complete != todo.d->complete ) return false; 68 if ( d->complete != todo.d->complete ) return false;
70 if ( d->name != todo.d->name ) return false; 69 if ( d->name != todo.d->name ) return false;
71 if ( d->uid != todo.d->uid ) return false; 70 if ( d->uid != todo.d->uid ) return false;
72 if ( d->categories != todo.d->categories ) return false; 71 if ( d->categories != todo.d->categories ) return false;
73 if ( d->date != todo.d->date ) return false; 72 if ( d->date != todo.d->date ) return false;
74 73
75 return true; 74 return true;
76} 75}
77bool SmallTodo::operator==( const SmallTodo& todo ) const{ 76bool SmallTodo::operator==( const SmallTodo& todo ) const{
78 if ( d->complete != todo.d->complete ) return false; 77 if ( d->complete != todo.d->complete ) return false;
79 if ( d->uid != todo.d->uid ) return false; 78 if ( d->uid != todo.d->uid ) return false;
80 if ( d->name != todo.d->name ) return false; 79 if ( d->name != todo.d->name ) return false;
81 if ( d->categories != todo.d->categories ) return false; 80 if ( d->categories != todo.d->categories ) return false;
82 if ( d->date != todo.d->date ) return false; 81 if ( d->date != todo.d->date ) return false;
83 82
84 return true; 83 return true;
85} 84}
86SmallTodo &SmallTodo::operator=( const SmallTodo& todo ) { 85SmallTodo &SmallTodo::operator=( const SmallTodo& todo ) {
87 todo.d->ref(); 86 todo.d->ref();
88 deref(); 87 deref();
89 88
90 d = todo.d; 89 d = todo.d;
91 90
92 return *this; 91 return *this;
93} 92}
94void SmallTodo::deref() { 93void SmallTodo::deref() {
95 if ( d->deref() ) { 94 if ( d->deref() ) {
96 delete d; 95 delete d;
97 d = 0; 96 d = 0;
98 } 97 }
99} 98}
100QString SmallTodo::name() const { 99QString SmallTodo::name() const {
101 return d->name; 100 return d->name;
102} 101}
103QStringList SmallTodo::categories()const { 102QStringList SmallTodo::categories()const {
104 return d->categories; 103 return d->categories;
105} 104}
106int SmallTodo::uid()const { 105int SmallTodo::uid()const {
107 return d->uid; 106 return d->uid;
108} 107}
109bool SmallTodo::isCompleted()const { 108bool SmallTodo::isCompleted()const {
110 return d->complete; 109 return d->complete;
111} 110}
112QDate SmallTodo::date()const { 111QDate SmallTodo::date()const {
113 return d->date; 112 return d->date;
114} 113}