[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 18:27:16
Message-ID: 1263320836.757694.4497.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1073713 by tstaerk:

Adapt totalSessionTime and totalTime on drag&drop.
BUGS:220059


 M  +1 -2      mainwindow.cpp  
 M  +11 -0     task.cpp  
 M  +8 -0      task.h  
 M  +5 -4      taskview.cpp  


--- trunk/KDE/kdepim/ktimetracker/mainwindow.cpp #1073712:1073713
@@ -197,8 +197,7 @@
 
 void MainWindow::taskViewCustomContextMenuRequested( const QPoint& point )
 {
-    QMenu* pop = dynamic_cast<QMenu*>(
-                          factory()->container( i18n( "task_popup" ), this ) );
+    QMenu* pop = dynamic_cast<QMenu*>( factory()->container( i18n( "task_popup" ), this ) );
     if ( pop )
         pop->popup( point );
 }
--- trunk/KDE/kdepim/ktimetracker/task.cpp #1073712:1073713
@@ -358,6 +358,17 @@
     return result;
 }
 
+QString Task::recalculatetotalsessiontime()
+{
+    QString result;
+    setTotalSessionTime(0);
+    Task* child;
+    for (int i=0; i<this->childCount(); ++i)
+        child=(Task*)this->child(i);
+    addTotalSessionTime(time());
+    return result;
+}
+
 QString Task::setSessionTime( long minutes )
 {
     kDebug(5970) << "Entering function";
--- trunk/KDE/kdepim/ktimetracker/task.h #1073712:1073713
@@ -175,9 +175,17 @@
         */
       void setTotalTime( long minutes ) { mTotalTime=minutes; };
 
+      /** Sets the total session time, does not change the parent's total session time.
+        This means the parent's total session time can run out of sync.
+        */
+      void setTotalSessionTime( long minutes ) { mTotalSessionTime=minutes; };
+
       /** A recursive function to calculate the total time of a task. */
       QString recalculatetotaltime();
 
+      /** A recursive function to calculate the total session time of a task. */
+      QString recalculatetotalsessiontime();
+
       /** Sets the session time.
        * Set the session time without changing totalTime nor sessionTime. 
        * Do not change the parent's totalTime.
--- trunk/KDE/kdepim/ktimetracker/taskview.cpp #1073712:1073713
@@ -585,6 +585,7 @@
     }
 
     for (int i=0; i<count(); i++) itemAt(i)->recalculatetotaltime();
+    for (int i=0; i<count(); i++) itemAt(i)->recalculatetotalsessiontime();
 
     refresh();
     kDebug(5970) << "Leaving TaskView::reFreshTimes()";
@@ -1085,10 +1086,10 @@
                 stopCurrentTimer();
             } else
                 if ( !task->isComplete() )
-                    {
-                        stopAllTimers();
-                        startCurrentTimer();
-                    }
+                {
+                    stopAllTimers();
+                    startCurrentTimer();
+                }
         }
     }
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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