Report date format

- added new reportdateformat to extend the formatting of due dates
  in the reports and "task info"
- added new conversion sequences a, A, b, B and Y to be used with
  reportdateformat
This commit is contained in:
Federico Hernandez
2010-01-12 23:12:22 +01:00
parent e92fb9287a
commit 660d0cca3e
14 changed files with 269 additions and 52 deletions

View File

@@ -52,6 +52,9 @@
#include "Timer.h"
#include "text.h"
#include "util.h"
#include "Context.h"
extern Context context;
////////////////////////////////////////////////////////////////////////////////
Table::Table ()
@@ -868,6 +871,46 @@ void Table::sort (std::vector <int>& order)
}
break;
case ascendingDueDate:
{
if ((std::string)*left != "" && (std::string)*right == "")
break;
else if ((std::string)*left == "" && (std::string)*right != "")
SWAP
else
{
Date dl ((std::string)*left, context.config.get("reportdateformat",
context.config.get("dateformat","m/d/Y")));
Date dr ((std::string)*right, context.config.get("reportdateformat",
context.config.get("dateformat","m/d/Y")));
if (dl > dr)
SWAP
}
}
break;
case descendingDueDate:
{
if ((std::string)*left != "" && (std::string)*right == "")
break;
else if ((std::string)*left == "" && (std::string)*right != "")
SWAP
else
{
Date dl ((std::string)*left, context.config.get("reportdateformat",
context.config.get("dateformat","m/d/Y")));
Date dr ((std::string)*right, context.config.get("reportdateformat",
context.config.get("dateformat","m/d/Y")));
if (dl < dr)
SWAP
}
}
break;
case ascendingPriority:
if (((std::string)*left == "" && (std::string)*right != "") ||
((std::string)*left == "M" && (std::string)*right == "L") ||