Re: [evolution-patches] bug fix for 41843, csv exporting file should have consistent english field name




On Fri, 2003-04-25 at 09:26, Chris Toshok wrote:
> On Thu, 2003-04-24 at 04:52, Gilbert Fang wrote:
> > Hi, toshok
> >  Please review it . 
> > patch41843_20030424:  e_card_simple_get_name should return a
> > non-localized name
> 
> This is not true - it must return a localized name because it's used
> elsewhere in the UI (specifically in the minicard view.  it's used to
> create the minicard field names.)
> 
> use e_card_simple_get_ecard_field instead.  unfortunately that'll return
> strings that will be different than what you're checking against now.
> 

Thanks.

Maybe my previous patch is not right.But this is really a trouble for
data exchanging  with staroffice. 

I wrote  a new patch, which  only puts all the csv field names in the
export's code. Thus it will not affect evolution's other part,
I think  csv field name needs its own field name rationally, because
it has the difference in semantics with the e-card-simple-field. 

Could you please review it ?

Gilbert 



Index: evolution-addressbook-export-list-cards.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/tools/evolution-addressbook-export-list-cards.c,v
retrieving revision 1.1
diff -u -r1.1 evolution-addressbook-export-list-cards.c
--- evolution-addressbook-export-list-cards.c	7 Apr 2003 16:21:03 -0000	1.1
+++ evolution-addressbook-export-list-cards.c	25 Apr 2003 03:22:00 -0000
@@ -149,21 +149,21 @@
 
 #define NOMAP -1
 static ECardCSVFieldData csv_field_data[] = {
-	{E_CARD_SIMPLE_FIELD_CSV_FILE_AS, E_CARD_SIMPLE_FIELD_FILE_AS, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_FULL_NAME, E_CARD_SIMPLE_FIELD_CSV_FULL_NAME, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_EMAIL, E_CARD_SIMPLE_FIELD_EMAIL, ""},
+	{E_CARD_SIMPLE_FIELD_CSV_FILE_AS, E_CARD_SIMPLE_FIELD_FILE_AS, "File As"},
+	{E_CARD_SIMPLE_FIELD_CSV_FULL_NAME, E_CARD_SIMPLE_FIELD_CSV_FULL_NAME, "Name"},
+	{E_CARD_SIMPLE_FIELD_CSV_EMAIL, E_CARD_SIMPLE_FIELD_EMAIL, "Email"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_PRIMARY, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY,
-	 ""},
+	 "Primary"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_ASSISTANT,
-	 E_CARD_SIMPLE_FIELD_PHONE_ASSISTANT, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_ASSISTANT, "Assistant Phone"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_BUSINESS,
-	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, "Business"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_CALLBACK,
-	 E_CARD_SIMPLE_FIELD_PHONE_CALLBACK, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_CALLBACK, "Callback"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_COMPANY, E_CARD_SIMPLE_FIELD_PHONE_COMPANY,
-	 ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_HOME, E_CARD_SIMPLE_FIELD_PHONE_HOME, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_ORG, E_CARD_SIMPLE_FIELD_ORG, ""},
+	 "Company"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_HOME, E_CARD_SIMPLE_FIELD_PHONE_HOME, "Home"},
+	{E_CARD_SIMPLE_FIELD_CSV_ORG, E_CARD_SIMPLE_FIELD_ORG, "Organization"},
 	/*E_CARD_SIMPLE_FIELD_CSV_ADDRESS_BUSINESS, */
 	{E_CARD_SIMPLE_FIELD_CSV_ADDRESS_BUSINESS_STREET, NOMAP,
 	 "Business Address"},
@@ -188,25 +188,25 @@
 	{E_CARD_SIMPLE_FIELD_CSV_ADDRESS_HOME_COUNTRY, NOMAP,
 	 "Home Address Country"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_MOBILE, E_CARD_SIMPLE_FIELD_PHONE_MOBILE,
-	 ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_CAR, E_CARD_SIMPLE_FIELD_PHONE_CAR, ""},
+	 "Mobile"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_CAR, E_CARD_SIMPLE_FIELD_PHONE_CAR, "Car"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_BUSINESS_FAX,
-	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, "Business Fax"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_HOME_FAX,
-	 E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, "Home Fax"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_BUSINESS_2,
-	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, "Business 2"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_HOME_2, E_CARD_SIMPLE_FIELD_PHONE_HOME_2,
-	 ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_ISDN, E_CARD_SIMPLE_FIELD_PHONE_ISDN, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_OTHER, E_CARD_SIMPLE_FIELD_PHONE_OTHER, ""},
+	 "Home 2"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_ISDN, E_CARD_SIMPLE_FIELD_PHONE_ISDN, "ISDN"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_OTHER, E_CARD_SIMPLE_FIELD_PHONE_OTHER, "Other"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_OTHER_FAX,
-	 E_CARD_SIMPLE_FIELD_PHONE_OTHER_FAX, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_PAGER, E_CARD_SIMPLE_FIELD_PHONE_PAGER, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_RADIO, E_CARD_SIMPLE_FIELD_PHONE_RADIO, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_PHONE_TELEX, E_CARD_SIMPLE_FIELD_PHONE_TELEX, ""},
+	 E_CARD_SIMPLE_FIELD_PHONE_OTHER_FAX, "Other Fax"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_PAGER, E_CARD_SIMPLE_FIELD_PHONE_PAGER, "Pager"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_RADIO, E_CARD_SIMPLE_FIELD_PHONE_RADIO, "Radio"},
+	{E_CARD_SIMPLE_FIELD_CSV_PHONE_TELEX, E_CARD_SIMPLE_FIELD_PHONE_TELEX, "Telex"},
 	{E_CARD_SIMPLE_FIELD_CSV_PHONE_TTYTDD, E_CARD_SIMPLE_FIELD_PHONE_TTYTDD,
-	 ""},
+	 "TTY"},
 	/*E_CARD_SIMPLE_FIELD_CSV_ADDRESS_OTHER, */
 	{E_CARD_SIMPLE_FIELD_CSV_ADDRESS_OTHER_STREET, NOMAP, "Other Address"},
 	{E_CARD_SIMPLE_FIELD_CSV_ADDRESS_OTHER_EXT, NOMAP, "Other Address2"},
@@ -218,20 +218,20 @@
 	 "Other Address PostCode"},
 	{E_CARD_SIMPLE_FIELD_CSV_ADDRESS_OTHER_COUNTRY, NOMAP,
 	 "Other Address Country"},
-	{E_CARD_SIMPLE_FIELD_CSV_EMAIL_2, E_CARD_SIMPLE_FIELD_EMAIL_2, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_EMAIL_3, E_CARD_SIMPLE_FIELD_EMAIL_3, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_URL, E_CARD_SIMPLE_FIELD_URL, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_ORG_UNIT, E_CARD_SIMPLE_FIELD_ORG_UNIT, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_OFFICE, E_CARD_SIMPLE_FIELD_OFFICE, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_TITLE, E_CARD_SIMPLE_FIELD_TITLE, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_ROLE, E_CARD_SIMPLE_FIELD_ROLE, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_MANAGER, E_CARD_SIMPLE_FIELD_MANAGER, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_ASSISTANT, E_CARD_SIMPLE_FIELD_ASSISTANT, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_NICKNAME, E_CARD_SIMPLE_FIELD_NICKNAME, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_SPOUSE, E_CARD_SIMPLE_FIELD_SPOUSE, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_NOTE, E_CARD_SIMPLE_FIELD_NOTE, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_CALURI, E_CARD_SIMPLE_FIELD_CALURI, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_FBURL, E_CARD_SIMPLE_FIELD_FBURL, ""},
+	{E_CARD_SIMPLE_FIELD_CSV_EMAIL_2, E_CARD_SIMPLE_FIELD_EMAIL_2, "Email 2"},
+	{E_CARD_SIMPLE_FIELD_CSV_EMAIL_3, E_CARD_SIMPLE_FIELD_EMAIL_3, "Email 3"},
+	{E_CARD_SIMPLE_FIELD_CSV_URL, E_CARD_SIMPLE_FIELD_URL, "Web Site"},
+	{E_CARD_SIMPLE_FIELD_CSV_ORG_UNIT, E_CARD_SIMPLE_FIELD_ORG_UNIT, "Department"},
+	{E_CARD_SIMPLE_FIELD_CSV_OFFICE, E_CARD_SIMPLE_FIELD_OFFICE, "Office"},
+	{E_CARD_SIMPLE_FIELD_CSV_TITLE, E_CARD_SIMPLE_FIELD_TITLE, "Title"},
+	{E_CARD_SIMPLE_FIELD_CSV_ROLE, E_CARD_SIMPLE_FIELD_ROLE, "Profession"},
+	{E_CARD_SIMPLE_FIELD_CSV_MANAGER, E_CARD_SIMPLE_FIELD_MANAGER, "Manager"},
+	{E_CARD_SIMPLE_FIELD_CSV_ASSISTANT, E_CARD_SIMPLE_FIELD_ASSISTANT, "Assistant"},
+	{E_CARD_SIMPLE_FIELD_CSV_NICKNAME, E_CARD_SIMPLE_FIELD_NICKNAME, "Nickname"},
+	{E_CARD_SIMPLE_FIELD_CSV_SPOUSE, E_CARD_SIMPLE_FIELD_SPOUSE, "Spouse"},
+	{E_CARD_SIMPLE_FIELD_CSV_NOTE, E_CARD_SIMPLE_FIELD_NOTE, "Note"},
+	{E_CARD_SIMPLE_FIELD_CSV_CALURI, E_CARD_SIMPLE_FIELD_CALURI, "Calendar URI"},
+	{E_CARD_SIMPLE_FIELD_CSV_FBURL, E_CARD_SIMPLE_FIELD_FBURL, "Free-busy URL"},
 	/*E_CARD_SIMPLE_FIELD_ANNIVERSARY, */
 	{E_CARD_SIMPLE_FIELD_CSV_ANNIVERSARY_YEAR, NOMAP, "Anniversary Year"},
 	{E_CARD_SIMPLE_FIELD_CSV_ANNIVERSARY_MONTH, NOMAP, "Anniversary Month"},
@@ -240,16 +240,16 @@
 	{E_CARD_SIMPLE_FIELD_CSV_BIRTH_DATE_YEAR, NOMAP, "Birth Year"},
 	{E_CARD_SIMPLE_FIELD_CSV_BIRTH_DATE_MONTH, NOMAP, "Birth Month"},
 	{E_CARD_SIMPLE_FIELD_CSV_BIRTH_DATE_DAY, NOMAP, "Birth Day"},
-	{E_CARD_SIMPLE_FIELD_CSV_MAILER, E_CARD_SIMPLE_FIELD_MAILER, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_NAME_OR_ORG, E_CARD_SIMPLE_FIELD_NAME_OR_ORG, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_CATEGORIES, E_CARD_SIMPLE_FIELD_CATEGORIES, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_FAMILY_NAME, E_CARD_SIMPLE_FIELD_FAMILY_NAME, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_GIVEN_NAME, E_CARD_SIMPLE_FIELD_GIVEN_NAME, ""},
+	{E_CARD_SIMPLE_FIELD_CSV_MAILER, E_CARD_SIMPLE_FIELD_MAILER, "Mailer"},
+	{E_CARD_SIMPLE_FIELD_CSV_NAME_OR_ORG, E_CARD_SIMPLE_FIELD_NAME_OR_ORG, "Name or Org"},
+	{E_CARD_SIMPLE_FIELD_CSV_CATEGORIES, E_CARD_SIMPLE_FIELD_CATEGORIES, "Categories"},
+	{E_CARD_SIMPLE_FIELD_CSV_FAMILY_NAME, E_CARD_SIMPLE_FIELD_FAMILY_NAME, "Family Name"},
+	{E_CARD_SIMPLE_FIELD_CSV_GIVEN_NAME, E_CARD_SIMPLE_FIELD_GIVEN_NAME, "Given Name"},
 	{E_CARD_SIMPLE_FIELD_CSV_ADDITIONAL_NAME,
-	 E_CARD_SIMPLE_FIELD_ADDITIONAL_NAME, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_NAME_SUFFIX, E_CARD_SIMPLE_FIELD_NAME_SUFFIX, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_WANTS_HTML, E_CARD_SIMPLE_FIELD_WANTS_HTML, ""},
-	{E_CARD_SIMPLE_FIELD_CSV_IS_LIST, E_CARD_SIMPLE_FIELD_IS_LIST, ""},
+	 E_CARD_SIMPLE_FIELD_ADDITIONAL_NAME, "Additional Name"},
+	{E_CARD_SIMPLE_FIELD_CSV_NAME_SUFFIX, E_CARD_SIMPLE_FIELD_NAME_SUFFIX, "Name Suffix"},
+	{E_CARD_SIMPLE_FIELD_CSV_WANTS_HTML, E_CARD_SIMPLE_FIELD_WANTS_HTML, "Wants HTML"},
+	{E_CARD_SIMPLE_FIELD_CSV_IS_LIST, E_CARD_SIMPLE_FIELD_IS_LIST, "Is List"},
 	{E_CARD_SIMPLE_FIELD_CSV_LAST, NOMAP, ""}
 
 };
@@ -290,17 +290,8 @@
 	gchar *esc_name;
 	gchar *quoted_name;
 
-	ECardSimple *a_simple_card;
+	name = g_strdup (csv_field_data[csv_field].csv_name);
 
-	simple_field = e_card_simple_csv_get_simple_field (csv_field);
-
-	if (simple_field != NOMAP) {
-		a_simple_card = E_CARD_SIMPLE (g_object_new (E_TYPE_CARD_SIMPLE, NULL));
-		name = g_strdup (e_card_simple_get_name (a_simple_card, simple_field));
-		g_object_unref (G_OBJECT (a_simple_card));
-	} else {
-		name = g_strdup (csv_field_data[csv_field].csv_name);
-	}
 	esc_name = g_strescape (name, NULL);
 	g_free (name);
 	quoted_name = quote_string (esc_name);


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