author | zecke <zecke> | 2002-09-21 15:02:50 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-21 15:02:50 (UTC) |
commit | e6c53c4d7317e766235449535b22d0d2fe709214 (patch) (side-by-side diff) | |
tree | c210c639611acd5aa3c1863451fb4e31ac3af29a /libopie2/opiepim/otodo.cpp | |
parent | fe0806def8ec79815832193fe402c75361108622 (diff) | |
download | opie-e6c53c4d7317e766235449535b22d0d2fe709214.zip opie-e6c53c4d7317e766235449535b22d0d2fe709214.tar.gz opie-e6c53c4d7317e766235449535b22d0d2fe709214.tar.bz2 |
Some more implementation
in OPimRecord::setUid
ORecordList implemented never compiled it though
OTodo a new c'tor and some more changes
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 3c93838..8239ba6 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp @@ -15,47 +15,66 @@ #include "otodo.h" 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; }; OTodo::OTodo(const OTodo &event ) : OPimRecord( event ), data( event.data ) { data->ref(); //qWarning("ref up"); } 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 ) { //qWarning("OTodoData"); setCategories( idsFromString( category.join(";") ) ); data = new OTodoData; data->date = date; @@ -258,37 +277,37 @@ bool OTodo::operator>=(const OTodo &toDoEvent )const if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; if( hasDueDate() && toDoEvent.hasDueDate() ){ if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide return priority() > toDoEvent.priority(); }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; } } OTodo &OTodo::operator=(const OTodo &item ) { @@ -341,14 +360,19 @@ void OTodo::changeOrModify() { void OTodo::copy( OTodoData* src, OTodoData* dest ) { dest->date = src->date; dest->isCompleted = src->isCompleted; dest->hasDate = src->hasDate; 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; +} |