summaryrefslogtreecommitdiff
path: root/libopie/todoevent.cpp
Unidiff
Diffstat (limited to 'libopie/todoevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/todoevent.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index 5fa4472..daa25f4 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -1,152 +1,158 @@
1 1
2#include <opie/todoevent.h> 2#include <opie/todoevent.h>
3#include <qpe/palmtopuidgen.h> 3#include <qpe/palmtopuidgen.h>
4#include <qpe/stringutil.h> 4#include <qpe/stringutil.h>
5//#include <qpe/palmtoprecord.h> 5//#include <qpe/palmtoprecord.h>
6 6
7ToDoEvent::ToDoEvent(const ToDoEvent &event )
8{
9 *this = event;
10}
11
7ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, 12ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category,
8 const QString &description, bool hasDate, QDate date, int uid ) 13 const QString &description, bool hasDate, QDate date, int uid )
9{ 14{
10 qWarning("todoEvent c'tor" ); 15 qWarning("todoEvent c'tor" );
11 m_date = date; 16 m_date = date;
12 m_isCompleted = completed; 17 m_isCompleted = completed;
13 m_hasDate = hasDate; 18 m_hasDate = hasDate;
14 m_priority = priority; 19 m_priority = priority;
15 m_category = category; 20 m_category = category;
16 m_desc = Qtopia::simplifyMultiLineSpace(description ); 21 m_desc = Qtopia::simplifyMultiLineSpace(description );
17 if (uid == -1 ) { 22 if (uid == -1 ) {
18 Qtopia::UidGen *uidgen = new Qtopia::UidGen(); 23 Qtopia::UidGen *uidgen = new Qtopia::UidGen();
19 uid = uidgen->generate(); 24 uid = uidgen->generate();
20 delete uidgen; 25 delete uidgen;
21 }// generate the ids 26 }// generate the ids
22 m_uid = uid; 27 m_uid = uid;
23} 28}
24bool ToDoEvent::isCompleted() const 29bool ToDoEvent::isCompleted() const
25{ 30{
26 return m_isCompleted; 31 return m_isCompleted;
27} 32}
28bool ToDoEvent::hasDate() const 33bool ToDoEvent::hasDate() const
29{ 34{
30 return m_hasDate; 35 return m_hasDate;
31} 36}
32int ToDoEvent::priority()const 37int ToDoEvent::priority()const
33{ 38{
34 return m_priority; 39 return m_priority;
35} 40}
36QString ToDoEvent::category()const 41QString ToDoEvent::category()const
37{ 42{
38 return m_category; 43 return m_category;
39} 44}
40QDate ToDoEvent::date()const 45QDate ToDoEvent::date()const
41{ 46{
42 return m_date; 47 return m_date;
43} 48}
44QString ToDoEvent::description()const 49QString ToDoEvent::description()const
45{ 50{
46 return m_desc; 51 return m_desc;
47} 52}
48void ToDoEvent::setCompleted( bool completed ) 53void ToDoEvent::setCompleted( bool completed )
49{ 54{
50 m_isCompleted = completed; 55 m_isCompleted = completed;
51} 56}
52void ToDoEvent::setHasDate( bool hasDate ) 57void ToDoEvent::setHasDate( bool hasDate )
53{ 58{
54 m_hasDate = hasDate; 59 m_hasDate = hasDate;
55} 60}
56void ToDoEvent::setDescription(const QString &desc ) 61void ToDoEvent::setDescription(const QString &desc )
57{ 62{
58 m_desc = Qtopia::simplifyMultiLineSpace(desc ); 63 m_desc = Qtopia::simplifyMultiLineSpace(desc );
59} 64}
60void ToDoEvent::setCategory( const QString &cat ) 65void ToDoEvent::setCategory( const QString &cat )
61{ 66{
62 m_category = cat; 67 m_category = cat;
63} 68}
64void ToDoEvent::setPriority(int prio ) 69void ToDoEvent::setPriority(int prio )
65{ 70{
66 m_priority = prio; 71 m_priority = prio;
67} 72}
68void ToDoEvent::setDate( QDate date ) 73void ToDoEvent::setDate( QDate date )
69{ 74{
70 m_date = date; 75 m_date = date;
71} 76}
72bool ToDoEvent::isOverdue( ) 77bool ToDoEvent::isOverdue( )
73{ 78{
74 if( m_hasDate ) 79 if( m_hasDate )
75 return QDate::currentDate() > m_date; 80 return QDate::currentDate() > m_date;
76 return false; 81 return false;
77} 82}
78bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 83bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{
79 if( !hasDate() && !toDoEvent.hasDate() ) return true; 84 if( !hasDate() && !toDoEvent.hasDate() ) return true;
80 if( !hasDate() && toDoEvent.hasDate() ) return true; 85 if( !hasDate() && toDoEvent.hasDate() ) return true;
81 if( hasDate() && toDoEvent.hasDate() ){ 86 if( hasDate() && toDoEvent.hasDate() ){
82 if( date() == toDoEvent.date() ){ // let's the priority decide 87 if( date() == toDoEvent.date() ){ // let's the priority decide
83 return priority() < toDoEvent.priority(); 88 return priority() < toDoEvent.priority();
84 }else{ 89 }else{
85 return date() < toDoEvent.date(); 90 return date() < toDoEvent.date();
86 } 91 }
87 } 92 }
88 return false; 93 return false;
89} 94}
90bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const 95bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const
91{ 96{
92 if( !hasDate() && !toDoEvent.hasDate() ) return true; 97 if( !hasDate() && !toDoEvent.hasDate() ) return true;
93 if( !hasDate() && toDoEvent.hasDate() ) return true; 98 if( !hasDate() && toDoEvent.hasDate() ) return true;
94 if( hasDate() && toDoEvent.hasDate() ){ 99 if( hasDate() && toDoEvent.hasDate() ){
95 if( date() == toDoEvent.date() ){ // let's the priority decide 100 if( date() == toDoEvent.date() ){ // let's the priority decide
96 return priority() <= toDoEvent.priority(); 101 return priority() <= toDoEvent.priority();
97 }else{ 102 }else{
98 return date() <= toDoEvent.date(); 103 return date() <= toDoEvent.date();
99 } 104 }
100 } 105 }
101 return true; 106 return true;
102} 107}
103bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const 108bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const
104{ 109{
105 if( !hasDate() && !toDoEvent.hasDate() ) return false; 110 if( !hasDate() && !toDoEvent.hasDate() ) return false;
106 if( !hasDate() && toDoEvent.hasDate() ) return false; 111 if( !hasDate() && toDoEvent.hasDate() ) return false;
107 if( hasDate() && toDoEvent.hasDate() ){ 112 if( hasDate() && toDoEvent.hasDate() ){
108 if( date() == toDoEvent.date() ){ // let's the priority decide 113 if( date() == toDoEvent.date() ){ // let's the priority decide
109 return priority() > toDoEvent.priority(); 114 return priority() > toDoEvent.priority();
110 }else{ 115 }else{
111 return date() > toDoEvent.date(); 116 return date() > toDoEvent.date();
112 } 117 }
113 } 118 }
114 return false; 119 return false;
115} 120}
116bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const 121bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const
117{ 122{
118 if( !hasDate() && !toDoEvent.hasDate() ) return true; 123 if( !hasDate() && !toDoEvent.hasDate() ) return true;
119 if( !hasDate() && toDoEvent.hasDate() ) return false; 124 if( !hasDate() && toDoEvent.hasDate() ) return false;
120 if( hasDate() && toDoEvent.hasDate() ){ 125 if( hasDate() && toDoEvent.hasDate() ){
121 if( date() == toDoEvent.date() ){ // let's the priority decide 126 if( date() == toDoEvent.date() ){ // let's the priority decide
122 return priority() > toDoEvent.priority(); 127 return priority() > toDoEvent.priority();
123 }else{ 128 }else{
124 return date() > toDoEvent.date(); 129 return date() > toDoEvent.date();
125 } 130 }
126 } 131 }
127 return true; 132 return true;
128} 133}
129bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const 134bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const
130{ 135{
131 if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_category ) 136 if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_category )
132 return true; 137 return true;
133 return false; 138 return false;
134} 139}
135ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) 140ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
136{ 141{
137 m_date = item.m_date; 142 m_date = item.m_date;
138 m_isCompleted = item.m_isCompleted; 143 m_isCompleted = item.m_isCompleted;
139 m_hasDate = item.m_hasDate; 144 m_hasDate = item.m_hasDate;
140 m_priority = item.m_priority; 145 m_priority = item.m_priority;
141 m_category = item.m_category; 146 m_category = item.m_category;
142 m_desc = item.m_desc; 147 m_desc = item.m_desc;
148 m_uid = item.m_uid;
143 return *this; 149 return *this;
144} 150}
145 151
146 152
147 153
148 154
149 155
150 156
151 157
152 158