diff --git a/AUTHORS b/AUTHORS index c2c823012..df355e3f4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -198,3 +198,5 @@ suggestions: Scott Kroll Kosta H Hector Arciga + Jan Kunder + diff --git a/ChangeLog b/ChangeLog index 926a257a9..0922dfb8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/NEWS b/NEWS index 2d1bc59a3..f7da4f5cd 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/src/commands/CmdDelete.cpp b/src/commands/CmdDelete.cpp index e9ca7a92c..22b01bb5d 100644 --- a/src/commands/CmdDelete.cpp +++ b/src/commands/CmdDelete.cpp @@ -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 children = context.tdb2.children (*task); + if (children.size () && + confirm (STRING_CMD_DELETE_CONFIRM_R)) + { + std::vector ::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 {