Tags: New 'UDA' and 'ORPHAN' virtual tags.
This commit is contained in:
25
src/Task.cpp
25
src/Task.cpp
@@ -495,6 +495,29 @@ bool Task::is_dueyear () const
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_udaPresent () const
|
||||
{
|
||||
for (auto& col : context.columns)
|
||||
if (col.first.substr (0, 11) != "annotation_")
|
||||
if (col.second->is_uda () &&
|
||||
has (col.first))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_orphanPresent () const
|
||||
{
|
||||
for (auto& att : *this)
|
||||
if (att.first.substr (0, 11) != "annotation_")
|
||||
if (context.columns.find (att.first) == context.columns.end ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_overdue () const
|
||||
{
|
||||
@@ -1120,6 +1143,8 @@ bool Task::hasTag (const std::string& tag) const
|
||||
if (tag == "PENDING") return get ("status") == "pending";
|
||||
if (tag == "COMPLETED") return get ("status") == "completed";
|
||||
if (tag == "DELETED") return get ("status") == "deleted";
|
||||
if (tag == "UDA") return is_udaPresent();
|
||||
if (tag == "ORPHAN") return is_orphanPresent();
|
||||
|
||||
// Concrete tags.
|
||||
std::vector <std::string> tags;
|
||||
|
||||
@@ -111,6 +111,8 @@ public:
|
||||
bool is_duemonth () const;
|
||||
bool is_dueyear () const;
|
||||
bool is_overdue () const;
|
||||
bool is_udaPresent () const;
|
||||
bool is_orphanPresent () const;
|
||||
#endif
|
||||
|
||||
status getStatus () const;
|
||||
|
||||
@@ -316,6 +316,7 @@ int CmdInfo::execute (std::string& output)
|
||||
if (task.hasTag ("DUE")) virtualTags += "DUE ";
|
||||
if (task.hasTag ("DUETODAY")) virtualTags += "DUETODAY ";
|
||||
if (task.hasTag ("MONTH")) virtualTags += "MONTH ";
|
||||
if (task.hasTag ("ORPHAN")) virtualTags += "ORPHAN ";
|
||||
if (task.hasTag ("OVERDUE")) virtualTags += "OVERDUE ";
|
||||
if (task.hasTag ("PARENT")) virtualTags += "PARENT ";
|
||||
if (task.hasTag ("PENDING")) virtualTags += "PENDING ";
|
||||
@@ -324,12 +325,14 @@ int CmdInfo::execute (std::string& output)
|
||||
if (task.hasTag ("TAGGED")) virtualTags += "TAGGED ";
|
||||
if (task.hasTag ("TODAY")) virtualTags += "TODAY ";
|
||||
if (task.hasTag ("TOMORROW")) virtualTags += "TOMORROW ";
|
||||
if (task.hasTag ("UDA")) virtualTags += "UDA ";
|
||||
if (task.hasTag ("UNBLOCKED")) virtualTags += "UNBLOCKED ";
|
||||
if (task.hasTag ("UNTIL")) virtualTags += "UNTIL ";
|
||||
if (task.hasTag ("WAITING")) virtualTags += "WAITING ";
|
||||
if (task.hasTag ("WEEK")) virtualTags += "WEEK ";
|
||||
if (task.hasTag ("YEAR")) virtualTags += "YEAR ";
|
||||
if (task.hasTag ("YESTERDAY")) virtualTags += "YESTERDAY ";
|
||||
// If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
||||
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_CMD_INFO_VIRTUAL_TAGS);
|
||||
|
||||
@@ -177,31 +177,33 @@ int CmdCompletionTags::execute (std::string& output)
|
||||
unique["nonag"] = 0;
|
||||
unique["nocal"] = 0;
|
||||
unique["next"] = 0;
|
||||
unique["BLOCKED"] = 0;
|
||||
unique["UNBLOCKED"] = 0;
|
||||
unique["BLOCKING"] = 0;
|
||||
unique["YESTERDAY"] = 0;
|
||||
unique["DUE"] = 0;
|
||||
unique["DUETODAY"] = 0;
|
||||
unique["TODAY"] = 0;
|
||||
unique["TOMORROW"] = 0;
|
||||
unique["WEEK"] = 0;
|
||||
unique["MONTH"] = 0;
|
||||
unique["YEAR"] = 0;
|
||||
unique["OVERDUE"] = 0;
|
||||
unique["ACTIVE"] = 0;
|
||||
unique["SCHEDULED"] = 0;
|
||||
unique["READY"] = 0;
|
||||
unique["PARENT"] = 0;
|
||||
unique["CHILD"] = 0;
|
||||
unique["UNTIL"] = 0;
|
||||
unique["WAITING"] = 0;
|
||||
unique["ANNOTATED"] = 0;
|
||||
unique["TAGGED"] = 0;
|
||||
unique["PENDING"] = 0;
|
||||
unique["BLOCKED"] = 0;
|
||||
unique["BLOCKING"] = 0;
|
||||
unique["CHILD"] = 0;
|
||||
unique["COMPLETED"] = 0;
|
||||
unique["DELETED"] = 0;
|
||||
// If you update this list, update doc/man/task.1.in as well.
|
||||
unique["DUE"] = 0;
|
||||
unique["DUETODAY"] = 0;
|
||||
unique["MONTH"] = 0;
|
||||
unique["ORPHAN"] = 0;
|
||||
unique["OVERDUE"] = 0;
|
||||
unique["PARENT"] = 0;
|
||||
unique["PENDING"] = 0;
|
||||
unique["READY"] = 0;
|
||||
unique["SCHEDULED"] = 0;
|
||||
unique["TAGGED"] = 0;
|
||||
unique["TODAY"] = 0;
|
||||
unique["TOMORROW"] = 0;
|
||||
unique["UDA"] = 0;
|
||||
unique["UNBLOCKED"] = 0;
|
||||
unique["UNTIL"] = 0;
|
||||
unique["WAITING"] = 0;
|
||||
unique["WEEK"] = 0;
|
||||
unique["YEAR"] = 0;
|
||||
unique["YESTERDAY"] = 0;
|
||||
// If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
||||
|
||||
std::stringstream out;
|
||||
for (auto& it : unique)
|
||||
|
||||
Reference in New Issue
Block a user