Summary: | "Revert and Stop" stops but doesn't revert | ||
---|---|---|---|
Product: | [Applications] ktimetracker | Reporter: | Inge Wallin <inge> |
Component: | general | Assignee: | Thorsten Staerk <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Inge Wallin
2007-04-28 10:53:06 UTC
"Revert and Stop" stops but does not revert. SVN commit 658731 by tstaerk: Subtract the time that has been added while the desktop has been idle. CCBUGS:144782 M +1 -0 idletimedetector.cpp M +12 -6 task.cpp M +1 -1 taskview.cpp --- branches/KDE/3.5/kdepim/karm/idletimedetector.cpp #658730:658731 @@ -81,6 +81,7 @@ // Revert And Stop kdDebug(5970) << "Now it is " << KGlobal::locale()->formatTime(QDateTime::currentDateTime().time()).ascii() << endl; kdDebug(5970) << "Reverting timer to " << KGlobal::locale()->formatTime(idleStart.time()).ascii() << endl; + emit(extractTime(idleMinutes+diff)); // we need to subtract the time that has been added during idleness. emit(stopAllTimersAt(idleStart)); } else if (id == 1) { --- branches/KDE/3.5/kdepim/karm/task.cpp #658730:658731 @@ -96,11 +96,14 @@ void Task::setRunning( bool on, KarmStorage* storage, QDateTime whenStarted, QDateTime whenStopped ) // Sets a task running or stopped. If the task is to be stopped, whenStarted is not evaluated. +// on=true if the task shall be started on=false if the task shall be stopped { - kdDebug(5970) << "Entering Task::setRunning" << endl; - if ( on ) { + kdDebug(5970) << "Entering Task::setRunning " << "on=" << on << "whenStarted=" << whenStarted << " whenStopped=" << whenStopped << endl; + if ( on ) + { if (isComplete()) return; // don't start if its marked complete - if (!_timer->isActive()) { + if (!_timer->isActive()) + { _timer->start(1000); storage->startTimer(this); _currentPic=7; @@ -108,10 +111,13 @@ updateActiveIcon(); } } - else { - if (_timer->isActive()) { + else + { + if (_timer->isActive()) + { _timer->stop(); - if ( ! _removing ) { + if ( ! _removing ) + { storage->stopTimer(this, whenStopped); setPixmap(1, UserIcon(QString::fromLatin1("empty-watch.xpm"))); } --- branches/KDE/3.5/kdepim/karm/taskview.cpp #658730:658731 @@ -421,7 +421,7 @@ // stops all timers for the time qdt. This makes sense, if the idletimedetector detected // the last work has been done 50 minutes ago. { - kdDebug(5970) << "Entering TaskView::stopAllTimersAt" << endl; + kdDebug(5970) << "Entering TaskView::stopAllTimersAt " << qdt << endl; for ( unsigned int i = 0; i < activeTasks.count(); i++ ) { activeTasks.at(i)->setRunning(false, _storage, qdt, qdt); SVN commit 658742 by tstaerk: Do not store the reduction of time, only subtract it in memory. CCBUGS:144782 M +8 -6 idletimedetector.cpp M +6 -1 taskview.cpp M +4 -1 taskview.h --- branches/KDE/3.5/kdepim/karm/idletimedetector.cpp #658741:658742 @@ -59,8 +59,7 @@ void IdleTimeDetector::informOverrun(int idleMinutes) { if (!_overAllIdleDetect) - return; // In the preferences the user has indicated that he do not - // want idle detection. + return; // preferences say the user does not want idle detection. _timer->stop(); @@ -77,19 +76,22 @@ QDateTime end = QDateTime::currentDateTime(); int diff = start.secsTo(end)/secsPerMinute; - if (id == 0) { + if (id == 0) + { // Revert And Stop - kdDebug(5970) << "Now it is " << KGlobal::locale()->formatTime(QDateTime::currentDateTime().time()).ascii() << endl; + kdDebug(5970) << "Now it is " << QDateTime::currentDateTime() << endl; kdDebug(5970) << "Reverting timer to " << KGlobal::locale()->formatTime(idleStart.time()).ascii() << endl; emit(extractTime(idleMinutes+diff)); // we need to subtract the time that has been added during idleness. emit(stopAllTimersAt(idleStart)); } - else if (id == 1) { + else if (id == 1) + { // Revert and Continue emit(extractTime(idleMinutes+diff)); _timer->start(testInterval); } - else { + else + { // Continue _timer->start(testInterval); } --- branches/KDE/3.5/kdepim/karm/taskview.cpp #658741:658742 @@ -696,9 +696,14 @@ } void TaskView::extractTime(int minutes) +// This procedure subtracts ''minutes'' from the active task's time in the memory. +// It is called by the idletimedetector class. +// When the desktop has been idle for the past 20 minutes, the past 20 minutes have +// already been added to the task's time in order for the time to be displayed correctly. +// That is why idletimedetector needs to subtract this time first. { kdDebug(5970) << "Entering extractTime" << endl; - addTimeToActiveTasks(-minutes); + addTimeToActiveTasks(-minutes,false); // subtract minutes, but do not store it } void TaskView::autoSaveChanged(bool on) --- branches/KDE/3.5/kdepim/karm/taskview.h #658741:658742 @@ -157,7 +157,10 @@ void markTaskAsComplete(); void markTaskAsIncomplete(); - /** Subtracts time from all active tasks, and does not log event. */ + /** Subtracts time from all active tasks, and does not log event. + * The time is stored in memory and in X-KDE-karm-duration. It is + * increased automatically every minute to display the right duration. + */ void extractTime( int minutes ); void taskTotalTimesChanged( long session, long total) { emit totalTimesChanged( session, total); }; I produced this bug by fixing https://bugs.kde.org/show_bug.cgi?id=135002. This is a complicated topic. SVN commit 659014 by tstaerk: Revert time. CCBUGS:144782 M +1 -1 idletimedetector.cpp M +1 -1 taskview.cpp --- trunk/KDE/kdepim/ktimetracker/idletimedetector.cpp #659013:659014 @@ -86,7 +86,7 @@ kDebug(5970) << "Entering IdleTimeDetector::revert" << endl; QDateTime end = QDateTime::currentDateTime(); int diff = start.secsTo(end)/secsPerMinute; - //emit(extractTime(idleminutes+diff)); + emit(extractTime(idleminutes+diff)); // subtract the time that has been added on the display emit(stopAllTimers(idlestart)); } --- trunk/KDE/kdepim/ktimetracker/taskview.cpp #659013:659014 @@ -938,7 +938,7 @@ void TaskView::extractTime(int minutes) { - addTimeToActiveTasks(-minutes); + addTimeToActiveTasks(-minutes,false); // subtract time in memory, but do not store it } void TaskView::autoSaveChanged(bool on) *** Bug has been marked as fixed ***. SVN commit 757105 by pradeepto: Merged revisions 658731 via svnmerge from svn+ssh://pradeepto@svn.kde.org/home/kde/branches/KDE/3.5/kdepim ........ r658731 | tstaerk | 2007-04-28 15:59:49 +0530 (Sat, 28 Apr 2007) | 3 lines Subtract the time that has been added while the desktop has been idle. CCBUGS:144782 ........ _M . (directory) WebSVN link: http://websvn.kde.org/?view=rev&revision=757105 SVN commit 757111 by pradeepto: Merged revisions 658742 via svnmerge from svn+ssh://pradeepto@svn.kde.org/home/kde/branches/KDE/3.5/kdepim ........ r658742 | tstaerk | 2007-04-28 17:28:08 +0530 (Sat, 28 Apr 2007) | 4 lines Do not store the reduction of time, only subtract it in memory. CCBUGS:144782 ........ _M . (directory) WebSVN link: http://websvn.kde.org/?view=rev&revision=757111 |