[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-02-02 19:53:24
Message-ID: 1265140404.975051.30170.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1084251 by tstaerk:

Really reset all times.
BUGS:213824


 M  +18 -3     taskview.cpp  
 M  +5 -2      taskview.h  
 M  +9 -0      timetrackerstorage.cpp  
 M  +3 -1      timetrackerstorage.h  
 M  +1 -1      timetrackerwidget.cpp  


--- trunk/KDE/kdepim/ktimetracker/taskview.cpp #1084250:1084251
@@ -546,7 +546,7 @@
     // re-calculate the time for every task based on events in the history
     KCal::Event::List eventList = storage()->rawevents(); // get all events (!= \
tasks)  int n=-1;
-    resetTimeForAllTasks();
+    resetDisplayTimeForAllTasks();
     emit reSetTimes();
     while (itemAt(++n)) // loop over all tasks
     {
@@ -782,7 +782,7 @@
 void TaskView::resetTimeForAllTasks()
 /* This procedure resets all times (session and overall) for all tasks and subtasks. \
*/  {
-    kDebug(5970) << "Entering TaskView::resetTimeForAllTasks";
+    kDebug(5970) << "Entering function";
     QTreeWidgetItemIterator item( this );
     while ( *item )
     {
@@ -790,9 +790,24 @@
         task->resetTimes();
         ++item;
     }
-    kDebug(5970) << "Leaving TaskView::resetTimeForAllTasks";
+    storage()->deleteAllEvents();
+    kDebug(5970) << "Leaving function";
 }
 
+void TaskView::resetDisplayTimeForAllTasks()
+/* This procedure resets all times (session and overall) for all tasks and subtasks. \
*/ +{
+    kDebug(5970) << "Entering function";
+    QTreeWidgetItemIterator item( this );
+    while ( *item )
+    {
+        Task * task = (Task *) *item;
+        task->resetTimes();
+        ++item;
+    }
+    kDebug(5970) << "Leaving function";
+}
+
 void TaskView::stopTimerFor(Task* task)
 {
     kDebug(5970) << "Entering function";
--- trunk/KDE/kdepim/ktimetracker/taskview.h #1084250:1084251
@@ -73,15 +73,18 @@
     /** Close the storage and release lock. */
     void closeStorage();
 
-    /** Reset session time to zero for all tasks.   */
+    /** Reset session time to zero for all tasks.  */
     void startNewSession();
 
-    /** Deliver if all events from the storage have and end time  */
+    /** Deliver if all events from the storage have and end time.  */
     bool allEventsHaveEndTiMe();
 
     /** Reset session and total time to zero for all tasks.  */
     void resetTimeForAllTasks();
 
+    /** Reset session and total time for all tasks - do not touch the storage.  */
+    void resetDisplayTimeForAllTasks();
+
     /** Return the total number of items in the view.  */
     long count();
 
--- trunk/KDE/kdepim/ktimetracker/timetrackerstorage.cpp #1084250:1084251
@@ -356,6 +356,15 @@
     return true;
 }
 
+QString timetrackerstorage::deleteAllEvents()
+{
+    kDebug(5970) << "Entering function";
+    QString err;
+    KCal::Event::List eventList = d->mCalendar->rawEvents();
+    d->mCalendar->deleteAllEvents();
+    return err;
+}
+
 QString timetrackerstorage::save(TaskView* taskview)
 {
     kDebug(5970) << "Entering function";
--- trunk/KDE/kdepim/ktimetracker/timetrackerstorage.h #1084250:1084251
@@ -138,7 +138,9 @@
      *
      */
     bool allEventsHaveEndTiMe();
-   
+
+    QString deleteAllEvents();
+
     /**
      * Save all tasks and their totals to an iCalendar file.
      *
--- trunk/KDE/kdepim/ktimetracker/timetrackerwidget.cpp #1084250:1084251
@@ -814,7 +814,7 @@
     if ( d->mTabWidget->currentWidget() )
     {
         if ( KMessageBox::warningContinueCancel( this,
-            i18n( "Do you really want to reset the time to zero for all tasks?" ),
+            i18n( "Do you really want to reset the time to zero for all tasks? This \
                will delete the entire history." ),
             i18n( "Confirmation Required" ), KGuiItem( i18n( "Reset All Times" ) ) ) \
== KMessageBox::Continue )  currentTaskView()->resetTimeForAllTasks();
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

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