aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-11-19 22:40:50 +0800
committerMilan Crha <mcrha@redhat.com>2009-11-19 22:40:50 +0800
commitaa813bd7cadffa0110ddeeecd2b8df9d367db6e1 (patch)
tree8580dce61f4952b17225fa5262339432db092e4c /modules/calendar
parent72861cffee5a3f9a5434fe0a94c7ec60beec1cc2 (diff)
downloadgsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.tar.gz
gsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.tar.zst
gsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.zip
Bug #579599 - Let the Advanced Search work again
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c40
-rw-r--r--modules/calendar/e-cal-shell-view-actions.h2
-rw-r--r--modules/calendar/e-cal-shell-view-private.h1
-rw-r--r--modules/calendar/e-cal-shell-view.c65
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c40
-rw-r--r--modules/calendar/e-memo-shell-view-actions.h2
-rw-r--r--modules/calendar/e-memo-shell-view-private.h1
-rw-r--r--modules/calendar/e-memo-shell-view.c67
-rw-r--r--modules/calendar/e-task-shell-view-actions.c40
-rw-r--r--modules/calendar/e-task-shell-view-actions.h2
-rw-r--r--modules/calendar/e-task-shell-view-private.h1
-rw-r--r--modules/calendar/e-task-shell-view.c67
12 files changed, 158 insertions, 170 deletions
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index bc0fcc00e5..e88fae7eb9 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -363,29 +363,6 @@ action_calendar_rename_cb (GtkAction *action,
}
static void
-action_calendar_search_cb (GtkRadioAction *action,
- GtkRadioAction *current,
- ECalShellView *cal_shell_view)
-{
- EShellView *shell_view;
- EShellContent *shell_content;
- const gchar *search_hint;
-
- /* XXX Figure out a way to handle this in EShellContent
- * instead of every shell view having to handle it.
- * The problem is EShellContent does not know what
- * the search option actions are for this view. It
- * would have to dig up the popup menu and retrieve
- * the action for each menu item. Seems messy. */
-
- shell_view = E_SHELL_VIEW (cal_shell_view);
- shell_content = e_shell_view_get_shell_content (shell_view);
-
- search_hint = gtk_action_get_label (GTK_ACTION (current));
- e_shell_content_set_search_hint (shell_content, search_hint);
-}
-
-static void
action_calendar_select_one_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
@@ -1588,6 +1565,13 @@ static GtkRadioActionEntry calendar_filter_entries[] = {
static GtkRadioActionEntry calendar_search_entries[] = {
+ { "calendar-search-advanced-hidden",
+ NULL,
+ N_("Advanced search"),
+ NULL,
+ NULL,
+ CALENDAR_SEARCH_ADVANCED },
+
{ "calendar-search-any-field-contains",
NULL,
N_("Any field contains"),
@@ -1648,6 +1632,7 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
EShellWindow *shell_window;
GtkActionGroup *action_group;
GtkAction *action;
+ GtkRadioAction *radio_action;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -1667,8 +1652,13 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
gtk_action_group_add_radio_actions (
action_group, calendar_search_entries,
G_N_ELEMENTS (calendar_search_entries),
- CALENDAR_SEARCH_SUMMARY_CONTAINS,
- G_CALLBACK (action_calendar_search_cb), cal_shell_view);
+ -1, NULL, NULL);
+
+ /* Advanced Search action */
+ radio_action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ADVANCED_HIDDEN));
+ e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action);
+ gtk_action_set_visible (GTK_ACTION (radio_action), FALSE);
+ gtk_radio_action_set_current_value (radio_action, CALENDAR_SEARCH_SUMMARY_CONTAINS);
/* Lockdown Printing Actions */
action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
diff --git a/modules/calendar/e-cal-shell-view-actions.h b/modules/calendar/e-cal-shell-view-actions.h
index e05649397e..840985b03a 100644
--- a/modules/calendar/e-cal-shell-view-actions.h
+++ b/modules/calendar/e-cal-shell-view-actions.h
@@ -151,6 +151,8 @@
E_SHELL_WINDOW_ACTION ((window), "calendar-filter-next-7-days-appointments")
#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_UNMATCHED(window) \
E_SHELL_WINDOW_ACTION ((window), "calendar-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_ADVANCED_HIDDEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-advanced-hidden")
#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_ANY_FIELD_CONTAINS(window) \
E_SHELL_WINDOW_ACTION ((window), "calendar-search-any-field-contains")
#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_DESCRIPTION_CONTAINS(window) \
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 1f447bc162..c92fb8cffe 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -95,6 +95,7 @@ enum {
/* Search items are displayed in ascending order. */
enum {
+ CALENDAR_SEARCH_ADVANCED = -1,
CALENDAR_SEARCH_SUMMARY_CONTAINS,
CALENDAR_SEARCH_DESCRIPTION_CONTAINS,
CALENDAR_SEARCH_ANY_FIELD_CONTAINS
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 44e0883527..f767f92ec6 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -62,9 +62,6 @@ cal_shell_view_execute_search (EShellView *shell_view)
GnomeCalendar *calendar;
ECalendar *date_navigator;
GtkRadioAction *action;
- GString *string;
- const gchar *format;
- const gchar *text;
time_t start_range;
time_t end_range;
gboolean range_search;
@@ -80,36 +77,47 @@ cal_shell_view_execute_search (EShellView *shell_view)
action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ANY_FIELD_CONTAINS));
value = gtk_radio_action_get_current_value (action);
- text = e_shell_content_get_search_text (shell_content);
+ if (value == CALENDAR_SEARCH_ADVANCED) {
+ query = e_shell_content_get_search_rule_as_string (shell_content);
- if (text == NULL || *text == '\0') {
- text = "";
- value = CALENDAR_SEARCH_SUMMARY_CONTAINS;
- }
+ if (!query)
+ query = g_strdup ("");
+ } else {
+ const gchar *format;
+ const gchar *text;
+ GString *string;
- switch (value) {
- default:
+ text = e_shell_content_get_search_text (shell_content);
+
+ if (text == NULL || *text == '\0') {
text = "";
- /* fall through */
+ value = CALENDAR_SEARCH_SUMMARY_CONTAINS;
+ }
- case CALENDAR_SEARCH_SUMMARY_CONTAINS:
- format = "(contains? \"summary\" %s)";
- break;
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
- case CALENDAR_SEARCH_DESCRIPTION_CONTAINS:
- format = "(contains? \"description\" %s)";
- break;
+ case CALENDAR_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
- case CALENDAR_SEARCH_ANY_FIELD_CONTAINS:
- format = "(contains? \"any\" %s)";
- break;
- }
+ case CALENDAR_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
- /* Build the query. */
- string = g_string_new ("");
- e_sexp_encode_string (string, text);
- query = g_strdup_printf (format, string->str);
- g_string_free (string, TRUE);
+ case CALENDAR_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+ }
range_search = FALSE;
start_range = end_range = 0;
@@ -178,11 +186,6 @@ cal_shell_view_execute_search (EShellView *shell_view)
}
}
- /* XXX This is wrong. We need to programmatically construct an
- * EFilterRule, tell it to build code, and pass the resulting
- * expressing string to ECalModel. */
- e_shell_content_set_search_rule (shell_content, NULL);
-
cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar);
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 80ebca237d..57420cd963 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -526,29 +526,6 @@ action_memo_save_as_cb (GtkAction *action,
}
static void
-action_memo_search_cb (GtkRadioAction *action,
- GtkRadioAction *current,
- EMemoShellView *memo_shell_view)
-{
- EShellView *shell_view;
- EShellContent *shell_content;
- const gchar *search_hint;
-
- /* XXX Figure out a way to handle this in EShellContent
- * instead of every shell view having to handle it.
- * The problem is EShellContent does not know what
- * the search option actions are for this view. It
- * would have to dig up the popup menu and retrieve
- * the action for each menu item. Seems messy. */
-
- shell_view = E_SHELL_VIEW (memo_shell_view);
- shell_content = e_shell_view_get_shell_content (shell_view);
-
- search_hint = gtk_action_get_label (GTK_ACTION (current));
- e_shell_content_set_search_hint (shell_content, search_hint);
-}
-
-static void
action_memo_view_cb (GtkRadioAction *action,
GtkRadioAction *current,
EMemoShellView *memo_shell_view)
@@ -800,6 +777,13 @@ static GtkRadioActionEntry memo_filter_entries[] = {
static GtkRadioActionEntry memo_search_entries[] = {
+ { "memo-search-advanced-hidden",
+ NULL,
+ N_("Advanced search"),
+ NULL,
+ NULL,
+ MEMO_SEARCH_ADVANCED },
+
{ "memo-search-any-field-contains",
NULL,
N_("Any field contains"),
@@ -880,6 +864,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
GtkActionGroup *action_group;
GConfBridge *bridge;
GtkAction *action;
+ GtkRadioAction *radio_action;
GObject *object;
const gchar *key;
@@ -907,8 +892,13 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
gtk_action_group_add_radio_actions (
action_group, memo_search_entries,
G_N_ELEMENTS (memo_search_entries),
- MEMO_SEARCH_SUMMARY_CONTAINS,
- G_CALLBACK (action_memo_search_cb), memo_shell_view);
+ -1, NULL, NULL);
+
+ /* Advanced Search action */
+ radio_action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ADVANCED_HIDDEN));
+ e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action);
+ gtk_action_set_visible (GTK_ACTION (radio_action), FALSE);
+ gtk_radio_action_set_current_value (radio_action, MEMO_SEARCH_SUMMARY_CONTAINS);
/* Lockdown Printing Actions */
action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
diff --git a/modules/calendar/e-memo-shell-view-actions.h b/modules/calendar/e-memo-shell-view-actions.h
index d43d0239d9..9fe4d6964d 100644
--- a/modules/calendar/e-memo-shell-view-actions.h
+++ b/modules/calendar/e-memo-shell-view-actions.h
@@ -75,6 +75,8 @@
E_SHELL_WINDOW_ACTION ((window), "memo-filter-any-category")
#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_UNMATCHED(window) \
E_SHELL_WINDOW_ACTION ((window), "memo-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_ADVANCED_HIDDEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-search-advanced-hidden")
#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_ANY_FIELD_CONTAINS(window) \
E_SHELL_WINDOW_ACTION ((window), "memo-search-any-field-contains")
#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_DESCRIPTION_CONTAINS(window) \
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 37556943f2..1818ba0808 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -81,6 +81,7 @@ enum {
/* Search items are displayed in ascending order. */
enum {
+ MEMO_SEARCH_ADVANCED = -1,
MEMO_SEARCH_SUMMARY_CONTAINS,
MEMO_SEARCH_DESCRIPTION_CONTAINS,
MEMO_SEARCH_ANY_FIELD_CONTAINS
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 5cc8e159bb..5d932e1599 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -58,51 +58,59 @@ memo_shell_view_execute_search (EShellView *shell_view)
EShellWindow *shell_window;
EShellContent *shell_content;
GtkRadioAction *action;
- GString *string;
ECalComponentPreview *memo_preview;
EMemoTable *memo_table;
ECalModel *model;
- const gchar *format;
- const gchar *text;
gchar *query;
gchar *temp;
gint value;
shell_content = e_shell_view_get_shell_content (shell_view);
- text = e_shell_content_get_search_text (shell_content);
-
shell_window = e_shell_view_get_shell_window (shell_view);
action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ANY_FIELD_CONTAINS));
value = gtk_radio_action_get_current_value (action);
- if (text == NULL || *text == '\0') {
- text = "";
- value = MEMO_SEARCH_SUMMARY_CONTAINS;
- }
+ if (value == MEMO_SEARCH_ADVANCED) {
+ query = e_shell_content_get_search_rule_as_string (shell_content);
- switch (value) {
- default:
+ if (!query)
+ query = g_strdup ("");
+ } else {
+ const gchar *format;
+ const gchar *text;
+ GString *string;
+
+ text = e_shell_content_get_search_text (shell_content);
+
+ if (text == NULL || *text == '\0') {
text = "";
- /* fall through */
+ value = MEMO_SEARCH_SUMMARY_CONTAINS;
+ }
- case MEMO_SEARCH_SUMMARY_CONTAINS:
- format = "(contains? \"summary\" %s)";
- break;
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
- case MEMO_SEARCH_DESCRIPTION_CONTAINS:
- format = "(contains? \"description\" %s)";
- break;
+ case MEMO_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
- case MEMO_SEARCH_ANY_FIELD_CONTAINS:
- format = "(contains? \"any\" %s)";
- break;
- }
+ case MEMO_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
- /* Build the query. */
- string = g_string_new ("");
- e_sexp_encode_string (string, text);
- query = g_strdup_printf (format, string->str);
- g_string_free (string, TRUE);
+ case MEMO_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+ }
/* Apply selected filter. */
value = e_shell_content_get_filter_value (shell_content);
@@ -134,11 +142,6 @@ memo_shell_view_execute_search (EShellView *shell_view)
}
}
- /* XXX This is wrong. We need to programmatically construct an
- * EFilterRule, tell it to build code, and pass the resulting
- * expression string to ECalModel. */
- e_shell_content_set_search_rule (shell_content, NULL);
-
/* Submit the query. */
memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index e5063c1d85..0e77efb1d8 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -653,29 +653,6 @@ action_task_save_as_cb (GtkAction *action,
}
static void
-action_task_search_cb (GtkRadioAction *action,
- GtkRadioAction *current,
- ETaskShellView *task_shell_view)
-{
- EShellView *shell_view;
- EShellContent *shell_content;
- const gchar *search_hint;
-
- /* XXX Figure out a way to handle this in EShellContent
- * instead of every shell view having to handle it.
- * The problem is EShellContent does not know what
- * the search option actions are for this view. It
- * would have to dig up the popup menu and retrieve
- * the action for each menu item. Seems messy. */
-
- shell_view = E_SHELL_VIEW (task_shell_view);
- shell_content = e_shell_view_get_shell_content (shell_view);
-
- search_hint = gtk_action_get_label (GTK_ACTION (current));
- e_shell_content_set_search_hint (shell_content, search_hint);
-}
-
-static void
action_task_view_cb (GtkRadioAction *action,
GtkRadioAction *current,
ETaskShellView *task_shell_view)
@@ -1001,6 +978,13 @@ static GtkRadioActionEntry task_filter_entries[] = {
static GtkRadioActionEntry task_search_entries[] = {
+ { "task-search-advanced-hidden",
+ NULL,
+ N_("Advanced search"),
+ NULL,
+ NULL,
+ TASK_SEARCH_ADVANCED },
+
{ "task-search-any-field-contains",
NULL,
N_("Any field contains"),
@@ -1081,6 +1065,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
GtkActionGroup *action_group;
GConfBridge *bridge;
GtkAction *action;
+ GtkRadioAction *radio_action;
GObject *object;
const gchar *key;
@@ -1108,8 +1093,13 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
gtk_action_group_add_radio_actions (
action_group, task_search_entries,
G_N_ELEMENTS (task_search_entries),
- TASK_SEARCH_SUMMARY_CONTAINS,
- G_CALLBACK (action_task_search_cb), task_shell_view);
+ -1, NULL, NULL);
+
+ /* Advanced Search action */
+ radio_action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ADVANCED_HIDDEN));
+ e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action);
+ gtk_action_set_visible (GTK_ACTION (radio_action), FALSE);
+ gtk_radio_action_set_current_value (radio_action, TASK_SEARCH_SUMMARY_CONTAINS);
/* Lockdown Printing Actions */
action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
diff --git a/modules/calendar/e-task-shell-view-actions.h b/modules/calendar/e-task-shell-view-actions.h
index daa70c36da..6c2d5d51b6 100644
--- a/modules/calendar/e-task-shell-view-actions.h
+++ b/modules/calendar/e-task-shell-view-actions.h
@@ -93,6 +93,8 @@
E_SHELL_WINDOW_ACTION ((window), "task-filter-tasks-with-attachments")
#define E_SHELL_WINDOW_ACTION_TASK_FILTER_UNMATCHED(window) \
E_SHELL_WINDOW_ACTION ((window), "task-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_ADVANCED_HIDDEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-search-advanced-hidden")
#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_ANY_FIELD_CONTAINS(window) \
E_SHELL_WINDOW_ACTION ((window), "task-search-any-field-contains")
#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_DESCRIPTION_CONTAINS(window) \
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index 38b03ae359..fcbe852898 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -90,6 +90,7 @@ enum {
/* Search items are displayed in ascending order. */
enum {
+ TASK_SEARCH_ADVANCED = -1,
TASK_SEARCH_SUMMARY_CONTAINS,
TASK_SEARCH_DESCRIPTION_CONTAINS,
TASK_SEARCH_ANY_FIELD_CONTAINS
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 1bb2820911..b7c2bc9333 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -97,12 +97,9 @@ task_shell_view_execute_search (EShellView *shell_view)
EShellWindow *shell_window;
EShellContent *shell_content;
GtkRadioAction *action;
- GString *string;
ECalComponentPreview *task_preview;
ECalendarTable *task_table;
ECalModel *model;
- const gchar *format;
- const gchar *text;
time_t start_range;
time_t end_range;
gchar *start, *end;
@@ -111,40 +108,51 @@ task_shell_view_execute_search (EShellView *shell_view)
gint value;
shell_content = e_shell_view_get_shell_content (shell_view);
- text = e_shell_content_get_search_text (shell_content);
-
shell_window = e_shell_view_get_shell_window (shell_view);
action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS));
value = gtk_radio_action_get_current_value (action);
- if (text == NULL || *text == '\0') {
- text = "";
- value = TASK_SEARCH_SUMMARY_CONTAINS;
- }
+ if (value == TASK_SEARCH_ADVANCED) {
+ query = e_shell_content_get_search_rule_as_string (shell_content);
- switch (value) {
- default:
+ if (!query)
+ query = g_strdup ("");
+ } else {
+ const gchar *format;
+ const gchar *text;
+ GString *string;
+
+ text = e_shell_content_get_search_text (shell_content);
+
+ if (text == NULL || *text == '\0') {
text = "";
- /* fall through */
+ value = TASK_SEARCH_SUMMARY_CONTAINS;
+ }
- case TASK_SEARCH_SUMMARY_CONTAINS:
- format = "(contains? \"summary\" %s)";
- break;
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
- case TASK_SEARCH_DESCRIPTION_CONTAINS:
- format = "(contains? \"description\" %s)";
- break;
+ case TASK_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
- case TASK_SEARCH_ANY_FIELD_CONTAINS:
- format = "(contains? \"any\" %s)";
- break;
- }
+ case TASK_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
- /* Build the query. */
- string = g_string_new ("");
- e_sexp_encode_string (string, text);
- query = g_strdup_printf (format, string->str);
- g_string_free (string, TRUE);
+ case TASK_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+ }
/* Apply selected filter. */
value = e_shell_content_get_filter_value (shell_content);
@@ -246,11 +254,6 @@ task_shell_view_execute_search (EShellView *shell_view)
query = temp2;
}
- /* XXX This is wrong. We need to programmatically construct an
- * EFilterRule, tell it to build code, and pass the resulting
- * expression string to ECalModel. */
- e_shell_content_set_search_rule (shell_content, NULL);
-
/* Submit the query. */
task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
task_table = e_task_shell_content_get_task_table (task_shell_content);