summaryrefslogtreecommitdiff
path: root/libopie
Side-by-side diff
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/todoevent.cpp20
-rw-r--r--libopie/todoevent.h3
2 files changed, 22 insertions, 1 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index daa25f4..7dbf907 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -1,13 +1,13 @@
#include <opie/todoevent.h>
#include <qpe/palmtopuidgen.h>
#include <qpe/stringutil.h>
-//#include <qpe/palmtoprecord.h>
+#include <qpe/palmtoprecord.h>
ToDoEvent::ToDoEvent(const ToDoEvent &event )
{
*this = event;
}
ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category,
const QString &description, bool hasDate, QDate date, int uid )
@@ -21,16 +21,33 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category,
m_desc = Qtopia::simplifyMultiLineSpace(description );
if (uid == -1 ) {
Qtopia::UidGen *uidgen = new Qtopia::UidGen();
uid = uidgen->generate();
delete uidgen;
}// generate the ids
m_uid = uid;
}
+QArray<int> ToDoEvent::categories()const
+{
+ QArray<int> array(1); // currently the datebook can be only in one category
+ array = Qtopia::Record::idsFromString( category() );
+ return array;
+}
+bool ToDoEvent::match( const QRegExp &regExp )const
+{
+ if( QString::number( m_priority ).find( regExp ) != -1 ){
+ return true;
+ }else if( m_hasDate && m_date.toString().find( regExp) != -1 ){
+ return true;
+ }else if(m_desc.find( regExp ) != -1 ){
+ return true;
+ }
+ return false;
+}
bool ToDoEvent::isCompleted() const
{
return m_isCompleted;
}
bool ToDoEvent::hasDate() const
{
return m_hasDate;
}
@@ -59,16 +76,17 @@ void ToDoEvent::setHasDate( bool hasDate )
m_hasDate = hasDate;
}
void ToDoEvent::setDescription(const QString &desc )
{
m_desc = Qtopia::simplifyMultiLineSpace(desc );
}
void ToDoEvent::setCategory( const QString &cat )
{
+ qWarning("setCategory %s", cat.latin1() );
m_category = cat;
}
void ToDoEvent::setPriority(int prio )
{
m_priority = prio;
}
void ToDoEvent::setDate( QDate date )
{
diff --git a/libopie/todoevent.h b/libopie/todoevent.h
index bca7f6e..ac996a1 100644
--- a/libopie/todoevent.h
+++ b/libopie/todoevent.h
@@ -12,29 +12,32 @@ class ToDoEvent {
const QString &category = QString::null,
const QString &description = QString::null ,
bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 );
ToDoEvent(const ToDoEvent & );
bool isCompleted() const;
bool hasDate() const;
int priority()const ;
QString category()const;
+ QArray<int> categories() const;
QDate date()const;
QString description()const;
int uid()const { return m_uid;};
void setCompleted(bool completed );
void setHasDate( bool hasDate );
// if the category doesn't exist we will create it
void setCategory( const QString &category );
void setPriority(int priority );
void setDate( QDate date );
void setDescription(const QString& );
bool isOverdue();
+ bool match( const QRegExp &r )const;
+
void setUid(int id) {m_uid = id; };
bool operator<(const ToDoEvent &toDoEvent )const;
bool operator<=(const ToDoEvent &toDoEvent )const;
bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); };
bool operator>(const ToDoEvent &toDoEvent )const;
bool operator>=(const ToDoEvent &toDoEvent)const;
bool operator==(const ToDoEvent &toDoEvent )const;
ToDoEvent &operator=(const ToDoEvent &toDoEvent );