Home | History | Annotate | Download | only in patches
      1 --- calendar/conduits/memo/memo-conduit.c.orig	2006-12-26 15:28:58.470373000 +0800
      2 +++ calendar/conduits/memo/memo-conduit.c	2006-12-26 15:40:47.593816000 +0800
      3 @@ -580,7 +580,9 @@
      4  	const char *uid;
      5  	GSList *d_list = NULL;
      6  	ECalComponentText *description;
      7 +	ECalComponentText summary;
      8  	ECalComponentClassification classif;
      9 +	char *textstr = NULL;
     10  	
     11  	LOG (g_message ( "local_record_from_comp\n" ));
     12  
     13 @@ -690,20 +692,31 @@
     14  
     15  	/* STOP: don't replace these with g_strdup, since free_Memo
     16  	   uses free to deallocate */
     17 +        e_cal_component_get_summary (comp, &summary);
     18 +        if (summary.value)
     19 +                textstr = g_strdup (summary.value);
     20  
     21  	e_cal_component_get_description_list (comp, &d_list);
     22  	if (d_list) {
     23  		description = (ECalComponentText *) d_list->data;
     24  		if (description && description->value){
     25 -			local->memo->text = e_pilot_utf8_to_pchar (description->value, pilot_charset);
     26 +			if (textstr) {
     27 +				char *tmp = textstr;
     28 +				textstr = g_strconcat (textstr, "\n", description->value, NULL);
     29 +				g_free (tmp);
     30 +			} else
     31 +				textstr = g_strdup (description->value);
     32  		}
     33 -		else{
     34 -			local->memo->text = NULL;
     35 -		}
     36 -	} else {
     37 -		local->memo->text = NULL;
     38 +		e_cal_component_free_text_list (d_list);
     39  	}
     40 -	
     41 +
     42 +	if (textstr)
     43 +		local->memo->text = e_pilot_utf8_to_pchar (textstr, pilot_charset);
     44 +	else
     45 +		local->memo->text = NULL;
     46 +
     47 +	g_free (textstr);
     48 +
     49  	e_cal_component_get_classification (comp, &classif);
     50  
     51  	if (classif == E_CAL_COMPONENT_CLASS_PRIVATE)
     52 @@ -807,36 +820,25 @@
     53  		e_cal_component_set_summary(comp, NULL);
     54  	} else {
     55  		int idxToUse = -1, ntext = strlen(memo.text);
     56 -		gboolean foundNL = FALSE;
     57 +		gchar * NLchar = NULL;
     58  		GSList l;
     59  		ECalComponentText text, sumText;
     60  
     61 -		for(i = 0; i<ntext && i<50; i++){
     62 -			if(memo.text[i] == '\n'){
     63 -				idxToUse = i;
     64 -				foundNL = TRUE;
     65 -				break;
     66 -			}
     67 -		}
     68 -		
     69 -		if(foundNL == FALSE){
     70 -			if(ntext > 50){
     71 -				txt2 = g_strndup(memo.text, 50);
     72 -			}
     73 -			else{
     74 -				txt2 = g_strdup(memo.text);
     75 -				
     76 -			}
     77 -		}
     78 -		else{
     79 -			txt2 = g_strndup(memo.text, idxToUse); /* cuts off '\n' */
     80 -			
     81 +		NLchar = strchr(memo.text, '\n');
     82 +		if (NLchar) {
     83 +			txt2 = g_strndup(memo.text, NLchar - memo.text);
     84 +			txt = g_strdup (NLchar + 1);
     85 +		} else {
     86 +			txt2 = g_strdup(memo.text);
     87 +			txt = NULL;
     88  		}
     89  
     90  		sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2, pilot_charset);
     91  		sumText.altrep = NULL;
     92 -
     93 -		text.value = txt = e_pilot_utf8_from_pchar (memo.text, pilot_charset);
     94 +		if (txt)	
     95 +			text.value = e_pilot_utf8_from_pchar (txt, pilot_charset);
     96 +		else 
     97 +			text.value = NULL;
     98  		text.altrep = NULL;
     99  		l.data = &text;
    100  		l.next = NULL;
    101