ZoneO-tips for Mandriva Linux

Synchronize Google Calendar and Kontact

How to synchronize your calendar on kontact in kde (korganizer) with your Google Calendar?

 
 
Start the Konsole
Figure 1: Start the Konsole

Thanks to Google Calendar, you can have access to your calendar at any time, from any machine, and from any OS. Some mobile phones even support this function. Quite handy isn't it?

Now, under KDE, you might feel more comfortable using Kontact since you can centralize various email accounts, address books, and calendars. So, here is the big one: how do you synchronize your calendar on kontact with your Google Calendar?

Actually, it's possible! You have to install GCALDaemon. GCALDaemon is a java application that can be used to synchronize the google calendar with plenty of other applications, and it does work with Kontact. It can even do more, such as synchronize address books, RSS readers, and so on, but I'll focus on the calendar part.

To start with, create your account at Google Calendar and make sure it works.

Download the latest version of GCALDaemon at SourceForge, open a terminal (Figure 1), and log-in as administrator (root). Move into the /usr/local/sbin folder and decompress the archive you downloaded

cd /usr/local/sbin
unzip PATH_TO/NAME_OF_ARCHIVE.zip

Encode your google password
Figure 2: Encode your google password

Here comes a small problem: you need to be able to run the application as a user. Usually, all users are members of the users group. If not, replace users by the name of your group in the lines below. They will allow you to run the program as a user:

 
chgrp -R users /usr/local/sbin/GCALDaemon
chmod -R g+w /usr/local/sbin/GCALDaemon
chmod 755 /usr/local/sbin/GCALDaemon/bin/*.sh
We are done with configuration in administrator mode.

Open up a new terminal and test your permissions

cd /usr/local/sbin/GCALDaemon/bin
./password-encoder.sh
Copy the address of your private calendar in Google
Figure 3: Copy the address of your private calendar in Google
If you get an error message, there is a problem with your permissions. Otherwise, enter your google password and copy the encoded result (Figure 2). Then, copy the private URL of your calendar from the setting interface in google (Figure 3). We are now going to edit the configuration for GCALDaemon.
 

To do so, go into GCALDaemon configuration folder and open the corresponding file:

cd /usr/local/sbin/GCALDaemon/conf/
kwrite gcal-daemon.cfg &
In this file, change the following lines
http.enabled=false
since we do not need this function. Moreover, it would have some form of a web server server running: this adds security threat. Also, change the lines corresponding to the calendar:
# Enable iCalendar file listener/synchronizer
file.enabled=true

# Full path of the local iCalendar file
file.ical.path=/usr/local/sbin/GCALDaemon/google.ics

# Gmail user (your full email address)
file.google.username=YOUR ADDRESS

# Gmail password (use password encoder!)
file.google.password=WHAT YOU COPIED ABOVE

# URL (without hostname) of the Google Calendar's private ical file
file.private.ical.url=/calendar/ical/XXXXXX/basic.ics (THE ADDRESS YOU COPIED ABOVE? WITHOUT THE HOSTNAME)

# Local iCalendar file polling interval (recommended is "10 sec")
file.polling.file=10 sec

# Google Calendar polling interval (recommended is "10 min")
file.polling.google=15 min

# Turn it on when you use dial-up connection (default is "true")
file.offline.enabled=true
That's it! The file /usr/local/sbin/GCALDaemon/google.ics will be synchronised with your calendar at Google.

To start the synchronisation, run the following command:

/usr/local/sbin/GCALDaemon/bin/standalone-start.sh &

Add an agenda in kontact
Figure 4: Add an agenda in kontact

You now should add a new agenda in kontact. Move your mouse to the list of agendas in koncat (Figure 4) and, using the right-click menu, select Add. Choose the location of the file that is synchronized with google (/usr/local/sbin/GCALDaemon/google.ics if you followed the instructions above), and give it a name.

All changes saved from kontact will be uploaded to your google account. Similarly, all changes on your google account will be transmitted to kontact, every 15 minutes or so. Do not forget to SAVE your agenda in kontact! Nothing will happen otherwise.

Finally, you probably want the sync to start every time you log into KDE. To do so, you should use the Autostart function. As a user, do the following

cd ~/.kde/Autostart/
kwrite googleCal.sh
Enter
#!/bin/bash
/usr/local/sbin/GCALDaemon/bin/standalone-start.sh &
exit
and save googleCal.sh. Close kwrite and make the new file executable
chmod a+x googleCal.sh
That's it, your sync will be started every time you log into KDE.

All right, it was a bit long, but I believe it was worth it!

 
 

Useful links

04/2009
 
© ZoneO-soft - Contact us - Start page