summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/otodo.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/otodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/otodo.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 4d5cb79..6fcf9f6 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -13,8 +13,10 @@
#include "opimstate.h"
#include "orecur.h"
+#include "opimmaintainer.h"
+
#include "otodo.h"
struct OTodo::OTodoData : public QShared {
@@ -32,8 +34,9 @@ struct OTodo::OTodoData : public QShared {
bool hasAlarmDateTime :1;
QDateTime alarmDateTime;
OPimState state;
ORecur recur;
+ OPimMaintainer maintainer;
};
OTodo::OTodo(const OTodo &event )
: OPimRecord( event ), data( event.data )
@@ -152,8 +155,11 @@ OPimState OTodo::state()const {
}
ORecur OTodo::recurrence()const {
return data->recur;
}
+OPimMaintainer OTodo::maintainer()const {
+ return data->maintainer;
+}
void OTodo::setCompleted( bool completed )
{
changeOrModify();
data->isCompleted = completed;
@@ -201,8 +207,12 @@ void OTodo::setState( const OPimState& state ) {
void OTodo::setRecurrence( const ORecur& rec) {
changeOrModify();
data->recur = rec;
}
+void OTodo::setMaintainer( const OPimMaintainer& pim ) {
+ changeOrModify();
+ data->maintainer = pim;
+}
bool OTodo::isOverdue( )
{
if( data->hasDate && !data->isCompleted)
return QDate::currentDate() > data->date;
@@ -320,8 +330,10 @@ bool OTodo::operator==(const OTodo &toDoEvent )const
if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime )
return false;
if ( data->alarmDateTime != toDoEvent.data->alarmDateTime )
return false;
+ if ( data->maintainer != toDoEvent.data->maintainer )
+ return false;
return OPimRecord::operator==( toDoEvent );
}
void OTodo::deref() {
@@ -357,9 +369,9 @@ QMap<int, QString> OTodo::toMap() const {
map.insert( DateDay, QString::number( data->date.day() ) );
map.insert( DateMonth, QString::number( data->date.month() ) );
map.insert( DateYear, QString::number( data->date.year() ) );
map.insert( Progress, QString::number( data->prog ) );
- map.insert( CrossReference, crossToString() );
+// map.insert( CrossReference, crossToString() );
map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) );
map.insert( AlarmDateTime, data->alarmDateTime.toString() );
return map;
@@ -381,8 +393,13 @@ void OTodo::changeOrModify() {
copy(data, d2 );
data = d2;
}
}
+// WATCHOUT
+/*
+ * if you add something to the Data struct
+ * be sure to copy it here
+ */
void OTodo::copy( OTodoData* src, OTodoData* dest ) {
dest->date = src->date;
dest->isCompleted = src->isCompleted;
dest->hasDate = src->hasDate;
@@ -394,8 +411,9 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) {
dest->hasAlarmDateTime = src->hasAlarmDateTime;
dest->alarmDateTime = src->alarmDateTime;
dest->state = src->state;
dest->recur = src->recur;
+ dest->maintainer = src->maintainer;
}
QString OTodo::type() const {
return QString::fromLatin1("OTodo");
}