summaryrefslogtreecommitdiffabout
path: root/libkcal/todo.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/todo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/todo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index cc1c5ae..5a0c32e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -578,97 +578,97 @@ bool Todo::setRecurDates()
return false;
} else {
setHasRecurrenceID( false );
recurrence()->unsetRecurs();
}
return true;
}
void Todo::setPercentComplete(int v)
{
if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) {
if ( !setRecurDates() )
v = 0;
}
mPercentComplete = v;
if ( v != 100 )
mHasCompletedDate = false;
updated();
}
QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
*ok = false;
if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) {
return QDateTime ();
}
// if the recurring todo is set to complete and requested time < start time of todo
// we want to get the alarm.
bool iscompleted = isCompleted();
if ( iscompleted && doesRecur() ) {
Todo * to = (Todo*) this;
to->checkSetCompletedFalse();
iscompleted = isCompleted();
if ( hasStartDate() && start_dt < dtStart() ){
iscompleted = false;
}
}
if ( iscompleted ) {
return QDateTime ();
}
QDateTime incidenceStart;
incidenceStart = dtDue();
bool enabled = false;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
if ( alarmStart > start_dt ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
}
void Todo::checkSetCompletedFalse()
{
if ( !mHasRecurrenceID ) {
qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
return;
}
// qDebug("Todo::checkSetCompletedFalse()");
//qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
if ( mPercentComplete == 100 ) {
QDateTime dt = QDateTime::currentDateTime();
if ( dt > mDtStart && dt > mRecurrenceID ) {
qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
setCompleted( false );
qDebug("Todo::checkSetCompletedFalse ");
}
}
}
QString Todo::durationText()