Synchronization with Ericsson T68i

For discussing the Mozilla Calendar, Sunbird and Lightning projects.

User avatar
Posts: 1
Joined: May 30th, 2004, 9:27 am

Post Posted May 30th, 2004, 10:48 am

I made a "something-lika-a-patch" for Sunbird in order to be able to somehow sync your calendar in Sunbird with the calendar in the Ericsson T68i. This also works in the Calendar plugin for Thunderbird, Firefox, etc. This is not a real synchronization it is just a modification which will enable you to export the events in a format understandable by your mobile phone.

The original vCal save-as-type option in Sunbird, is not a vCal understandable by the mobile phone and wont work. First, it seems that it is not vCal at all, but iCal, and second - the Ericsson T68i uses UTF-7 format - so other-than ANSI letters wont work at all. I'm posting this, and not doing it via CVS because it is way too complicated for anyone wanting just a small hack and I don't know how to do it with CVS, nor do I have the tools. The code mentioned in this post is partly copy-pasted from the original Mozilla Calendar (so the Mozilla licences apply) and partly made out of my head (and for that parts I guess also the Mozilla license applies - I don't care).

If anyone is interested, then the modification procedure is the following.

1. Open the file: content/calendar/importExport.js inside the chrome/Calendar.jar (for this you will probably have to unzip the Calendar.jar)

2. Edit the file in the following way:

2a. Inside the function saveEventsToFile( calendarEventArray ) find the line:
fp.appendFilter( filtervCalendar, "*" + extensionvCalendar );
and after that insert:
fp.appendFilter( "Ericsson T68i vCal", "*" + extensionvCalendar );
2b. Next, find the lines
case 6 : // vcs
aDataStream = eventArrayToICalString( calendarEventArray, true );
extension = extensionvCalendar;
charset = "UTF-8";
and after them insert
case 7 : // vcs-mobile
aDataStream = eventArrayToVCalString( calendarEventArray, true );
extension = extensionvCalendar;
charset = "UTF-7";
2c. Next, find the line:
/**** patchICalStringForExport
and then, just before that line insert a new line and paste the whole following function:
/**** eventArrayToVCalString MADE AS A MODIFICATION OF THE ORIGINAL eventArrayToICalString
* Converts a array of events to iCalendar text
* Option to add events needed in other applications

function eventArrayToVCalString( calendarEventArray, doPatchForExport )
var checkDate = function ( dt, isDate )
var dateObj = new Date( dt.getTime() );
var result = "";

if( isDate ) {
result += dateObj.getFullYear();
if( dateObj.getMonth() + 1 < 10 ) result += "0";
result += dateObj.getMonth() + 1;
if( dateObj.getDate() < 10 ) result += "0";
result += dateObj.getDate();
else {
result += dateObj.getUTCFullYear();

if( dateObj.getUTCMonth() + 1 < 10 ) result += "0";
result += dateObj.getUTCMonth() + 1;

if( dateObj.getUTCDate() < 10 ) result += "0";
result += dateObj.getUTCDate();
result += "T"

if( dateObj.getUTCHours() < 10 ) result += "0";
result += dateObj.getUTCHours();

if( dateObj.getUTCMinutes() < 10 ) result += "0";
result += dateObj.getUTCMinutes();

if( dateObj.getUTCSeconds() < 10 ) result += "0";
result += dateObj.getUTCSeconds();
result += "Z";
return result;

if( !calendarEventArray) calendarEventArray = gCalendarWindow.EventSelection.selectedEvents;

var sTextiCalendar = "";
for( var eventArrayIndex = 0; eventArrayIndex < calendarEventArray.length; ++eventArrayIndex )
try {
var calendarEvent = calendarEventArray[ eventArrayIndex ].clone();
} catch( e ){
alert( "Caught an exception in eventArrayToICalString, while trying to clone the event, it was: \n"+e );

if (calendarEvent.alarmUnits=="hours") multi=3600*1000;
else if (calendarEvent.alarmUnits=="minutes") multi=60*1000;
else if (calendarEvent.alarmUnits=="days") multi=24*3600*1000;

var aco=new Date(calendarEvent.start.getTime());

if ( doPatchForExport )
sTextiCalendar += patchICalStringForExport(
sTextiCalendar +=

sTextiCalendar= "BEGIN:VCALENDAR"+"\n"+ sTextiCalendar + "END:VCALENDAR"+"\n"

return sTextiCalendar;
4. Save the importExport.js file, back inside the calendar.jar in the proper folder.

5. Restart Sunbird


So from now on, you will be able to do the following:

1. In the event list select the events you want to export

2. Select Export selected events from the Tools menu

3. Choose type "Ericsson T68 vCal" and save the file in some filename.

4. Delete all events in the mobile phone (since it will not find out duplicates)

5. Right click the saved file and choose send via infrared or bluetooth (depending what you have)

6. Accept the sent events on your mobile phone.

That's it, if you forget number 4., and had an import previously all already existing events will be duplicated, because this is not synchronization procedure.

Posts: 2
Joined: April 28th, 2004, 4:18 am

Post Posted December 16th, 2004, 2:58 pm

Found this just now.

This is the feature I'm waiting for to let me leave Outlook. Too bad this solution isn't very smooth.


Return to Calendar

Who is online

Users browsing this forum: No registered users and 2 guests