diff --git a/ChangeLog b/ChangeLog
index c3d281d33..ec85a169b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,8 @@
frequency, a due date, and an optional until date.
+ When a recurring task is modified, all other instances of the recurring
task are also modified.
+ + Custom reports now support user-specified column labels (thanks to T.
+ Charles Yun).
------ old releases ------------------------------
diff --git a/html/custom.html b/html/custom.html
index 67f51b9e0..c6b703eba 100644
--- a/html/custom.html
+++ b/html/custom.html
@@ -88,6 +88,18 @@ report.mine.sort=priority-,project+
in a report:
+
+ It is also possible to override the default columns names, if
+ the following line is added to your .taskrc file:
+
+
+ report.mine.labels=ID,Project,Priority,Description of task
+
+
+ Note that there must be the same number of labels as there are
+ columns to label, and they must appear in the same sequence.
+
+
- id
- uuid
diff --git a/html/task.html b/html/task.html
index 42847e977..3a2da9e51 100644
--- a/html/task.html
+++ b/html/task.html
@@ -117,6 +117,8 @@
frequency, a due date, and an optional until date.
- When a recurring task is modified, all other instances of the recurring
task are also modified.
+
- Custom reports now support user-specified column labels (thanks to T.
+ Charles Yun).
diff --git a/src/Config.cpp b/src/Config.cpp
index eef4e5899..17206c1ae 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -46,23 +46,28 @@ Config::Config ()
{
(*this)["report.long.description"] = "Lists all task, all data, matching the specified criteria";
(*this)["report.long.columns"] = "id,project,priority,entry,start,due,recur,age,tags,description";
+ (*this)["report.long.labels"] = "ID,Project,Pri,Added,Started,Due,Recur,Age,Tags,Description";
(*this)["report.long.sort"] = "due+,priority-,project+";
(*this)["report.list.description"] = "Lists all tasks matching the specified criteria";
(*this)["report.list.columns"] = "id,project,priority,due,active,age,description";
+ (*this)["report.list.labels"] = "ID,Project,Pri,Due,Active,Age,Description";
(*this)["report.list.sort"] = "due+,priority-,project+";
(*this)["report.ls.description"] = "Minimal listing of all tasks matching the specified criteria";
(*this)["report.ls.columns"] = "id,project,priority,description";
+ (*this)["report.ls.labels"] = "ID,Project,Pri,Description";
(*this)["report.ls.sort"] = "priority-,project+";
(*this)["report.newest.description"] = "Shows the newest tasks";
(*this)["report.newest.columns"] = "id,project,priority,due,active,age,description";
+ (*this)["report.newest.labels"] = "ID,Project,Pri,Due,Active,Age,Description";
(*this)["report.newest.sort"] = "id-";
(*this)["report.newest.limit"] = "10";
(*this)["report.oldest.description"] = "Shows the oldest tasks";
(*this)["report.oldest.columns"] = "id,project,priority,due,active,age,description";
+ (*this)["report.oldest.labels"] = "ID,Project,Pri,Due,Active,Age,Description";
(*this)["report.oldest.sort"] = "id+";
(*this)["report.oldest.limit"] = "10";
}
diff --git a/src/report.cpp b/src/report.cpp
index 00d74ffd1..7af747673 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -2040,6 +2040,18 @@ std::string handleCustomReport (
split (columns, columnList, ',');
validReportColumns (columns);
+ std::string labelList = conf.get ("report." + report + ".labels");
+ std::vector labels;
+ split (labels, labelList, ',');
+
+ if (columns.size () != labels.size ())
+ throw std::string ("There are a different number of columns than labels ") +
+ "for report '" + report + "'. Please correct this.";
+
+ std::map columnLabels;
+ for (unsigned int i = 0; i < columns.size (); ++i)
+ columnLabels[columns[i]] = labels[i];
+
std::string sortList = conf.get ("report." + report + ".sort");
std::vector sortOrder;
split (sortOrder, sortList, ',');
@@ -2081,7 +2093,7 @@ std::string handleCustomReport (
// Add each column individually.
if (*col == "id")
{
- table.addColumn ("ID");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "ID");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
@@ -2091,7 +2103,7 @@ std::string handleCustomReport (
else if (*col == "uuid")
{
- table.addColumn ("UUID");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "UUID");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::left);
@@ -2101,7 +2113,7 @@ std::string handleCustomReport (
else if (*col == "project")
{
- table.addColumn ("Project");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Project");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::left);
@@ -2111,7 +2123,7 @@ std::string handleCustomReport (
else if (*col == "priority")
{
- table.addColumn ("Pri");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Pri");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::left);
@@ -2121,7 +2133,7 @@ std::string handleCustomReport (
else if (*col == "entry")
{
- table.addColumn ("Added");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Added");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
@@ -2140,7 +2152,7 @@ std::string handleCustomReport (
else if (*col == "start")
{
- table.addColumn ("Started");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Started");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
@@ -2159,7 +2171,7 @@ std::string handleCustomReport (
else if (*col == "due")
{
- table.addColumn ("Due");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Due");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
@@ -2180,7 +2192,7 @@ std::string handleCustomReport (
else if (*col == "age")
{
- table.addColumn ("Age");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Age");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
@@ -2201,7 +2213,7 @@ std::string handleCustomReport (
else if (*col == "active")
{
- table.addColumn ("Active");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Active");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::left);
@@ -2212,7 +2224,7 @@ std::string handleCustomReport (
else if (*col == "tags")
{
- table.addColumn ("Tags");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Tags");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::left);
@@ -2228,7 +2240,7 @@ std::string handleCustomReport (
else if (*col == "description_only")
{
- table.addColumn ("Description");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Description");
table.setColumnWidth (columnCount, Table::flexible);
table.setColumnJustification (columnCount, Table::left);
@@ -2238,7 +2250,7 @@ std::string handleCustomReport (
else if (*col == "description")
{
- table.addColumn ("Description");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Description");
table.setColumnWidth (columnCount, Table::flexible);
table.setColumnJustification (columnCount, Table::left);
@@ -2262,7 +2274,7 @@ std::string handleCustomReport (
else if (*col == "recur")
{
- table.addColumn ("Recur");
+ table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Recur");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);