summaryrefslogtreecommitdiffabout
path: root/libkcal/todo.cpp
authorzautrix <zautrix>2005-04-16 10:17:05 (UTC)
committer zautrix <zautrix>2005-04-16 10:17:05 (UTC)
commit6cf5cc7d0b12af6bdc722e469f3f5aa293016c7d (patch) (side-by-side diff)
tree8b421d5850589c64e6642397819bbf788b6ee1b6 /libkcal/todo.cpp
parent85bdc33419eef0ffa9f00eb7222944518fe39b6c (diff)
downloadkdepimpi-6cf5cc7d0b12af6bdc722e469f3f5aa293016c7d.zip
kdepimpi-6cf5cc7d0b12af6bdc722e469f3f5aa293016c7d.tar.gz
kdepimpi-6cf5cc7d0b12af6bdc722e469f3f5aa293016c7d.tar.bz2
fix
Diffstat (limited to 'libkcal/todo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/todo.cpp1
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;