summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-10-22 15:25:31 (UTC)
committer zautrix <zautrix>2005-10-22 15:25:31 (UTC)
commita29a801e5500a8e5994afc317229698aeebe22e9 (patch) (side-by-side diff)
treedefdd25623ca6908e712ed41c0d30007cb96c439 /libkcal
parent30550b912b291ccedc8ab100004ba8c5ed216097 (diff)
downloadkdepimpi-a29a801e5500a8e5994afc317229698aeebe22e9.zip
kdepimpi-a29a801e5500a8e5994afc317229698aeebe22e9.tar.gz
kdepimpi-a29a801e5500a8e5994afc317229698aeebe22e9.tar.bz2
fixx
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/todo.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 2201814..cc1c5ae 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -91,48 +91,50 @@ void Todo::stopRunning()
}
void Todo::setRunning( bool run )
{
if ( run == mRunning )
return;
//qDebug("Todo::setRunning %d ", run);
if ( !mRunSaveTimer ) {
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;
+ if ( mRunSaveTimer )
+ mRunSaveTimer->stop();
mRunning = false;
mRunStart = start;
mRunEnd = end;
saveRunningInfoToFile( comment );
}
void Todo::restartSaveTimer( int secs )
{
mRunSaveTimer->start( secs * 1000 );
mRunLastSave = QDateTime::currentDateTime();
mCurrentTimerDelay = secs;
}
void Todo::timerSlotSaveRunningInfoToFile()
{
mRunEnd = QDateTime::currentDateTime();
int secsTo = mRunLastSave.secsTo( mRunEnd );
//if( secsTo == 8 ) ++secsTo;
qDebug("KO Todo::saveTimerTimeout %d %d", secsTo, mCurrentTimerDelay );
if ( secsTo > mCurrentTimerDelay ) {
qDebug("KO Todo::saveTimerTimeout restart %d ", SAVETIMER_TIMEOUT_RETRY_SECONDS );
restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS );
return;
}
int msecs = mRunLastSave.time().msecsTo( mRunEnd.time());
if ( msecs < 0 ) {