Feature #189 - annotation of start and stop times

- task can now record the invocation of the 'start' and 'stop'
  command as an annotation by setting journal.time to yes.
- the annoatation test can be customized with
  journal.time.start.annoation and
  journal.time.stop.annotation
This commit is contained in:
Federico Hernandez 2010-07-20 20:19:34 +02:00
parent 5ac0bd3800
commit 942f665d71
6 changed files with 84 additions and 10 deletions

View file

@ -693,12 +693,12 @@ int handleShow (std::string &outs)
"color.undo.after confirmation curses data.location dateformat dateformat.holiday "
"dateformat.report dateformat.annotation debug default.command "
"default.priority default.project defaultwidth due locale displayweeknumber "
"export.ical.class echo.command fontunderline locking monthsperline nag "
"next project shadow.command shadow.file shadow.notify weekstart editor "
"import.synonym.id import.synonym.uuid complete.all.projects "
"complete.all.tags search.case.sensitive hooks active.indicator tag.indicator "
"recurrence.indicator recurrence.limit list.all.projects list.all.tags "
"undo.style "
"export.ical.class echo.command fontunderline locking monthsperline nag next "
"journal.time journal.time.start.annotation journal.time.stop.annotation "
"project shadow.command shadow.file shadow.notify weekstart editor "
"import.synonym.id import.synonym.uuid complete.all.projects complete.all.tags "
"search.case.sensitive hooks active.indicator tag.indicator recurrence.indicator "
"recurrence.limit list.all.projects list.all.tags undo.style "
#ifdef FEATURE_SHELL
"shell.prompt "
#endif
@ -1203,8 +1203,12 @@ int handleStart (std::string &outs)
{
char startTime[16];
sprintf (startTime, "%u", (unsigned int) time (NULL));
task->set ("start", startTime);
if (context.config.getBoolean ("journal.time"))
task->addAnnotation (context.config.get ("journal.time.start.annotation"));
context.tdb.update (*task);
if (context.config.getBoolean ("echo.command"))
@ -1263,6 +1267,10 @@ int handleStop (std::string &outs)
if (task->has ("start"))
{
task->remove ("start");
if (context.config.getBoolean ("journal.time"))
task->addAnnotation (context.config.get ("journal.time.stop.annotation"));
context.tdb.update (*task);
if (context.config.getBoolean ("echo.command"))