Bug TW-261

- TW-261 Easy to create "not deletable" task (thanks to Jan Kunder).
This commit is contained in:
Paul Beckingham 2014-02-15 10:00:04 -05:00
parent 9846a2e3f2
commit e90b467d42
4 changed files with 29 additions and 3 deletions

View file

@ -198,3 +198,5 @@ suggestions:
Scott Kroll
Kosta H
Hector Arciga
Jan Kunder

View file

@ -7,6 +7,7 @@ Features
+ #1501 info report streamlining - partially implemented.
+ #TW-255 'Mask' instead of 'iMask' shown in info report (thanks to Benjamin
Weber)
+ #TW-261 Easy to create "not deletable" task (thanks to Jan Kunder).
+ #TW-1255 New testing framework (thanks to Renato Alves).
+ #TW-1258 Portuguese Localization (thanks to Renato Alves).
+ Removed deprecated 'echo.command' setting, in favor of the 'header' and

1
NEWS
View file

@ -4,6 +4,7 @@ New Features in taskwarrior 2.4.0
- The 'show' command displays default configuration values, when appropriate.
- Removed deprecated commands 'push', 'pull' and 'merge'.
- Portuguese (por-PRT) localization.
- Better handling for deletion of recurring tasks.
New commands in taskwarrior 2.4.0

View file

@ -72,9 +72,7 @@ int CmdDelete::execute (std::string& output)
{
Task before (*task);
if (task->getStatus () == Task::pending ||
task->getStatus () == Task::completed ||
task->getStatus () == Task::waiting)
if (task->getStatus () != Task::deleted)
{
// Delete the specified task.
std::string question;
@ -135,6 +133,30 @@ int CmdDelete::execute (std::string& output)
context.tdb2.modify (parent);
}
}
// Task potentially has child tasks - optionally delete them.
else
{
std::vector <Task> children = context.tdb2.children (*task);
if (children.size () &&
confirm (STRING_CMD_DELETE_CONFIRM_R))
{
std::vector <Task>::iterator child;
for (child = children.begin (); child != children.end (); ++child)
{
modify_task_description_replace (*child, modifications);
child->setStatus (Task::deleted);
if (! child->has ("end"))
child->setEnd ();
updateRecurrenceMask (*child);
context.tdb2.modify (*child);
feedback_affected (STRING_CMD_DELETE_TASK_R, *child);
feedback_unblocked (*child);
++count;
}
}
}
}
else
{