-rw-r--r-- | libkcal/todo.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 5e6ac22..6a6c137 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -90,96 +90,97 @@ void Todo::saveRunningInfoToFile() QString dir = KGlobalSettings::timeTrackerDir(); //qDebug("%s ", dir.latin1()); QString file = "%1%2%3-%4%5%6-"; file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); file.replace ( QRegExp (" "), "0" ); file += uid(); //qDebug("File %s ",file.latin1() ); CalendarLocal cal; cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); Todo * to = (Todo*) clone(); to->setFloats( false ); to->setDtStart( mRunStart ); to->setHasStartDate( true ); to->setDtDue( QDateTime::currentDateTime() ); to->setHasDueDate( true ); to->setUid( file ); cal.addIncidence( to ); ICalFormat format; file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); } void Todo::saveParents() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); if ( inc->type() != "Todo" ) return; Todo* to = (Todo*)inc; bool saveTodo = false; QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; QFileInfo fi ( file ); if ( fi.exists() ) { if ( fi.lastModified () < to->lastModified ()) saveTodo = true; } else { saveTodo = true; } if ( saveTodo ) { CalendarLocal cal; cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); Todo * par = (Todo *) to->clone(); cal.addIncidence( par ); ICalFormat format; format.save( &cal, file ); } + to->saveParents(); } int Todo::runTime() { if ( !mRunning ) return 0; return mRunStart.secsTo( QDateTime::currentDateTime() ); } bool Todo::hasRunningSub() { if ( mRunning ) return true; Incidence *aTodo; for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { if ( ((Todo*)aTodo)->hasRunningSub() ) return true; } return false; } Incidence *Todo::clone() { return new Todo(*this); } bool Todo::contains ( Todo* from ) { if ( !from->summary().isEmpty() ) if ( !summary().startsWith( from->summary() )) return false; if ( from->hasStartDate() ) { if ( !hasStartDate() ) return false; if ( from->dtStart() != dtStart()) return false; } if ( from->hasDueDate() ){ if ( !hasDueDate() ) return false; if ( from->dtDue() != dtDue()) return false; } if ( !from->location().isEmpty() ) if ( !location().startsWith( from->location() ) ) return false; if ( !from->description().isEmpty() ) if ( !description().startsWith( from->description() )) return false; |