Only set contextTask if not adding a new task

When adding a new task, the current task is empty, so there is no
context in which to evaluate DOM references.  #2683 will address this in
a more robust fashion.
This commit is contained in:
Dustin J. Mitchell 2021-12-16 02:41:16 +00:00 committed by Tomas Babej
parent 2812a8c77a
commit 8d3953183a
7 changed files with 21 additions and 7 deletions

View file

@ -121,7 +121,9 @@ void ColumnProject::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
Variant v;
e.evaluateInfixExpression (value, v);

View file

@ -108,7 +108,9 @@ void ColumnRecur::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
e.evaluateInfixExpression (value, evaluatedValue);
}

View file

@ -162,7 +162,9 @@ void ColumnTags::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
Variant v;
e.evaluateInfixExpression (value, v);

View file

@ -213,7 +213,9 @@ void ColumnTypeDate::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
e.evaluateInfixExpression (value, evaluatedValue);
}

View file

@ -55,7 +55,9 @@ void ColumnTypeDuration::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
e.evaluateInfixExpression (value, evaluatedValue);
}

View file

@ -55,7 +55,9 @@ void ColumnTypeNumeric::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
e.evaluateInfixExpression (value, evaluatedValue);
}

View file

@ -67,7 +67,9 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
{
Eval e;
e.addSource (domSource);
contextTask = &task;
if (!task.is_empty ()) {
contextTask = &task;
}
Variant v;
e.evaluateInfixExpression (value, v);