[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 8:37:34
Message-ID: 1263285454.225071.18589.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1073419 by tstaerk:

addtotaltime should work recursively
During last commit, I overlooked the line contained a recursion.

CCBUGS:220059
--Thi line, and those below, will be ignored--

M    ktimetracker/task.cpp
M    ktimetracker/task.h


 M  +4 -7      task.cpp  
 M  +1 -1      task.h  


--- trunk/KDE/kdepim/ktimetracker/task.cpp #1073418:1073419
@@ -312,6 +312,7 @@
     kDebug(5970) << "Entering function";
     QString err;
     mTotalTime+=minutes;
+    if ( parent() ) parent()->addTotalTime( minutes );
     kDebug(5970) << "Leaving function";
     return err;
 }
@@ -346,18 +347,14 @@
     return err;
 }
 
-long Task::recalculatetotaltime()
+QString Task::recalculatetotaltime()
 {
-    long result=0;
+    QString result;
     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();
+    addTotalTime(time());
     return result;
 }
 
--- trunk/KDE/kdepim/ktimetracker/task.h #1073418:1073419
@@ -176,7 +176,7 @@
       void setTotalTime( long minutes ) { mTotalTime=minutes; };
 
       /** A recursive function to calculate the total time of a task. */
-      long recalculatetotaltime();
+      QString recalculatetotaltime();
 
       /** Sets the session time.
        * Set the session time without changing totalTime nor sessionTime. 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic