[evolution] Tasks: Add 'Scheduled Tasks' filter option



commit e259a690c65441f380b71d165d537986bd329e0d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 8 17:40:40 2020 +0200

    Tasks: Add 'Scheduled Tasks' filter option
    
    Related to https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/254

 src/modules/calendar/e-task-shell-view-actions.c |  7 +++++++
 src/modules/calendar/e-task-shell-view-actions.h |  2 ++
 src/modules/calendar/e-task-shell-view-private.h | 19 ++++++++++---------
 src/modules/calendar/e-task-shell-view.c         |  6 ++++++
 4 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/modules/calendar/e-task-shell-view-actions.c 
b/src/modules/calendar/e-task-shell-view-actions.c
index 17d8c7abe9..52a5f7e0f5 100644
--- a/src/modules/calendar/e-task-shell-view-actions.c
+++ b/src/modules/calendar/e-task-shell-view-actions.c
@@ -979,6 +979,13 @@ static GtkRadioActionEntry task_filter_entries[] = {
          NULL,  /* XXX Add a tooltip! */
          TASK_FILTER_UNCOMPLETED_TASKS },
 
+       { "task-filter-scheduled-tasks",
+         NULL,
+         N_("Scheduled Tasks"),
+         NULL,
+         N_("Show scheduled tasks, aka those with a Due date"),
+         TASK_FILTER_SCHEDULED_TASKS },
+
        { "task-filter-next-7-days-tasks",
          NULL,
          N_("Next 7 Days’ Tasks"),
diff --git a/src/modules/calendar/e-task-shell-view-actions.h 
b/src/modules/calendar/e-task-shell-view-actions.h
index 47593b42c1..760d7c8e25 100644
--- a/src/modules/calendar/e-task-shell-view-actions.h
+++ b/src/modules/calendar/e-task-shell-view-actions.h
@@ -92,6 +92,8 @@
        E_SHELL_WINDOW_ACTION ((window), "task-filter-next-7-days-tasks")
 #define E_SHELL_WINDOW_ACTION_TASK_FILTER_OVERDUE_TASKS(window) \
        E_SHELL_WINDOW_ACTION ((window), "task-filter-overdue-tasks")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_SCHEDULED_TASKS(window) \
+       E_SHELL_WINDOW_ACTION ((window), "task-filter-scheduled-tasks")
 #define E_SHELL_WINDOW_ACTION_TASK_FILTER_TASKS_WITH_ATTACHMENTS(window) \
        E_SHELL_WINDOW_ACTION ((window), "task-filter-tasks-with-attachments")
 #define E_SHELL_WINDOW_ACTION_TASK_FILTER_TASK_FILTER_STARTED(window) \
diff --git a/src/modules/calendar/e-task-shell-view-private.h 
b/src/modules/calendar/e-task-shell-view-private.h
index c1ffe8f82c..98c00c3868 100644
--- a/src/modules/calendar/e-task-shell-view-private.h
+++ b/src/modules/calendar/e-task-shell-view-private.h
@@ -56,15 +56,16 @@ G_BEGIN_DECLS
 /* Filter items are displayed in ascending order.
  * Non-negative values are reserved for categories. */
 enum {
-       TASK_FILTER_ANY_CATEGORY = -10,
-       TASK_FILTER_UNMATCHED = -9,
-       TASK_FILTER_UNCOMPLETED_TASKS = -8,
-       TASK_FILTER_NEXT_7_DAYS_TASKS = -7,
-       TASK_FILTER_STARTED = -6,
-       TASK_FILTER_ACTIVE_TASKS = -5,
-       TASK_FILTER_OVERDUE_TASKS = -4,
-       TASK_FILTER_COMPLETED_TASKS = -3,
-       TASK_FILTER_CANCELLED_TASKS = -2,
+       TASK_FILTER_ANY_CATEGORY = -11,
+       TASK_FILTER_UNMATCHED = -10,
+       TASK_FILTER_UNCOMPLETED_TASKS = -9,
+       TASK_FILTER_NEXT_7_DAYS_TASKS = -8,
+       TASK_FILTER_STARTED = -7,
+       TASK_FILTER_ACTIVE_TASKS = -6,
+       TASK_FILTER_OVERDUE_TASKS = -5,
+       TASK_FILTER_COMPLETED_TASKS = -4,
+       TASK_FILTER_CANCELLED_TASKS = -3,
+       TASK_FILTER_SCHEDULED_TASKS = -2,
        TASK_FILTER_TASKS_WITH_ATTACHMENTS = -1
 };
 
diff --git a/src/modules/calendar/e-task-shell-view.c b/src/modules/calendar/e-task-shell-view.c
index e91b8cc204..24411b5157 100644
--- a/src/modules/calendar/e-task-shell-view.c
+++ b/src/modules/calendar/e-task-shell-view.c
@@ -193,6 +193,12 @@ task_shell_view_execute_search (EShellView *shell_view)
                        query = temp;
                        break;
 
+               case TASK_FILTER_SCHEDULED_TASKS:
+                       temp = g_strdup_printf ("(and (has-due?) %s)", query);
+                       g_free (query);
+                       query = temp;
+                       break;
+
                case TASK_FILTER_COMPLETED_TASKS:
                        temp = g_strdup_printf (
                                "(and (is-completed?) %s)", query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]