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