From eb772893b00119ead26d8662d73460651cafe11d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 11 Nov 2009 01:17:29 -0500 Subject: Timeclock entries can now have notes Example of a tagged entry: i 2009/11/01 12:00:00 Account Payee ; :Foo: o 2009/11/01 13:00:00 Two spaces or a tab must separate account from payee, and payee from note. --- src/textual.cc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/textual.cc') diff --git a/src/textual.cc b/src/textual.cc index bd7333d2..844edad3 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -413,11 +413,18 @@ void instance_t::clock_in_directive(char * line, { string datetime(line, 2, 19); - char * p = skip_ws(line + 22); - char * n = next_element(p, true); + char * p = skip_ws(line + 22); + char * n = next_element(p, true); + char * end = n ? next_element(n, true) : NULL; + + if (end && *end == ';') + end = skip_ws(end + 1); + else + end = NULL; timelog.clock_in(parse_datetime(datetime, current_year), - account_stack.front()->find_account(p), n ? n : ""); + account_stack.front()->find_account(p), + n ? n : "", end ? end : ""); } void instance_t::clock_out_directive(char * line, @@ -427,9 +434,16 @@ void instance_t::clock_out_directive(char * line, char * p = skip_ws(line + 22); char * n = next_element(p, true); + char * end = n ? next_element(n, true) : NULL; + + if (end && *end == ';') + end = skip_ws(end + 1); + else + end = NULL; timelog.clock_out(parse_datetime(datetime, current_year), - p ? account_stack.front()->find_account(p) : NULL, n ? n : ""); + p ? account_stack.front()->find_account(p) : NULL, + n ? n : "", end ? end : ""); count++; } -- cgit v1.2.3