summaryrefslogtreecommitdiff
path: root/libopie/todoevent.cpp
Unidiff
Diffstat (limited to 'libopie/todoevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/todoevent.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index daa25f4..7dbf907 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -1,44 +1,61 @@
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 ) 7ToDoEvent::ToDoEvent(const ToDoEvent &event )
8{ 8{
9 *this = event; 9 *this = event;
10} 10}
11 11
12ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, 12ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category,
13 const QString &description, bool hasDate, QDate date, int uid ) 13 const QString &description, bool hasDate, QDate date, int uid )
14{ 14{
15 qWarning("todoEvent c'tor" ); 15 qWarning("todoEvent c'tor" );
16 m_date = date; 16 m_date = date;
17 m_isCompleted = completed; 17 m_isCompleted = completed;
18 m_hasDate = hasDate; 18 m_hasDate = hasDate;
19 m_priority = priority; 19 m_priority = priority;
20 m_category = category; 20 m_category = category;
21 m_desc = Qtopia::simplifyMultiLineSpace(description ); 21 m_desc = Qtopia::simplifyMultiLineSpace(description );
22 if (uid == -1 ) { 22 if (uid == -1 ) {
23 Qtopia::UidGen *uidgen = new Qtopia::UidGen(); 23 Qtopia::UidGen *uidgen = new Qtopia::UidGen();
24 uid = uidgen->generate(); 24 uid = uidgen->generate();
25 delete uidgen; 25 delete uidgen;
26 }// generate the ids 26 }// generate the ids
27 m_uid = uid; 27 m_uid = uid;
28} 28}
29QArray<int> ToDoEvent::categories()const
30{
31 QArray<int> array(1); // currently the datebook can be only in one category
32 array = Qtopia::Record::idsFromString( category() );
33 return array;
34}
35bool ToDoEvent::match( const QRegExp &regExp )const
36{
37 if( QString::number( m_priority ).find( regExp ) != -1 ){
38 return true;
39 }else if( m_hasDate && m_date.toString().find( regExp) != -1 ){
40 return true;
41 }else if(m_desc.find( regExp ) != -1 ){
42 return true;
43 }
44 return false;
45}
29bool ToDoEvent::isCompleted() const 46bool ToDoEvent::isCompleted() const
30{ 47{
31 return m_isCompleted; 48 return m_isCompleted;
32} 49}
33bool ToDoEvent::hasDate() const 50bool ToDoEvent::hasDate() const
34{ 51{
35 return m_hasDate; 52 return m_hasDate;
36} 53}
37int ToDoEvent::priority()const 54int ToDoEvent::priority()const
38{ 55{
39 return m_priority; 56 return m_priority;
40} 57}
41QString ToDoEvent::category()const 58QString ToDoEvent::category()const
42{ 59{
43 return m_category; 60 return m_category;
44} 61}
@@ -51,33 +68,34 @@ QString ToDoEvent::description()const
51 return m_desc; 68 return m_desc;
52} 69}
53void ToDoEvent::setCompleted( bool completed ) 70void ToDoEvent::setCompleted( bool completed )
54{ 71{
55 m_isCompleted = completed; 72 m_isCompleted = completed;
56} 73}
57void ToDoEvent::setHasDate( bool hasDate ) 74void ToDoEvent::setHasDate( bool hasDate )
58{ 75{
59 m_hasDate = hasDate; 76 m_hasDate = hasDate;
60} 77}
61void ToDoEvent::setDescription(const QString &desc ) 78void ToDoEvent::setDescription(const QString &desc )
62{ 79{
63 m_desc = Qtopia::simplifyMultiLineSpace(desc ); 80 m_desc = Qtopia::simplifyMultiLineSpace(desc );
64} 81}
65void ToDoEvent::setCategory( const QString &cat ) 82void ToDoEvent::setCategory( const QString &cat )
66{ 83{
67 m_category = cat; 84 qWarning("setCategory %s", cat.latin1() );
85 m_category = cat;
68} 86}
69void ToDoEvent::setPriority(int prio ) 87void ToDoEvent::setPriority(int prio )
70{ 88{
71 m_priority = prio; 89 m_priority = prio;
72} 90}
73void ToDoEvent::setDate( QDate date ) 91void ToDoEvent::setDate( QDate date )
74{ 92{
75 m_date = date; 93 m_date = date;
76} 94}
77bool ToDoEvent::isOverdue( ) 95bool ToDoEvent::isOverdue( )
78{ 96{
79 if( m_hasDate ) 97 if( m_hasDate )
80 return QDate::currentDate() > m_date; 98 return QDate::currentDate() > m_date;
81 return false; 99 return false;
82} 100}
83bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 101bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{