From e379af97514b1947ed2558dbae63ef92e971f816 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 3 Sep 2011 11:19:45 -0400 Subject: [PATCH] Task Validation - Removed the newly obsoleted Command::apply_defaults, which is now merged into Task::validate, and therefore applied to all modifications and new tasks. --- src/commands/Command.cpp | 52 ---------------------------------------- src/commands/Command.h | 1 - 2 files changed, 53 deletions(-) diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 3f27e20d7..562e5ea7b 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -516,55 +516,3 @@ void Command::modify_task ( } //////////////////////////////////////////////////////////////////////////////// -void Command::apply_defaults (Task& task) -{ - // Provide an entry date unless user already specified one. - if (task.get ("entry") == "") - task.setEntry (); - - // Recurring tasks get a special status. - if (task.has ("due") && - task.has ("recur")) - { - task.setStatus (Task::recurring); - task.set ("mask", ""); - } - - // Tasks with a wait: date get a special status. - else if (task.has ("wait")) - task.setStatus (Task::waiting); - - // By default, tasks are pending. - else - task.setStatus (Task::pending); - - // Override with default.project, if not specified. - if (task.get ("project") == "") - { - std::string defaultProject = context.config.get ("default.project"); - if (defaultProject != "" && - context.columns["project"]->validate (defaultProject)) - task.set ("project", defaultProject); - } - - // Override with default.priority, if not specified. - if (task.get ("priority") == "") - { - std::string defaultPriority = context.config.get ("default.priority"); - if (defaultPriority != "" && - context.columns["priority"]->validate (defaultPriority)) - task.set ("priority", defaultPriority); - } - - // Override with default.due, if not specified. - if (task.get ("due") == "") - { - std::string defaultDue = context.config.get ("default.due"); - if (defaultDue != "" && - context.columns["due"]->validate (defaultDue)) - // TODO Determine whether this could/should be eval'd first. - task.set ("due", Date (defaultDue).toEpoch ()); - } -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/Command.h b/src/commands/Command.h index ec8836f69..ed7abe7a4 100644 --- a/src/commands/Command.h +++ b/src/commands/Command.h @@ -62,7 +62,6 @@ protected: void modify_task_description_append (Task&, const A3&); void modify_task_annotate (Task&, const A3&); void modify_task (Task&, const A3&, std::string&); - void apply_defaults (Task&); protected: std::string _keyword;