-rw-r--r-- | libkcal/todo.cpp | 7 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 29f725f..2201814 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -104,12 +104,13 @@ void Todo::setRunning( bool run ) restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); mRunStart = QDateTime::currentDateTime(); } else { mRunSaveTimer->stop(); saveRunningInfoToFile(); } + mLastSavedFileName = ""; } void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) { if ( !mRunning) return; mRunning = false; mRunStart = start; @@ -187,12 +188,18 @@ void Todo::saveRunningInfoToFile( QString comment ) } cal.addIncidence( to ); ICalFormat format( false ); file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); + if ( !mLastSavedFileName.isEmpty() ) { + if ( mLastSavedFileName != file ) { + QFile::remove( mLastSavedFileName ); + } + } + mLastSavedFileName = file; #ifndef DESKTOP_VERSION //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); #endif } void Todo::saveParents() { diff --git a/libkcal/todo.h b/libkcal/todo.h index 71b7a4e..2131732 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -131,12 +131,13 @@ namespace KCal { void saveRunningInfoToFile( ); void saveParents(); QString durationText(); private slots: void timerSlotSaveRunningInfoToFile( ); private: + QString mLastSavedFileName; void restartSaveTimer( int secs ); int mCurrentTimerDelay; bool mRunning; QTimer * mRunSaveTimer; QDateTime mRunStart; QDateTime mRunLastSave; |