Enhancement

- Separate date format when editing from the default one.
This commit is contained in:
Louis-Claude Canon 2012-05-16 17:39:55 +02:00 committed by Paul Beckingham
parent ba992a631e
commit 82a4607ec6
4 changed files with 10 additions and 2 deletions

View file

@ -475,6 +475,8 @@ Enables the extension system. Defaults to on.
.TP .TP
.B dateformat.holiday=YMD .B dateformat.holiday=YMD
.TP .TP
.B dateformat.edit=m/d/Y H:N:S
.TP
.B dateformat.info=m/d/Y H:N:S .B dateformat.info=m/d/Y H:N:S
.TP .TP
.B dateformat.annotation=m/d/Y .B dateformat.annotation=m/d/Y

View file

@ -109,6 +109,7 @@ std::string Config::_defaults =
"# Dates\n" "# Dates\n"
"dateformat=m/d/Y # Preferred input and display date format\n" "dateformat=m/d/Y # Preferred input and display date format\n"
"dateformat.holiday=YMD # Preferred input date format for holidays\n" "dateformat.holiday=YMD # Preferred input date format for holidays\n"
"dateformat.edit=m/d/Y H:N:S # Preferred display date format when editing\n"
"dateformat.info=m/d/Y H:N:S # Preferred display date format for information\n" "dateformat.info=m/d/Y H:N:S # Preferred display date format for information\n"
"dateformat.report=m/d/Y # Preferred display date format for reports\n" "dateformat.report=m/d/Y # Preferred display date format for reports\n"
"dateformat.annotation=m/d/Y # Preferred display date format for annotations\n" "dateformat.annotation=m/d/Y # Preferred display date format for annotations\n"

View file

@ -631,8 +631,12 @@ bool CmdEdit::editFile (Task& task)
file << "task." << getpid () << "." << task.id << ".task"; file << "task." << getpid () << "." << task.id << ".task";
std::string path = location._data + "/" + file.str (); std::string path = location._data + "/" + file.str ();
// Determine the output date format // Determine the output date format, which uses a hierarchy of definitions.
std::string dateformat = context.config.get ("dateformat"); // rc.dateformat.edit
// rc.dateformat
std::string dateformat = context.config.get ("dateformat.edit");
if (dateformat == "")
dateformat = context.config.get ("dateformat");
// Format the contents, T -> text, write to a file. // Format the contents, T -> text, write to a file.
std::string before = formatTask (task, dateformat); std::string before = formatTask (task, dateformat);

View file

@ -128,6 +128,7 @@ int CmdShow::execute (std::string& output)
" data.location" " data.location"
" dateformat" " dateformat"
" dateformat.annotation" " dateformat.annotation"
" dateformat.edit"
" dateformat.holiday" " dateformat.holiday"
" dateformat.info" " dateformat.info"
" dateformat.report" " dateformat.report"