diff --git a/src/Task.cpp b/src/Task.cpp index 5f394b0ef..2b7d9d0d5 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -2006,53 +2006,14 @@ void Task::modify (modType type, bool text_required /* = false */) evaluatedValue = Variant (value); } - // Dependencies are specified as IDs. - if (name == "depends") + // Dependencies are specified as IDs or UUIDs. + if (name == "depends" || + name == "tags") { column->modify (*this, value); mods = true; } - // For those using the "tags:..." attribute directly. - else if (name == "tags") - { - // TW-1701 - set ("tags", ""); - - std::vector tags; - split (tags, value, ','); - - for (auto& tag : tags) - { - // If it's a DOM ref, eval it first. - Lexer lexer (tag); - std::string domRef; - Lexer::Type type; - if (lexer.token (domRef, type) && - type == Lexer::Type::dom) - { - Eval e; - e.addSource (domSource); - e.addSource (namedDates); - contextTask = *this; - - Variant v; - e.evaluateInfixExpression (value, v); - addTag ((std::string) v); - context.debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + "'"); - } - else - { - addTag (tag); - context.debug (label + "tags <-- '" + tag + "'"); - } - - feedback_special_tags (*this, tag); - } - - mods = true; - } - // Dates are special, maybe. else if (column->type () == "date") { diff --git a/src/columns/ColTags.cpp b/src/columns/ColTags.cpp index 3eece3d00..1e7812c36 100644 --- a/src/columns/ColTags.cpp +++ b/src/columns/ColTags.cpp @@ -28,11 +28,17 @@ #include #include #include +#include +#include +#include +#include #include #include #include +#include extern Context context; +extern Task& contextTask; //////////////////////////////////////////////////////////////////////////////// ColumnTags::ColumnTags () @@ -146,3 +152,43 @@ void ColumnTags::render ( } //////////////////////////////////////////////////////////////////////////////// +void ColumnTags::modify (Task& task, const std::string& value) +{ + std::string label = " MODIFICATION "; + + // TW-1701 + task.set ("tags", ""); + + std::vector tags; + split (tags, value, ','); + + for (auto& tag : tags) + { + // If it's a DOM ref, eval it first. + Lexer lexer (tag); + std::string domRef; + Lexer::Type type; + if (lexer.token (domRef, type) && + type == Lexer::Type::dom) + { + Eval e; + e.addSource (domSource); + e.addSource (namedDates); + contextTask = task; + + Variant v; + e.evaluateInfixExpression (value, v); + task.addTag ((std::string) v); + context.debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + "'"); + } + else + { + task.addTag (tag); + context.debug (label + "tags <-- '" + tag + "'"); + } + + feedback_special_tags (task, tag); + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColTags.h b/src/columns/ColTags.h index 8cd61567d..c248b4b22 100644 --- a/src/columns/ColTags.h +++ b/src/columns/ColTags.h @@ -36,6 +36,7 @@ public: void setStyle (const std::string&); void measure (Task&, unsigned int&, unsigned int&); void render (std::vector &, Task&, int, Color&); + void modify (Task&, const std::string&); private: bool _hyphenate;