Home | History | Annotate | Download | only in patches
      1 --- evolution-2.11.92/e-util/e-pilot-util.h.orig	2007-09-04 14:38:08.510039000 +0800
      2 +++ evolution-2.11.92/e-util/e-pilot-util.h	2007-09-04 12:53:17.507014000 +0800
      3 @@ -26,8 +26,8 @@
      4  #ifndef E_PILOT_UTIL_H
      5  #define E_PILOT_UTIL_H
      6  
      7 -char *e_pilot_utf8_to_pchar (const char *string);
      8 -char *e_pilot_utf8_from_pchar (const char *string);
      9 +char *e_pilot_utf8_to_pchar   (const char *string, const char *pilot_charset);
     10 +char *e_pilot_utf8_from_pchar (const char *string, const char *pilot_charset);
     11  
     12  ESource *e_pilot_get_sync_source (ESourceList *source_list);
     13  void e_pilot_set_sync_source (ESourceList *source_list, ESource *source);
     14 --- evolution-2.11.92/e-util/e-pilot-util.c.orig	2007-09-04 14:38:21.974457000 +0800
     15 +++ evolution-2.11.92/e-util/e-pilot-util.c	2007-09-04 12:53:17.507609000 +0800
     16 @@ -29,16 +29,19 @@
     17  #include "e-pilot-util.h"
     18  
     19  char *
     20 -e_pilot_utf8_to_pchar (const char *string)
     21 +e_pilot_utf8_to_pchar (const char *string, const char *pilot_charset)
     22  {
     23  	char *pstring = NULL;
     24  	int res;
     25  
     26  	if (!string)
     27  		return NULL;
     28 -
     29 -	res = convert_ToPilotChar ("UTF-8", string, strlen (string), &pstring);
     30  
     31 +#ifdef PILOT_LINK_0_12
     32 +	res = convert_ToPilotChar_WithCharset ("UTF-8", string, strlen (string), &pstring, pilot_charset);
     33 +#else
     34 +	res = convert_ToPilotChar ("UTF-8", string, strlen (string), &pstring);
     35 +#endif
     36  	if (res != 0)
     37  		pstring = strdup (string);
     38  
     39 @@ -46,16 +49,20 @@
     40  }
     41  
     42  char *
     43 -e_pilot_utf8_from_pchar (const char *string)
     44 +e_pilot_utf8_from_pchar (const char *string, const char *pilot_charset)
     45  {
     46  	char *ustring = NULL;
     47  	int res;
     48  
     49  	if (!string)
     50  		return NULL;
     51 
     52 +#ifdef	PILOT_LINK_0_12
     53 +	res = convert_FromPilotChar_WithCharset ("UTF-8", string, strlen (string), &ustring, pilot_charset);
     54 +#else
     55  	res = convert_FromPilotChar ("UTF-8", string, strlen (string), &ustring);
     56 -
     57 +#endif
     58 +
     59  	if (res != 0)
     60  		ustring = strdup (string);
     61 
     62 --- evolution-2.11.92/calendar/conduits/todo/todo-conduit.c.orig	2007-09-04 14:39:59.848275000 +0800
     63 +++ evolution-2.11.92/calendar/conduits/todo/todo-conduit.c	2007-09-04 14:29:18.650419000 +0800
     64 @@ -66,6 +66,8 @@
     65  #define WARN g_warning
     66  #define INFO g_message
     67  
     68 +gchar *pilot_charset = NULL;
     69 +
     70  typedef struct _EToDoLocalRecord EToDoLocalRecord;
     71  typedef struct _EToDoConduitCfg EToDoConduitCfg;
     72  typedef struct _EToDoConduitGui EToDoConduitGui;
     73 @@ -708,19 +710,19 @@
     74  	}
     75 
     76  	/*Category support*/
     77 -	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
     78 +	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category), pilot_charset);
     79  
     80  	/* STOP: don't replace these with g_strdup, since free_ToDo
     81  	   uses free to deallocate */
     82  	e_cal_component_get_summary (comp, &summary);
     83  	if (summary.value)
     84 -		local->todo->description = e_pilot_utf8_to_pchar (summary.value);
     85 +		local->todo->description = e_pilot_utf8_to_pchar (summary.value, pilot_charset);
     86  
     87  	e_cal_component_get_description_list (comp, &d_list);
     88  	if (d_list) {
     89  		description = (ECalComponentText *) d_list->data;
     90  		if (description && description->value)
     91 -			local->todo->note = e_pilot_utf8_to_pchar (description->value);
     92 +			local->todo->note = e_pilot_utf8_to_pchar (description->value, pilot_charset);
     93  		else
     94  			local->todo->note = NULL;
     95  	} else {
     96 @@ -862,12 +864,12 @@
     97  
     98  	e_cal_component_set_last_modified (comp, &now);
     99  
    100 -	summary.value = txt = e_pilot_utf8_from_pchar (todo.description);
    101 +	summary.value = txt = e_pilot_utf8_from_pchar (todo.description, pilot_charset);
    102  	e_cal_component_set_summary (comp, &summary);
    103  	free (txt);
    104  
    105  	/*Category support*/
    106 -	e_pilot_remote_category_to_local(remote->category, comp, &(ai->category));
    107 +	e_pilot_remote_category_to_local(remote->category, comp, &(ai->category), pilot_charset);
    108  
    109  	/* The iCal description field */
    110  	if (!todo.note) {
    111 @@ -876,7 +878,7 @@
    112  		GSList l;
    113  		ECalComponentText text;
    114  
    115 -		text.value = txt = e_pilot_utf8_from_pchar (todo.note);
    116 +		text.value = txt = e_pilot_utf8_from_pchar (todo.note, pilot_charset);
    117  		text.altrep = NULL;
    118  		l.data = &text;
    119  		l.next = NULL;
    120 @@ -1002,6 +1004,13 @@
    121 	ctxt->dbi = dbi;
    122 	ctxt->client = NULL;
    123  
    124 +#ifdef PILOT_LINK_0_12
    125 +	if(NULL == dbi->pilotInfo->pilot_charset)
    126 +		pilot_charset = NULL;
    127 +	else
    128 +		pilot_charset = g_strdup(dbi->pilotInfo->pilot_charset);
    129 +#endif
    130 +
    131  	/* Get the timezone */
    132  	ctxt->timezone = get_default_timezone ();
    133  	if (ctxt->timezone == NULL)
    134 @@ -1163,7 +1172,8 @@
    135  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    136  		e_cal_free_change_list (changed);
    137  	g_free (change_id);
    138 -
    139 +	if (pilot_charset)
    140 +		g_free (pilot_charset);	
    141  	LOG (g_message ( "---------------------------------------------------------\n" ));
    142  
    143  	return 0;
    144 --- evolution-2.11.92/calendar/conduits/calendar/calendar-conduit.c.orig	2007-09-04 14:39:32.303878000 +0800
    145 +++ evolution-2.11.92/calendar/conduits/calendar/calendar-conduit.c	2007-09-04 14:27:32.615346000 +0800
    146 @@ -61,6 +61,8 @@
    147  #define WARN g_warning
    148  #define INFO g_message
    149  
    150 +gchar *pilot_charset = NULL;
    151 +
    152  #define PILOT_MAX_ADVANCE 99
    153  
    154  typedef struct _ECalLocalRecord ECalLocalRecord;
    155 @@ -941,19 +943,19 @@
    156  	}
    157  
    158  	/*Category support*/
    159 -	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
    160 +	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category), pilot_charset);
    161  
    162  	/* STOP: don't replace these with g_strdup, since free_Appointment
    163  	   uses free to deallocate */
    164  	e_cal_component_get_summary (comp, &summary);
    165  	if (summary.value)
    166 -		local->appt->description = e_pilot_utf8_to_pchar (summary.value);
    167 +		local->appt->description = e_pilot_utf8_to_pchar (summary.value, pilot_charset);
    168  
    169  	e_cal_component_get_description_list (comp, &d_list);
    170  	if (d_list) {
    171  		description = (ECalComponentText *) d_list->data;
    172  		if (description && description->value)
    173 -			local->appt->note = e_pilot_utf8_to_pchar (description->value);
    174 +			local->appt->note = e_pilot_utf8_to_pchar (description->value, pilot_charset);
    175  		else
    176  			local->appt->note = NULL;
    177  	} else {
    178 @@ -1231,12 +1233,12 @@
    179  
    180  	e_cal_component_set_last_modified (comp, &now);
    181  
    182 -	summary.value = txt = e_pilot_utf8_from_pchar (appt.description);
    183 +	summary.value = txt = e_pilot_utf8_from_pchar (appt.description, pilot_charset);
    184  	e_cal_component_set_summary (comp, &summary);
    185  	free (txt);
    186  
    187  	/*Category support*/
    188 -	e_pilot_remote_category_to_local(remote->category, comp, category);
    189 +	e_pilot_remote_category_to_local(remote->category, comp, category, pilot_charset);
    190  
    191  	/* The iCal description field */
    192  	if (!appt.note) {
    193 @@ -1245,7 +1247,7 @@
    194  		GSList l;
    195  		ECalComponentText text;
    196  
    197 -		text.value = txt = e_pilot_utf8_from_pchar (appt.note);
    198 +		text.value = txt = e_pilot_utf8_from_pchar (appt.note, pilot_charset);
    199  		text.altrep = NULL;
    200  		l.data = &text;
    201  		l.next = NULL;
    202 @@ -1500,6 +1502,12 @@
    203 	LOG (g_message ( "pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
    204  
    205 	ctxt->dbi = dbi;
    206 +#ifdef PILOT_LINK_0_12
    207 +	if(NULL == dbi->pilotInfo->pilot_charset)
    208 +		pilot_charset = NULL;
    209 +	else
    210 +		 pilot_charset = g_strdup(dbi->pilotInfo->pilot_charset);
    211 +#endif
    212 	ctxt->client = NULL;
    213  
    214  	/* Get the timezone */
    215 @@ -1685,6 +1693,8 @@
    216  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    217  		e_cal_free_change_list (changed);
    218  	g_free (change_id);
    219 +	if (pilot_charset)
    220 +		g_free (pilot_charset);
    221  
    222  	LOG (g_message ( "---------------------------------------------------------\n" ));
    223  
    224 --- evolution-2.11.92/calendar/conduits/common/libecalendar-common-conduit.h.orig	2007-09-04 14:40:55.393610000 +0800
    225 +++ evolution-2.11.92/calendar/conduits/common/libecalendar-common-conduit.h	2007-09-04 14:33:46.502635000 +0800
    226 @@ -6,6 +6,6 @@
    227  
    228  
    229  int e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *category);
    230 -void e_pilot_local_category_to_remote(int * pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category);
    231 -void e_pilot_remote_category_to_local(int   pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category);
    232 +void e_pilot_local_category_to_remote(int * pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category, char *pilot_charset);
    233 +void e_pilot_remote_category_to_local(int   pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category, char *pilot_charset);
    234  
    235 --- evolution-2.11.92/calendar/conduits/common/libecalendar-common-conduit.c.orig	2007-09-04 14:41:06.009463000 +0800
    236 +++ evolution-2.11.92/calendar/conduits/common/libecalendar-common-conduit.c	2007-09-04 14:33:15.741973000 +0800
    237 @@ -122,7 +122,7 @@
    238  /*
    239   *conversion from an evolution category to a palm category
    240   */
    241 -void e_pilot_local_category_to_remote(int * pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category)
    242 +void e_pilot_local_category_to_remote(int * pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category, char *pilot_charset)
    243  {
    244  	GSList *c_list = NULL;
    245  	char * category_string;
    246 @@ -130,7 +130,7 @@
    247  	e_cal_component_get_categories_list (comp, &c_list);
    248  	if (c_list) {
    249  		//list != 0, so at least 1 category is assigned
    250 -		category_string = e_pilot_utf8_to_pchar((const char *)c_list->data);
    251 +		category_string = e_pilot_utf8_to_pchar((const char *)c_list->data, pilot_charset);
    252  		if (c_list->next != 0) {
    253  			LOG (g_message ("Note: item has more categories in evolution, first chosen"));
    254  		}
    255 @@ -158,13 +158,13 @@
    256  /*
    257   *conversion from a palm category to an evolution category
    258   */
    259 -void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category)
    260 +void e_pilot_remote_category_to_local(int pilotCategory, ECalComponent *comp, struct CategoryAppInfo *category, char *pilot_charset)
    261  {
    262  	char *category_string = NULL;
    263  
    264  	if (pilotCategory != 0) {
    265  		/* pda has category assigned */
    266 -		category_string = e_pilot_utf8_from_pchar(category->name[pilotCategory]);
    267 +		category_string = e_pilot_utf8_from_pchar(category->name[pilotCategory], pilot_charset);
    268  
    269  		LOG(g_message("Category: %s\n", category_string));
    270  
    271 --- evolution-2.11.92/addressbook/conduit/address-conduit.c.orig	2007-09-04 14:38:53.567327000 +0800
    272 +++ evolution-2.11.92/addressbook/conduit/address-conduit.c	2007-09-04 12:53:17.508639000 +0800
    273 @@ -63,6 +63,8 @@
    274  #define WARN g_warning
    275  #define INFO g_message
    276  
    277 +gchar *pilot_charset = NULL;
    278 +
    279  enum {
    280  	LABEL_WORK,
    281  	LABEL_HOME,
    282 @@ -748,7 +750,7 @@
    283  	char *text = NULL;
    284  
    285  	if (address.entry[entry])
    286 -		text = e_pilot_utf8_from_pchar (address.entry[entry]);
    287 +		text = e_pilot_utf8_from_pchar (address.entry[entry], pilot_charset);
    288 
    289  	e_contact_set (contact, field, text);
    290  
    291 @@ -759,7 +761,7 @@
    292  get_entry_text (struct Address address, int entry)
    293  {
    294  	if (address.entry[entry])
    295 -		return e_pilot_utf8_from_pchar (address.entry[entry]);
    296 +		return e_pilot_utf8_from_pchar (address.entry[entry], pilot_charset);
    297  
    298  	return NULL;
    299  }
    300 @@ -915,10 +917,10 @@
    301  #endif
    302  	}
    303  
    304 -	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));
    305 -	local->addr->entry[entryLastname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_FAMILY_NAME));
    306 -	local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_ORG));
    307 -	local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_TITLE));
    308 +	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME), pilot_charset);
    309 +	local->addr->entry[entryLastname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_FAMILY_NAME), pilot_charset);
    310 +	local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_ORG), pilot_charset);
    311 +	local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_TITLE), pilot_charset);
    312  
    313  	/* See if the default has something in it */
    314  	if ((address = e_contact_get (contact, ctxt->cfg->default_address))) {
    315 @@ -944,13 +946,13 @@
    316  			add = g_strdup (address->street);
    317  			LOG (g_warning ("Address has only one line: [%s]\n", add));
    318  		}
    319 -		local->addr->entry[entryAddress] = e_pilot_utf8_to_pchar (add);
    320 +		local->addr->entry[entryAddress] = e_pilot_utf8_to_pchar (add, pilot_charset);
    321  		g_free (add);
    322  
    323 -		local->addr->entry[entryCity] = e_pilot_utf8_to_pchar (address->locality);
    324 -		local->addr->entry[entryState] = e_pilot_utf8_to_pchar (address->region);
    325 -		local->addr->entry[entryZip] = e_pilot_utf8_to_pchar (address->code);
    326 -		local->addr->entry[entryCountry] = e_pilot_utf8_to_pchar (address->country);
    327 +		local->addr->entry[entryCity] = e_pilot_utf8_to_pchar (address->locality, pilot_charset);
    328 +		local->addr->entry[entryState] = e_pilot_utf8_to_pchar (address->region, pilot_charset);
    329 +		local->addr->entry[entryZip] = e_pilot_utf8_to_pchar (address->code, pilot_charset);
    330 +		local->addr->entry[entryCountry] = e_pilot_utf8_to_pchar (address->country, pilot_charset);
    331  
    332  		e_contact_address_free (address);
    333  	}
    334 @@ -971,7 +973,7 @@
    335  			phone_str = e_contact_get_const (contact, priority[i]);
    336  			if (phone_str && *phone_str) {
    337  				clear_entry_text (*local->addr, phone);
    338 -				local->addr->entry[phone] = e_pilot_utf8_to_pchar (phone_str);
    339 +				local->addr->entry[phone] = e_pilot_utf8_to_pchar (phone_str, pilot_charset);
    340  				local->addr->phoneLabel[phone - entryPhone1] = priority_label[i];
    341  				phone++;
    342  			}
    343 @@ -1020,13 +1022,13 @@
    344  
    345  			if (phone_str && *phone_str) {
    346  				clear_entry_text (*local->addr, i);
    347 -				local->addr->entry[i] = e_pilot_utf8_to_pchar (phone_str);
    348 +				local->addr->entry[i] = e_pilot_utf8_to_pchar (phone_str, pilot_charset);
    349  			}
    350  		}
    351  	}
    352 
    353  	/* Note */
    354 -	local->addr->entry[entryNote] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_NOTE));
    355 +	local->addr->entry[entryNote] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_NOTE), pilot_charset);
    356  }
    357  
    358  static void
    359 @@ -1299,6 +1301,13 @@
    360  	/* g_message ("Addressbook Conduit v.%s", CONDUIT_VERSION); */
    361  
    362  	ctxt->dbi = dbi;
    363 +
    364 +#ifdef PILOT_LINK_0_12
    365 +	if(NULL == dbi->pilotInfo->pilot_charset)
    366 +		pilot_charset = NULL;
    367 +	else
    368 +		pilot_charset = g_strdup(dbi->pilotInfo->pilot_charset);
    369 +#endif
    370  
    371  	if (ctxt->cfg->source) {
    372  		ctxt->ebook = e_book_new (ctxt->cfg->source, NULL);
    373 @@ -1436,7 +1445,8 @@
    374  	if (e_book_get_changes (ctxt->ebook, change_id, &changed, NULL))
    375  		e_book_free_change_list (changed);
    376  	g_free (change_id);
    377 -
    378 +	if (pilot_charset)
    379 +		g_free (pilot_charset);
    380  	LOG (g_message ( "---------------------------------------------------------\n" ));
    381  
    382  	return 0;
    383 --- evolution-2.11.92/calendar/conduits/memo/memo-conduit.c.orig	2007-09-04 16:30:46.586050000 +0800
    384 +++ evolution-2.11.92/calendar/conduits/memo/memo-conduit.c	2007-09-04 16:33:09.458512000 +0800
    385 @@ -64,6 +64,8 @@
    386  #define WARN g_warning
    387  #define INFO g_message
    388  
    389 +gchar *pilot_charset = NULL;
    390 +
    391  typedef struct _EMemoLocalRecord EMemoLocalRecord;
    392  typedef struct _EMemoConduitCfg EMemoConduitCfg;
    393  typedef struct _EMemoConduitGui EMemoConduitGui;
    394 @@ -576,7 +578,7 @@
    395  	}
    396  
    397  	/*Category support*/
    398 -	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category));
    399 +	e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category), pilot_charset);
    400  
    401  	/* STOP: don't replace these with g_strdup, since free_Memo
    402  	   uses free to deallocate */
    403 @@ -585,7 +587,7 @@
    404  	if (d_list) {
    405  		description = (ECalComponentText *) d_list->data;
    406  		if (description && description->value){
    407 -			local->memo->text = e_pilot_utf8_to_pchar (description->value);
    408 +			local->memo->text = e_pilot_utf8_to_pchar (description->value, pilot_charset);
    409  		}
    410  		else{
    411  			local->memo->text = NULL;
    412 @@ -691,7 +693,7 @@
    413  	e_cal_component_set_last_modified (comp, &now);
    414  
    415  	/*Category support*/
    416 -	e_pilot_remote_category_to_local(remote->category, comp, &(ai->category));
    417 +	e_pilot_remote_category_to_local(remote->category, comp, &(ai->category),pilot_charset);
    418  
    419  	/* The iCal description field */
    420  	if (!memo.text) {
    421 @@ -725,10 +727,10 @@
    422  
    423  		}
    424  
    425 -		sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2);
    426 +		sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2, pilot_charset);
    427  		sumText.altrep = NULL;
    428  
    429 -		text.value = txt = e_pilot_utf8_from_pchar (memo.text);
    430 +		text.value = txt = e_pilot_utf8_from_pchar (memo.text, pilot_charset);
    431  		text.altrep = NULL;
    432  		l.data = &text;
    433  		l.next = NULL;
    434 @@ -809,6 +811,13 @@
    435  	ctxt->dbi = dbi;
    436  	ctxt->client = NULL;
    437  
    438 +#ifdef PILOT_LINK_0_12
    439 +	if(NULL == dbi->pilotInfo->pilot_charset)
    440 +		pilot_charset = NULL;
    441 +	else
    442 +		pilot_charset = g_strdup(dbi->pilotInfo->pilot_charset);
    443 +#endif
    444 +
    445  	if (start_calendar_server (ctxt) != 0) {
    446  		WARN(_("Could not start evolution-data-server"));
    447  		gnome_pilot_conduit_error (conduit, _("Could not start evolution-data-server"));
    448 @@ -976,7 +985,8 @@
    449  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    450  		e_cal_free_change_list (changed);
    451  	g_free (change_id);
    452 -
    453 +	if (pilot_charset)
    454 +		g_free (pilot_charset);
    455  	LOG (g_message ( "---------------------------------------------------------\n" ));
    456  
    457  	return 0;
    458 --- evolution-2.11.92/calendar/conduits/todo/todo-conduit.c.orig	2007-09-04 16:53:12.036377000 +0800
    459 +++ evolution-2.11.92/calendar/conduits/todo/todo-conduit.c	2007-09-04 16:53:32.082613000 +0800
    460 @@ -433,9 +433,9 @@
    461  		    todo.priority,
    462  		    todo.complete,
    463  		    todo.description ?
    464 -		    e_pilot_utf8_from_pchar(todo.description) : "",
    465 +		    e_pilot_utf8_from_pchar(todo.description, pilot_charset) : "",
    466  		    todo.note ?
    467 -		    e_pilot_utf8_from_pchar(todo.note) : "",
    468 +		    e_pilot_utf8_from_pchar(todo.note, pilot_charset) : "",
    469  		    remote->category);
    470  
    471  	free_ToDo (&todo);
    472