mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
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.
This commit is contained in:
parent
3d1a5acafb
commit
e379af9751
2 changed files with 0 additions and 53 deletions
|
@ -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 ());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue