From 1b60c20bad44f0f2adbe8ff74f4ec2d8dda2ea17 Mon Sep 17 00:00:00 2001 From: Federico Hernandez Date: Fri, 8 Jan 2010 16:49:18 +0100 Subject: [PATCH] Calendar coloring - Now all due tasks are colorized. - Setting due=0 now colorizes all due tasks in reports. --- ChangeLog | 2 ++ src/recur.cpp | 13 +++++++++---- src/report.cpp | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4deb745d..e39c2f039 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ days with overdue tasks and weekend days in the calendar: 'calendar.color.today', 'color.calendar.due', 'calendar.calendar.overdue' and 'color.calendar.weekend'. + + The coloring of due tasks in reports can now be enabled for all tasks, and not + only the imminent ones, by setting the configuration variable due=0. + Fixed bug #316 which caused the timesheet report to display an oddly sorted list. + Fixed bug #317 which colored tasks in the 'completed' report according to diff --git a/src/recur.cpp b/src/recur.cpp index 8273d78e6..db4025b15 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -385,13 +385,18 @@ int getDueState (const std::string& due) // rightNow is the current date + time. Date rightNow; - Date midnight (rightNow.month (), rightNow.day (), rightNow.year ()); + Date thisDay (rightNow.month (), rightNow.day (), rightNow.year ()); - if (dt < midnight) + if (dt < thisDay) return 2; - Date nextweek = midnight + context.config.get ("due", 7) * 86400; - if (dt < nextweek) + int imminentperiod = context.config.get ("due", 7); + + if (imminentperiod == 0) + return 1; + + Date imminentDay = thisDay + imminentperiod * 86400; + if (dt < imminentDay) return 1; } diff --git a/src/report.cpp b/src/report.cpp index b4ade9b98..12d938044 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -1686,6 +1686,9 @@ int handleReportCalendar (std::string &outs) report_filter += " due.after:" + after + " due.before:" + before; context.config.set ("report." + report + ".filter", report_filter); + // Display all due task in the report colorized not only the imminet ones + context.config.set ("due", 0); + context.args.clear (); context.filter.clear (); context.sequence.clear ();