From kde-commits Mon Mar 03 22:57:05 2008 From: Thorsten Staerk Date: Mon, 03 Mar 2008 22:57:05 +0000 To: kde-commits Subject: KDE/kdepim/ktimetracker Message-Id: <1204585025.714419.7261.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120458503426090 SVN commit 781942 by tstaerk: Do not pop up a user dialog when deleting a task via dbus M +19 -19 taskview.cpp M +9 -0 taskview.h M +1 -1 timetrackerwidget.cpp --- trunk/KDE/kdepim/ktimetracker/taskview.cpp #781941:781942 @@ -872,6 +872,24 @@ } } +void TaskView::deleteTaskBatch( Task* task ) +{ + QString uid=task->uid(); + task->remove(d->mStorage); + task->removeFromView(); + _preferences->deleteEntry( uid ); // forget if the item was expanded or collapsed + save(); + + // Stop idle detection if no more counters are running + if (d->mActiveTasks.count() == 0) + { + _idleTimeDetector->stopIdleDetection(); + emit timersInactive(); + } + emit tasksChanged( d->mActiveTasks ); +} + + void TaskView::deleteTask( Task* task ) { kDebug(5970) << "Entering function"; @@ -904,25 +922,7 @@ } } - if (response == KMessageBox::Continue) - { - QString uid=task->uid(); - task->remove(d->mStorage); - task->removeFromView(); - _preferences->deleteEntry( uid ); // forget if the item was expanded or collapsed - save(); - - // remove root decoration if there is no more child - refresh(); - - // Stop idle detection if no more counters are running - if (d->mActiveTasks.count() == 0) - { - _idleTimeDetector->stopIdleDetection(); - emit timersInactive(); - } - emit tasksChanged( d->mActiveTasks ); - } + if (response == KMessageBox::Continue) deleteTaskBatch( task ); } void TaskView::markTaskAsComplete() --- trunk/KDE/kdepim/ktimetracker/taskview.h #781941:781942 @@ -161,9 +161,18 @@ /** * Deletes the given or the current task (and children) from the view. + * It does this in batch mode, no user dialog. * @param task Task to be deleted. If empty, the current task is deleted. * if non-existant, an error message is displayed. */ + void deleteTaskBatch( Task* task=0 ); + + /** + * Deletes the given or the current task (and children) from the view. + * Depending on configuration, there may be a user dialog. + * @param task Task to be deleted. If empty, the current task is deleted. + * if non-existant, an error message is displayed. + */ void deleteTask( Task* task=0 ); /** Reinstates the current task as incomplete. --- trunk/KDE/kdepim/ktimetracker/timetrackerwidget.cpp #781941:781942 @@ -830,7 +830,7 @@ Task *task = static_cast< Task* >( *it ); if ( task && task->uid() == taskId ) { - taskView->deleteTask( task ); + taskView->deleteTaskBatch( task ); } ++it; }