aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-03-10 09:47:02 +0800
committerChris Toshok <toshok@src.gnome.org>2002-03-10 09:47:02 +0800
commitb6d54c7762636036e6b9173ef8c40befd5ddd1d8 (patch)
treec6ea642ac28cced94ef416bef891819222c65f16 /addressbook
parentc807f01f8f9f8ec9df6461aad78b1247dd4cc1ce (diff)
downloadgsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar.gz
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar.bz2
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar.lz
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar.xz
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.tar.zst
gsoc2013-evolution-b6d54c7762636036e6b9173ef8c40befd5ddd1d8.zip
since I've gone ahead and made the file backend (by way of
2002-03-09 Chris Toshok <toshok@ximian.com> * gui/widgets/e-addressbook-view.c (jump_to_letter): since I've gone ahead and made the file backend (by way of pas-backend-card-sexp.c) use case insensitive searches for beginswith, there's no need to list upper and lower case here. * gui/component/addressbook.c (addressbook_search_option_items): reorder things to put "Any field contains" at the end, since it's the least efficient search. Also reorder the enum to the same ordering. Change "Name contains" to "Name begins with" and change "Email contains" to "Email is". (addressbook_search_activated): change FULL_NAME to beginswith, and change EMAIL to is to match the labels. * backend/pas/pas-backend-card-sexp.c (compare_name): new function, so we can compare both full and family names (so beginswith can operate on them both.) (endswith_helper): use e_utf8_strstrcase here, since all the backends backends use case insensitive searching. (func_endswith): same. svn path=/trunk/; revision=16004
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog24
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c23
-rw-r--r--addressbook/gui/component/addressbook.c12
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c16
4 files changed, 53 insertions, 22 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 310d5add60..ab1eb8eb3d 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,4 +1,26 @@
-2002-03-07 Chris Toshok <toshok@ximian.com>
+2002-03-09 Chris Toshok <toshok@ximian.com>
+
+ * gui/widgets/e-addressbook-view.c (jump_to_letter): since I've
+ gone ahead and made the file backend (by way of
+ pas-backend-card-sexp.c) use case insensitive searches for
+ beginswith, there's no need to list upper and lower case here.
+
+ * gui/component/addressbook.c (addressbook_search_option_items):
+ reorder things to put "Any field contains" at the end, since it's
+ the least efficient search. Also reorder the enum to the same
+ ordering. Change "Name contains" to "Name begins with" and change
+ "Email contains" to "Email is".
+ (addressbook_search_activated): change FULL_NAME to beginswith,
+ and change EMAIL to is to match the labels.
+
+ * backend/pas/pas-backend-card-sexp.c (compare_name): new
+ function, so we can compare both full and family names (so
+ beginswith can operate on them both.)
+ (endswith_helper): use e_utf8_strstrcase here, since all the
+ backends backends use case insensitive searching.
+ (func_endswith): same.
+
+2002-03-06 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-book.c (pas_book_queue_create_card): track
union/struct change.
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
index 8b531d5ede..ea217fa052 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ b/addressbook/backend/pas/pas-backend-card-sexp.c
@@ -71,6 +71,23 @@ compare_phone (ECardSimple *card, const char *str,
}
static gboolean
+compare_name (ECardSimple *card, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ const char *name;
+
+ name = e_card_simple_get_const (card, E_CARD_SIMPLE_FIELD_FULL_NAME);
+ if (name && compare (name, str))
+ return TRUE;
+
+ name = e_card_simple_get_const (card, E_CARD_SIMPLE_FIELD_FAMILY_NAME);
+ if (name && compare (name, str))
+ return TRUE;
+
+ return FALSE;
+}
+
+static gboolean
compare_address (ECardSimple *card, const char *str,
char *(*compare)(const char*, const char*))
{
@@ -157,7 +174,7 @@ static struct prop_info {
/* query prop, ecard prop, type, list compare function */
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "file_as" ),
- NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "full_name" ),
+ LIST_PROP ( "full_name", "full_name", compare_name), /* not really a list, but we need to compare both full and surname */
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_URL, "url", "url" ),
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MAILER, "mailer", "mailer"),
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG, "org", "org"),
@@ -280,7 +297,7 @@ static char *
endswith_helper (const char *s1, const char *s2)
{
char *p;
- if ((p = strstr(s1, s2))
+ if ((p = (char*)e_utf8_strstrcase(s1, s2))
&& (strlen(p) == strlen(s2)))
return p;
else
@@ -299,7 +316,7 @@ static char *
beginswith_helper (const char *s1, const char *s2)
{
char *p;
- if ((p = strstr(s1, s2))
+ if ((p = (char*)e_utf8_strstrcase(s1, s2))
&& (p == s1))
return p;
else
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 73cb71abff..72cf16cdeb 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -825,18 +825,18 @@ static ESearchBarItem addressbook_search_menu_items[] = {
};
enum {
- ESB_ANY,
ESB_FULL_NAME,
ESB_EMAIL,
ESB_CATEGORY,
+ ESB_ANY,
ESB_ADVANCED
};
static ESearchBarItem addressbook_search_option_items[] = {
- { N_("Any field contains"), ESB_ANY, NULL },
- { N_("Name contains"), ESB_FULL_NAME, NULL },
- { N_("Email contains"), ESB_EMAIL, NULL },
+ { N_("Name begins with"), ESB_FULL_NAME, NULL },
+ { N_("Email is"), ESB_EMAIL, NULL },
{ N_("Category is"), ESB_CATEGORY, NULL }, /* We attach subitems below */
+ { N_("Any field contains"), ESB_ANY, NULL },
{ N_("Advanced..."), ESB_ADVANCED, NULL },
{ NULL, -1, NULL }
};
@@ -898,11 +898,11 @@ addressbook_search_activated (ESearchBar *esb, AddressbookView *view)
s->str);
break;
case ESB_FULL_NAME:
- search_query = g_strdup_printf ("(contains \"full_name\" %s)",
+ search_query = g_strdup_printf ("(beginswith \"full_name\" %s)",
s->str);
break;
case ESB_EMAIL:
- search_query = g_strdup_printf ("(contains \"email\" %s)",
+ search_query = g_strdup_printf ("(is \"email\" %s)",
s->str);
break;
case ESB_CATEGORY:
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 1679c95392..6a78cf13eb 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -649,25 +649,17 @@ jump_to_letter(EAddressbookView *view, gunichar letter)
g_assert (letter_v != NULL && letter_v[0] != NULL);
gstr = g_string_new ("(not (or ");
for (p = letter_v + 1; *p != NULL; p++) {
- char s[7];
-
g_string_sprintfa (gstr, "(beginswith \"file_as\" \"%s\")", *p);
- s[g_unichar_to_utf8 (g_unichar_toupper (g_utf8_get_char (*p)), s)] = '\0';
- g_string_sprintfa (gstr, "(beginswith \"file_as\" \"%s\")", s);
}
g_string_append (gstr, "))");
query = gstr->str;
g_strfreev (letter_v);
g_string_free (gstr, FALSE);
} else {
- char s1[6 + 1], s2[6 + 1];
-
- s1 [g_unichar_to_utf8 (letter, s1)] = '\0';
- s2 [g_unichar_to_utf8 (g_unichar_toupper (letter), s2)] = '\0';
- query = g_strdup_printf ("(or "
- "(beginswith \"file_as\" \"%s\")"
- "(beginswith \"file_as\" \"%s\")"
- ")", s1, s2);
+ char s[6 + 1];
+
+ s [g_unichar_to_utf8 (letter, s)] = '\0';
+ query = g_strdup_printf ("(beginswith \"file_as\" \"%s\")", s);
}
gtk_object_set (GTK_OBJECT (view),
"query", query,