From 1b6690455021e45ce3599969baed373242a1e00f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 30 Dec 2010 22:20:33 -0500 Subject: [PATCH] Urgency/next - Added 'urgency' as a reportable, sortable column. This will allow us to test the urgency coefficients. Note that this is experimental, and as such will not be documented. --- src/Att.cpp | 4 +++- src/custom.cpp | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Att.cpp b/src/Att.cpp index c274dba29..157a49c53 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -53,6 +53,7 @@ static const char* internalNames[] = "status", "description", "tags", + "urgency", // Note that annotations are not listed. }; @@ -465,7 +466,8 @@ std::string Att::type (const std::string& name) const else if (name == "recur") return "duration"; - else if (name == "limit") + else if (name == "limit" || + name == "urgency") return "number"; else if (name == "priority") diff --git a/src/custom.cpp b/src/custom.cpp index d4d4fc63d..399c5143f 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -541,6 +541,21 @@ int handleCustomReport (const std::string& report, std::string& outs) } } + else if (*col == "urgency") + { + table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Urgency"); + table.setColumnWidth (columnCount, Table::minimum); + table.setColumnJustification (columnCount, Table::right); + + int row = 0; + foreach (task, tasks) + { + std::string value = format (task->urgency (), 1, 3); + context.hooks.trigger ("format-urgency", "urgency", value); + table.addCell (row++, columnCount, value); + } + } + // Common to all columns. // Add underline. if ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) && @@ -712,7 +727,8 @@ void validReportColumns (const std::vector & columns) *it != "description_only" && *it != "description" && *it != "wait" && - *it != "depends") + *it != "depends" && + *it != "urgency") bad.push_back (*it); if (bad.size ())