-rw-r--r-- | libopie2/opiepim/otodo.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 8239ba6..b3c14e6 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp @@ -23,74 +23,79 @@ struct OTodo::OTodoData : public QShared { QDate date; bool isCompleted:1; bool hasDate:1; int priority; 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"); + qWarning("ref up"); } OTodo::~OTodo() { + qWarning("~OTodo " + data->sum ); if ( data->deref() ) { - //qWarning("OTodo::dereffing"); + 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"); + qWarning("OTodoData " + summary); 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"); + qWarning("OTodoData" + summary); setCategories( idsFromString( category.join(";") ) ); + 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; } bool OTodo::match( const QRegExp ®Exp )const { if( QString::number( data->priority ).find( regExp ) != -1 ){ return true; }else if( data->hasDate && data->date.toString().find( regExp) != -1 ){ return true; }else if(data->desc.find( regExp ) != -1 ){ @@ -337,33 +342,33 @@ QMap<int, QString> OTodo::toMap() const { map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); map.insert( AlarmDateTime, data->alarmDateTime.toString() ); return map; } QMap<QString, QString> OTodo::toExtraMap()const { return data->extra; } /** * change or modify looks at the ref count and either * creates a new QShared Object or it can modify it * right in place */ void OTodo::changeOrModify() { if ( data->count != 1 ) { - //qWarning("changeOrModify"); + qWarning("changeOrModify"); data->deref(); OTodoData* d2 = new OTodoData(); copy(data, d2 ); data = d2; } } 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; |