-rw-r--r-- | libkcal/todo.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 8794f7a..7906046 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -21,12 +21,14 @@ #include <kglobal.h> #include <kglobalsettings.h> #include <klocale.h> #include <kdebug.h> #include <qregexp.h> +#include "calendarlocal.h" +#include "icalformat.h" #include "todo.h" using namespace KCal; Todo::Todo(): Incidence() { @@ -52,12 +54,13 @@ Todo::Todo(const Todo &t) : Incidence(t) mRunSaveTimer = 0; } Todo::~Todo() { setRunning( false ); + qDebug("Todo::~Todo() "); } void Todo::setRunning( bool run ) { if ( run == mRunning ) return; @@ -78,34 +81,29 @@ void Todo::setRunning( bool run ) void Todo::saveRunningInfoToFile() { qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); QString dir = KGlobalSettings::timeTrackerDir(); qDebug("%s ", dir.latin1()); - QString file = "%1-%2-%3-%4-%5-%6-%7.tt"; - - 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 ).arg( mRunStart.time().msec(), 3 ); + QString file = "%1%2%3-%4%5%6-%7%8%9-"; + int runtime = mRunStart.secsTo( QDateTime::currentDateTime() ); + runtime = (runtime / 60) +1; + int h = runtime / 60; + int m = runtime % 60; + int d = h / 24; + h = h % 24; + 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 ).arg( d,3 ).arg( h,2 ).arg( m,2 ); file.replace ( QRegExp (" "), "0" ); - file = dir +"/" +file; - qDebug("%s ", file.latin1()); - QStringList dataList; - - //Summary - //Category - //CategoryColor - //StartRuntime - //Runtime - //Due - //Start - //Prio - //Erledigt - //Uid - //Parents uids + file = dir +"/" +file + uid()+".ics"; + qDebug("File %s ",file.latin1() ); + CalendarLocal cal; + cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); + cal.addIncidence( clone() ); + ICalFormat format; + format.save( &cal, file ); - - } int Todo::runTime() { if ( !mRunning ) return 0; |