author | zecke <zecke> | 2002-10-18 03:12:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-18 03:12:54 (UTC) |
commit | 07a1cb4baaf544e0e594040bbe8e5872ccb34c0f (patch) (side-by-side diff) | |
tree | ba556d2f587a65bfc3b15fc844a9383f5ef66c9e | |
parent | 86b3550348cf896b568e98d21da577c3f35a1a4a (diff) | |
download | opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.zip opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.tar.gz opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.tar.bz2 |
Fix the behaviour of isOverDue.
We currently check if the Record got a DueDate
and then do some calculations.
I added a check to see if the item isCompleted.
If it is completed it can not be overdue
Stefan: Only one item left which is overdue ;)
-rw-r--r-- | libopie/pim/otodo.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 6dd4c0e..765d5a9 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp @@ -142,97 +142,97 @@ QDateTime OTodo::alarmDateTime() const QString OTodo::description()const { return data->desc; } void OTodo::setCompleted( bool completed ) { changeOrModify(); data->isCompleted = completed; } void OTodo::setHasDueDate( bool hasDate ) { changeOrModify(); data->hasDate = hasDate; } void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) { changeOrModify(); data->hasAlarmDateTime = hasAlarmDateTime; } void OTodo::setDescription(const QString &desc ) { // qWarning( "desc " + desc ); changeOrModify(); data->desc = Qtopia::simplifyMultiLineSpace(desc ); } void OTodo::setSummary( const QString& sum ) { changeOrModify(); data->sum = sum; } void OTodo::setPriority(int prio ) { changeOrModify(); data->priority = prio; } void OTodo::setDueDate( QDate date ) { changeOrModify(); data->date = date; } void OTodo::setAlarmDateTime( const QDateTime& alarm ) { changeOrModify(); data->alarmDateTime = alarm; } bool OTodo::isOverdue( ) { - if( data->hasDate ) + if( data->hasDate && !data->isCompleted) return QDate::currentDate() > data->date; return false; } void OTodo::setProgress(ushort progress ) { changeOrModify(); data->prog = progress; } QString OTodo::toShortText() const { return summary(); } /*! Returns a richt text string */ QString OTodo::toRichText() const { QString text; QStringList catlist; // Description of the todo if ( !summary().isEmpty() ) { text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; } text += "<br><br><br>"; text += "<b>" + QObject::tr( "Priority:") +" </b>" + QString::number( priority() ) + " <br>"; text += "<b>" + QObject::tr( "Progress:") + " </b>" + QString::number( progress() ) + " %<br>"; if (hasDueDate() ){ text += "<b>" + QObject::tr( "Deadline:") + " </b>"; text += dueDate().toString(); text += "<br>"; } if (hasAlarmDateTime() ){ text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; text += alarmDateTime().toString(); text += "<br>"; } text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames().join(", "); text += "<br>"; diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 6dd4c0e..765d5a9 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp @@ -142,97 +142,97 @@ QDateTime OTodo::alarmDateTime() const QString OTodo::description()const { return data->desc; } void OTodo::setCompleted( bool completed ) { changeOrModify(); data->isCompleted = completed; } void OTodo::setHasDueDate( bool hasDate ) { changeOrModify(); data->hasDate = hasDate; } void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) { changeOrModify(); data->hasAlarmDateTime = hasAlarmDateTime; } void OTodo::setDescription(const QString &desc ) { // qWarning( "desc " + desc ); changeOrModify(); data->desc = Qtopia::simplifyMultiLineSpace(desc ); } void OTodo::setSummary( const QString& sum ) { changeOrModify(); data->sum = sum; } void OTodo::setPriority(int prio ) { changeOrModify(); data->priority = prio; } void OTodo::setDueDate( QDate date ) { changeOrModify(); data->date = date; } void OTodo::setAlarmDateTime( const QDateTime& alarm ) { changeOrModify(); data->alarmDateTime = alarm; } bool OTodo::isOverdue( ) { - if( data->hasDate ) + if( data->hasDate && !data->isCompleted) return QDate::currentDate() > data->date; return false; } void OTodo::setProgress(ushort progress ) { changeOrModify(); data->prog = progress; } QString OTodo::toShortText() const { return summary(); } /*! Returns a richt text string */ QString OTodo::toRichText() const { QString text; QStringList catlist; // Description of the todo if ( !summary().isEmpty() ) { text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; } text += "<br><br><br>"; text += "<b>" + QObject::tr( "Priority:") +" </b>" + QString::number( priority() ) + " <br>"; text += "<b>" + QObject::tr( "Progress:") + " </b>" + QString::number( progress() ) + " %<br>"; if (hasDueDate() ){ text += "<b>" + QObject::tr( "Deadline:") + " </b>"; text += dueDate().toString(); text += "<br>"; } if (hasAlarmDateTime() ){ text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; text += alarmDateTime().toString(); text += "<br>"; } text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames().join(", "); text += "<br>"; |