-rw-r--r-- | libkcal/todo.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 39d16b6..a496404 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -98,193 +98,195 @@ bool Todo::contains ( Todo* from ) QString nCat; unsigned int iii; for ( iii = 0; iii < catFrom.count();++iii ) { nCat = catFrom[iii]; if ( !nCat.isEmpty() ) if ( !cat.contains( nCat )) { return false; } } if ( from->isCompleted() ) { if ( !isCompleted() ) return false; } if( priority() != from->priority() ) return false; return true; } bool KCal::operator==( const Todo& t1, const Todo& t2 ) { bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); if ( ! ret ) return false; if ( t1.hasDueDate() == t2.hasDueDate() ) { if ( t1.hasDueDate() ) { if ( t1.doesFloat() == t2.doesFloat() ) { if ( t1.doesFloat() ) { if ( t1.dtDue().date() != t2.dtDue().date() ) return false; } else if ( t1.dtDue() != t2.dtDue() ) return false; } else return false;// float != } } else return false; if ( t1.percentComplete() != t2.percentComplete() ) return false; if ( t1.isCompleted() ) { if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { if ( t1.hasCompletedDate() ) { if ( t1.completed() != t2.completed() ) return false; } } else return false; } return true; } void Todo::setDtDue(const QDateTime &dtDue) { //int diffsecs = mDtDue.secsTo(dtDue); /*if (mReadOnly) return; const QPtrList<Alarm>& alarms = alarms(); for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { if (alarm->enabled()) { alarm->setTime(alarm->time().addSecs(diffsecs)); } }*/ mDtDue = getEvenTime(dtDue); //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; /*const QPtrList<Alarm>& alarms = alarms(); for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) alarm->setAlarmStart(mDtDue);*/ updated(); } QDateTime Todo::dtDue() const { return mDtDue; } QString Todo::dtDueTimeStr() const { return KGlobal::locale()->formatTime(mDtDue.time()); } QString Todo::dtDueDateStr(bool shortfmt) const { return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); } QString Todo::dtDueStr(bool shortfmt) const { - return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); + if ( doesFloat() ) + return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); + return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); } // retval 0 : no found // 1 : due for date found // 2 : overdue for date found int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) { int retval = 0; if ( isCompleted() ) return 0; if ( hasDueDate() ) { if ( dtDue().date() < date ) return 2; // we do not return, because we may find an overdue sub todo if ( dtDue().date() == date ) retval = 1; } if ( checkSubtodos ) { Incidence *aTodo; for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); if ( ret == 2 ) return 2; if ( ret == 1) retval = 1; } } return retval; } int Todo::hasDueSubTodo( bool checkSubtodos ) //= true { return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); } bool Todo::hasDueDate() const { return mHasDueDate; } void Todo::setHasDueDate(bool f) { if (mReadOnly) return; mHasDueDate = f; updated(); } #if 0 void Todo::setStatus(const QString &statStr) { if (mReadOnly) return; QString ss(statStr.upper()); if (ss == "X-ACTION") mStatus = NEEDS_ACTION; else if (ss == "NEEDS ACTION") mStatus = NEEDS_ACTION; else if (ss == "ACCEPTED") mStatus = ACCEPTED; else if (ss == "SENT") mStatus = SENT; else if (ss == "TENTATIVE") mStatus = TENTATIVE; else if (ss == "CONFIRMED") mStatus = CONFIRMED; else if (ss == "DECLINED") mStatus = DECLINED; else if (ss == "COMPLETED") mStatus = COMPLETED; else if (ss == "DELEGATED") mStatus = DELEGATED; updated(); } void Todo::setStatus(int status) { if (mReadOnly) return; mStatus = status; updated(); } int Todo::status() const { return mStatus; } QString Todo::statusStr() const { switch(mStatus) { case NEEDS_ACTION: return QString("NEEDS ACTION"); break; case ACCEPTED: return QString("ACCEPTED"); break; case SENT: return QString("SENT"); |