mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 22:33:08 +02:00
Task
- Evaluates attribute values on modify.
This commit is contained in:
parent
05d46b8345
commit
43718cbce5
1 changed files with 22 additions and 6 deletions
28
src/Task.cpp
28
src/Task.cpp
|
@ -2088,14 +2088,22 @@ void Task::modify (modType type, bool text_required /* = false */)
|
||||||
// Try to use modify method, otherwise just continue to the final option.
|
// Try to use modify method, otherwise just continue to the final option.
|
||||||
else if (column->can_modify ())
|
else if (column->can_modify ())
|
||||||
{
|
{
|
||||||
// TODO May require Eval expansion.
|
Eval e;
|
||||||
|
e.addSource (domSource);
|
||||||
|
e.addSource (namedDates);
|
||||||
|
contextTask = *this;
|
||||||
|
|
||||||
|
Variant v;
|
||||||
|
e.evaluateInfixExpression (value, v);
|
||||||
|
v.cast (Variant::type_string);
|
||||||
|
std::string value2 = v.get_string ();
|
||||||
|
|
||||||
// column->modify () contains the logic for the specific column
|
// column->modify () contains the logic for the specific column
|
||||||
// and returns the appropriate value for (*this).set ()
|
// and returns the appropriate value for (*this).set ()
|
||||||
if (column->validate (value))
|
if (column->validate (value2))
|
||||||
{
|
{
|
||||||
std::string col_value = column->modify (value);
|
std::string col_value = column->modify (value);
|
||||||
context.debug (label + name + " <-- " + col_value + " <-- " + value);
|
context.debug (label + name + " <-- " + col_value + " <-- " + value2 + " <-- " + value);
|
||||||
(*this).set (name, col_value);
|
(*this).set (name, col_value);
|
||||||
++modCount;
|
++modCount;
|
||||||
}
|
}
|
||||||
|
@ -2104,12 +2112,20 @@ void Task::modify (modType type, bool text_required /* = false */)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO May require Eval expansion.
|
Eval e;
|
||||||
|
e.addSource (domSource);
|
||||||
|
e.addSource (namedDates);
|
||||||
|
contextTask = *this;
|
||||||
|
|
||||||
|
Variant v;
|
||||||
|
e.evaluateInfixExpression (value, v);
|
||||||
|
v.cast (Variant::type_string);
|
||||||
|
std::string value2 = v.get_string ();
|
||||||
|
|
||||||
// Final default action
|
// Final default action
|
||||||
if (column->validate (value))
|
if (column->validate (value2))
|
||||||
{
|
{
|
||||||
context.debug (label + name + " <-- " + value);
|
context.debug (label + name + " <-- " + value2 + " <-- " + value);
|
||||||
(*this).set (name, value);
|
(*this).set (name, value);
|
||||||
++modCount;
|
++modCount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue