Enhancement - annotate

- Implemented annotation command.
This commit is contained in:
Paul Beckingham 2009-06-16 22:55:05 -04:00
parent 23f0a9658e
commit 051720a279
2 changed files with 17 additions and 15 deletions

View file

@ -192,9 +192,7 @@ std::string Context::dispatch ()
else if (cmd.command == "" && task.getId ()) { out = handleModify (); }
*/
else if (cmd.command == "append") { out = handleAppend (); }
/*
else if (cmd.command == "annotate") { out = handleAnnotate (); }
*/
else if (cmd.command == "done") { out = handleDone (); }
else if (cmd.command == "undo") { out = handleUndo (); }
else if (cmd.command == "delete") { out = handleDelete (); }

View file

@ -1041,31 +1041,35 @@ std::string handleColor ()
////////////////////////////////////////////////////////////////////////////////
std::string handleAnnotate ()
{
/*
if (task.getDescription () == "")
if (!context.task.has ("description"))
throw std::string ("Cannot apply a blank annotation.");
*/
std::stringstream out;
/*
std::vector <T> all;
tdb.pendingT (all);
filterSequence (all, task);
foreach (t, all)
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.loadPending (tasks, context.filter);
// Filter sequence.
context.filter.applySequence (tasks, context.sequence);
foreach (task, tasks)
{
t->addAnnotation (task.getDescription ());
tdb.modifyT (*t);
task->addAnnotation (context.task.get ("description"));
context.tdb.update (*task);
if (context.config.get ("echo.command", true))
out << "Annotated "
<< t->getId ()
<< task->id
<< " with '"
<< t->getDescription ()
<< task->get ("description")
<< "'"
<< std::endl;
}
*/
context.tdb.commit ();
context.tdb.unlock ();
return out.str ();
}