[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/ktimetracker
From: Thorsten Staerk <dev () staerk ! de>
Date: 2010-01-12 7:19:25
Message-ID: 1263280765.577523.14561.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1073402 by tstaerk:
Recalculate Total Times on Drag&Drop.
CCBUGS:220059
--Thi line, and those below, will be ignored--
M taskview.cpp
M task.cpp
M task.h
M +15 -16 task.cpp
M +11 -3 task.h
M +1 -1 taskview.cpp
--- trunk/KDE/kdepim/ktimetracker/task.cpp #1073401:1073402
@@ -312,7 +312,6 @@
kDebug(5970) << "Entering function";
QString err;
mTotalTime+=minutes;
- if ( parent() ) parent()->addTotalTime( minutes );
kDebug(5970) << "Leaving function";
return err;
}
@@ -347,6 +346,21 @@
return err;
}
+long Task::recalculatetotaltime()
+{
+ long result=0;
+ setTotalTime(0);
+ addTotalTime(time());
+ Task* child;
+ for (int i=0; i<this->childCount(); ++i)
+ {
+ child=(Task*)this->child(i);
+ this->addTotalTime(child->recalculatetotaltime());
+ }
+ result=totalTime();
+ return result;
+}
+
QString Task::setSessionTime( long minutes )
{
kDebug(5970) << "Entering function";
@@ -647,21 +661,6 @@
return mLastStart;
}
-long Task::time() const
-{
- return mTime;
-}
-
-long Task::sessionTime() const
-{
- return mSessionTime;
-}
-
-long Task::totalSessionTime() const
-{
- return mTotalSessionTime;
-}
-
KDateTime Task::sessionStartTiMe() const
{
return mSessionStartTiMe;
--- trunk/KDE/kdepim/ktimetracker/task.h #1073401:1073402
@@ -170,6 +170,14 @@
*/
QString setTime( long minutes );
+ /** Sets the total time, does not change the parent's total time.
+ This means the parent's total time can run out of sync.
+ */
+ void setTotalTime( long minutes ) { mTotalTime=minutes; };
+
+ /** A recursive function to calculate the total time of a task. */
+ long recalculatetotaltime();
+
/** Sets the session time.
* Set the session time without changing totalTime nor sessionTime.
* Do not change the parent's totalTime.
@@ -187,11 +195,11 @@
void resetTimes();
/** @return time in minutes */
- long time() const;
+ long time() const { return mTime; };
/** @return total time in minutes */
long totalTime() const { return mTotalTime; };
- long sessionTime() const;
- long totalSessionTime() const;
+ long sessionTime() const { return mSessionTime; };
+ long totalSessionTime() const { return mTotalSessionTime; };
KDateTime sessionStartTiMe() const;
/**
--- trunk/KDE/kdepim/ktimetracker/taskview.cpp #1073401:1073402
@@ -584,7 +584,7 @@
}
}
- // TODO: refresh total times
+ for (int i=0; i<count(); i++) itemAt(i)->recalculatetotaltime();
refresh();
kDebug(5970) << "Leaving TaskView::reFreshTimes()";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic