From 64c9cbe943a2455882876047976b710187d0d822 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 15 Jun 2014 23:21:54 -0400 Subject: [PATCH] Task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Å duration field is stored in raw form, but must still be parseable. --- src/Task.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Task.cpp b/src/Task.cpp index c0ecae93d..5eef0b5da 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -2032,9 +2032,27 @@ void Task::modify (modType type, bool text_required /* = false */) else if (name == "recur" || column->type () == "duration") { - // Store the raw value, for 'recur', else result. - set (name, value); - ++modCount; + // The duration is stored in raw form, but it must still be valid, + // and therefore is parsed first. + try + { + Eval e; + e.addSource (domSource); + e.addSource (namedDates); + e.ambiguity (false); + contextTask = *this; + + Variant v; + e.evaluateInfixExpression (value, v); + if (v.type () == Variant::type_duration) + { + // Store the raw value, for 'recur'. + set (name, value); + ++modCount; + } + } + + catch (...) { /* NOP */ } } // Need handling for numeric types, used by UDAs.