summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/todoevent.cpp22
-rw-r--r--libopie/todoevent.h3
2 files changed, 23 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,9 +1,9 @@
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;
@@ -25,8 +25,25 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category,
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}
@@ -63,9 +80,10 @@ void ToDoEvent::setDescription(const QString &desc )
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;
diff --git a/libopie/todoevent.h b/libopie/todoevent.h
index bca7f6e..ac996a1 100644
--- a/libopie/todoevent.h
+++ b/libopie/todoevent.h
@@ -16,8 +16,9 @@ class ToDoEvent {
16 bool isCompleted() const; 16 bool isCompleted() const;
17 bool hasDate() const; 17 bool hasDate() const;
18 int priority()const ; 18 int priority()const ;
19 QString category()const; 19 QString category()const;
20 QArray<int> categories() const;
20 QDate date()const; 21 QDate date()const;
21 QString description()const; 22 QString description()const;
22 23
23 int uid()const { return m_uid;}; 24 int uid()const { return m_uid;};
@@ -29,8 +30,10 @@ class ToDoEvent {
29 void setDate( QDate date ); 30 void setDate( QDate date );
30 void setDescription(const QString& ); 31 void setDescription(const QString& );
31 bool isOverdue(); 32 bool isOverdue();
32 33
34 bool match( const QRegExp &r )const;
35
33 void setUid(int id) {m_uid = id; }; 36 void setUid(int id) {m_uid = id; };
34 bool operator<(const ToDoEvent &toDoEvent )const; 37 bool operator<(const ToDoEvent &toDoEvent )const;
35 bool operator<=(const ToDoEvent &toDoEvent )const; 38 bool operator<=(const ToDoEvent &toDoEvent )const;
36 bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); }; 39 bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); };