summaryrefslogtreecommitdiff
path: root/libopie/todoevent.cpp
authorzecke <zecke>2002-03-20 21:45:51 (UTC)
committer zecke <zecke>2002-03-20 21:45:51 (UTC)
commite9189f8d0cc46b0532fdcbcb2377ae3d108666d5 (patch) (unidiff)
tree20af6104c262510595b82e619ee69b0958596ddd /libopie/todoevent.cpp
parent0b39bb8d62f67a86128a6bd16afbd2aae004637c (diff)
downloadopie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.zip
opie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.tar.gz
opie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.tar.bz2
vCal Resource for the tododb
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,80 +1,82 @@
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