From 451324836013427109dd72c7061d63a124f60c99 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 7 Oct 2014 22:49:46 -0400 Subject: [PATCH] Task - Upgrades UDA values of type 'duration' to supported values. --- src/Task.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Task.cpp b/src/Task.cpp index 8667d9b6b..aabdccd4f 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -2188,6 +2188,33 @@ void Task::upgradeLegacyValues () } } } + + // 2.4.0 Update UDA duration values. + Config::const_iterator name; + for (name = context.config.begin (); name != context.config.end (); ++name) + { + if (name->first.substr (0, 4) == "uda." && + name->first.find (".type") != std::string::npos) + { + if (name->second == "duration") + { + std::string::size_type period = name->first.find ('.', 4); + if (period != std::string::npos) + { + std::string uda = name->first.substr (4, period - 4); + std::string value = get (uda); + std::string new_value = value; + upgradeLegacyValue (new_value); + + if (new_value != value) + { + set ("recur", new_value); + context.debug (format ("Legacy upgrade: UDA {1}, {2} --> {3}", uda, value, new_value)); + } + } + } + } + } } ////////////////////////////////////////////////////////////////////////////////