author | zautrix <zautrix> | 2005-09-28 00:42:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-28 00:42:41 (UTC) |
commit | 4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2 (patch) (side-by-side diff) | |
tree | cbfbb81858c5ec08ba16e45b511ddbab539af864 | |
parent | e6112c5497b334d6dc38108b37963c5e803413d3 (diff) | |
download | kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.zip kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.tar.gz kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.tar.bz2 |
save tt fix
-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 @@ -98,24 +98,25 @@ void Todo::setRunning( bool run ) mRunSaveTimer = new QTimer ( this ); connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( timerSlotSaveRunningInfoToFile() ) ); } mRunning = run; mRunLastSave = QDateTime::currentDateTime(); if ( mRunning ) { 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; mRunEnd = end; saveRunningInfoToFile( comment ); } void Todo::restartSaveTimer( int secs ) { mRunSaveTimer->start( secs * 1000 ); @@ -181,24 +182,30 @@ void Todo::saveRunningInfoToFile( QString comment ) if ( !comment.isEmpty() ) { QString des = to->description(); if ( des.isEmpty () ) to->setDescription( "TT-Note: " + comment ); else to->setDescription( "TT-Note: " + comment +"\n" + des ); } 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() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); if ( inc->typeID() != todoID ) return; Todo* to = (Todo*)inc; diff --git a/libkcal/todo.h b/libkcal/todo.h index 71b7a4e..2131732 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -125,24 +125,25 @@ namespace KCal { void stopRunning(); int runTime(); QDateTime runStart () const { return mRunStart;} void saveRunningInfo( QString comment, QDateTime start, QDateTime end ); public slots: void saveRunningInfoToFile( QString st ); 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; QDateTime mRunEnd; bool accept(Visitor &v) { return v.visit(this); } QDateTime mDtDue; // due date of todo bool mHasDueDate; // if todo has associated due date |