-rw-r--r-- | libopie/pim/otodo.cpp | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 3c93838..8239ba6 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp @@ -19,17 +19,16 @@ struct OTodo::OTodoData : public QShared { OTodoData() : QShared() { }; QDate date; bool isCompleted:1; bool hasDate:1; int priority; - QStringList category; QString desc; QString sum; QMap<QString, QString> extra; ushort prog; bool hasAlarmDateTime :1; QDateTime alarmDateTime; }; @@ -41,17 +40,37 @@ OTodo::OTodo(const OTodo &event ) } OTodo::~OTodo() { if ( data->deref() ) { //qWarning("OTodo::dereffing"); delete data; data = 0l; } } +OTodo::OTodo(bool completed, int priority, + const QArray<int> &category, + const QString& summary, + const QString &description, + ushort progress, + bool hasDate, QDate date, int uid ) + : OPimRecord( uid ) +{ + //qWarning("OTodoData"); + setCategories( category ); + data = new OTodoData; + data->date = date; + data->isCompleted = completed; + data->hasDate = hasDate; + data->priority = priority; + data->sum = summary; + data->prog = progress; + data->desc = Qtopia::simplifyMultiLineSpace(description ); + data->hasAlarmDateTime = false; +} OTodo::OTodo(bool completed, int priority, const QStringList &category, const QString& summary, const QString &description, ushort progress, bool hasDate, QDate date, int uid ) : OPimRecord( uid ) { @@ -262,29 +281,29 @@ bool OTodo::operator>=(const OTodo &toDoEvent )const }else{ return dueDate() > toDoEvent.dueDate(); } } return true; } bool OTodo::operator==(const OTodo &toDoEvent )const { - if( data->priority == toDoEvent.data->priority && - data->priority == toDoEvent.data->prog && - data->isCompleted == toDoEvent.data->isCompleted && - data->hasDate == toDoEvent.data->hasDate && - data->date == toDoEvent.data->date && - data->category == toDoEvent.data->category && - data->sum == toDoEvent.data->sum && - data->desc == toDoEvent.data->desc && - data->hasAlarmDateTime == toDoEvent.data->hasAlarmDateTime && - data->alarmDateTime == toDoEvent.data->alarmDateTime ) - return true; + if ( data->priority != toDoEvent.data->priority ) return false; + if ( data->priority != toDoEvent.data->prog ) return false; + if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; + if ( data->hasDate != toDoEvent.data->hasDate ) return false; + if ( data->date != toDoEvent.data->date ) return false; + if ( data->sum != toDoEvent.data->sum ) return false; + if ( data->desc != toDoEvent.data->desc ) return false; + if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) + return false; + if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) + return false; - return false; + return OPimRecord::operator==( toDoEvent ); } void OTodo::deref() { //qWarning("deref in ToDoEvent"); if ( data->deref() ) { //qWarning("deleting"); delete data; d= 0; @@ -345,10 +364,15 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { dest->priority = src->priority; dest->desc = src->desc; dest->sum = src->sum; dest->extra = src->extra; dest->prog = src->prog; dest->hasAlarmDateTime = src->hasAlarmDateTime; dest->alarmDateTime = src->alarmDateTime; } - +QString OTodo::type() const { + return QString::fromLatin1("OTodo"); +} +QString OTodo::recordField(int id )const { + return QString::null; +} |