[evolution] Bug #269413 - Search treats "4 weeks" and "1 month" as synonymous
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #269413 - Search treats "4 weeks" and "1 month" as synonymous
- Date: Mon, 20 Jun 2011 11:58:17 +0000 (UTC)
commit d3f72293ce36ffded8e9807a2a42e13ae6ca8a32
Author: Milan Crha <mcrha redhat com>
Date: Mon Jun 20 13:57:48 2011 +0200
Bug #269413 - Search treats "4 weeks" and "1 month" as synonymous
filter/e-filter-datespec.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/filter/e-filter-datespec.c b/filter/e-filter-datespec.c
index d7aa93a..a7c2aa2 100644
--- a/filter/e-filter-datespec.c
+++ b/filter/e-filter-datespec.c
@@ -432,12 +432,30 @@ filter_datespec_format_sexp (EFilterElement *element,
g_string_append_printf (out, "%d", (gint) fds->value);
break;
case FDST_X_AGO:
- g_string_append_printf (
- out, "(- (get-current-date) %d)", (gint) fds->value);
+ switch (get_best_span (fds->value)) {
+ case 5: /* months */
+ g_string_append_printf (out, "(get-relative-months (- 0 %d))", (gint) (fds->value / timespans[5].seconds));
+ break;
+ case 6: /* years */
+ g_string_append_printf (out, "(get-relative-months (- 0 %d))", (gint) (12 * fds->value / timespans[6].seconds));
+ break;
+ default:
+ g_string_append_printf (out, "(- (get-current-date) %d)", (gint) fds->value);
+ break;
+ }
break;
case FDST_X_FUTURE:
- g_string_append_printf (
- out, "(+ (get-current-date) %d)", (gint) fds->value);
+ switch (get_best_span (fds->value)) {
+ case 5: /* months */
+ g_string_append_printf (out, "(get-relative-months %d)", (gint) (fds->value / timespans[5].seconds));
+ break;
+ case 6: /* years */
+ g_string_append_printf (out, "(get-relative-months %d)", (gint) (12 * fds->value / timespans[6].seconds));
+ break;
+ default:
+ g_string_append_printf (out, "(+ (get-current-date) %d)", (gint) fds->value);
+ break;
+ }
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]