Enhancement

- Implemented tri-state confirmation in the annotate command.
This commit is contained in:
Paul Beckingham 2009-06-27 21:31:11 -04:00
parent a2cc75d2c7
commit 8d76eaca88

View file

@ -1172,9 +1172,20 @@ std::string handleAnnotate ()
// Filter sequence. // Filter sequence.
context.filter.applySequence (tasks, context.sequence); context.filter.applySequence (tasks, context.sequence);
Permission permission;
if (context.sequence.size () > (size_t) context.config.get ("bulk", 2))
permission.bigSequence ();
foreach (task, tasks) foreach (task, tasks)
{ {
Task before (*task);
task->addAnnotation (context.task.get ("description")); task->addAnnotation (context.task.get ("description"));
if (taskDiff (before, *task))
{
std::string question = taskDifferences (before, *task) + "Are you sure?";
if (permission.confirmed (question))
{
context.tdb.update (*task); context.tdb.update (*task);
if (context.config.get ("echo.command", true)) if (context.config.get ("echo.command", true))
@ -1185,6 +1196,8 @@ std::string handleAnnotate ()
<< "'" << "'"
<< std::endl; << std::endl;
} }
}
}
context.tdb.commit (); context.tdb.commit ();
context.tdb.unlock (); context.tdb.unlock ();