Feature TW-1260

- TW-1260 New virtual tags YESTERDAY, TOMORROW.
This commit is contained in:
Paul Beckingham
2014-02-15 14:36:49 -05:00
parent 1170a43f6b
commit b9c853fece
5 changed files with 44 additions and 6 deletions

View File

@@ -342,6 +342,24 @@ bool Task::is_due () const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_dueyesterday () const
{
if (has ("due"))
{
Task::status status = getStatus ();
if (status != Task::completed &&
status != Task::deleted)
{
if (Date ("yesterday").sameDay (get_date ("due")))
return true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_duetoday () const
{
@@ -360,6 +378,24 @@ bool Task::is_duetoday () const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_duetomorrow () const
{
if (has ("due"))
{
Task::status status = getStatus ();
if (status != Task::completed &&
status != Task::deleted)
{
if (Date ("tomorrow").sameDay (get_date ("due")))
return true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_dueweek () const
{
@@ -1081,6 +1117,8 @@ bool Task::hasTag (const std::string& tag) const
if (tag == "DUE") return is_due ();
if (tag == "DUETODAY") return is_duetoday ();
if (tag == "TODAY") return is_duetoday ();
if (tag == "YESTERDAY") return is_dueyesterday ();
if (tag == "TOMORROW") return is_duetomorrow ();
if (tag == "OVERDUE") return is_overdue ();
if (tag == "WEEK") return is_dueweek ();
if (tag == "MONTH") return is_duemonth ();
@@ -1094,12 +1132,6 @@ bool Task::hasTag (const std::string& tag) const
if (tag == "ANNOTATED") return hasAnnotations ();
if (tag == "PARENT") return has ("mask");
/*
TODO YESTERDAY - due yesterday
TODO TOMORROW - due tomorrow
TODO READY - is ready
*/
// Concrete tags.
std::vector <std::string> tags;
split (tags, get ("tags"), ',');