Howto: Two Way Sync Between Kontact and GCal

Ever wondered how to sync up your Kontact Calendar with your Google Calendar? Me too! But I figured it out. Below you can find step by step instructions on how to set it up.

First, you need GCALDaemon. Yes, I know it’s Java but it’s not as bad. I’ve been running it in the background for few days now and I don’t really see any performance hit. So stop whining. Just download the linux bundle and unpack it into /opt. You can follow the default installation route, and put it in /usr/local/sbin but to me /opt is where it belongs. That’s where I have Firefox and Komodo Edit and all the other apps that like to have their own personal directory. Once you do that, follow the official instructions on how to edit the following files:

/opt/GCALDaemon/bin/password-encoder.sh
/opt/GCALDaemon/bin/standalone-start.sh
 /opt/GCALDaemon/bin/sync-now.sh

You will need to update all the paths and change them to the new /opt location.

Make sure you give yourself write permissions to /opt/GCALDaemon/log/ because the daemon it will desperately and obsessively want to write there. If you run it as a user without write permission to that folder you will see a nice stack of Java exceptions popping out. For some unexplainable reason, there is no way to configure this. Retarded, I know but what are you going to do… Fortunately there is a way to put “working” files, such as the local ical file in your home directory. Open the /opt/GCALDaemon/conf/gcal-daemon.cfg and add the following line somewhere close to the top:

work.dir=/home/yourusername/.GCALDaemon/

Make sure you use your change the path to your home directory there. Now just create .GCALDaemon in ~ and you are ready to do the next step.

Follow the file-based setup instructions on the GCALDaemon page. Make sure you pay close attention to step 4D. When you are pasting in your gcal address make sure that:

  1. You are pasting in the Private URL (not the public one)
  2. You delete http://www.google.com from the URL. The address in the config file should be starting with /calendar

I got both of these things wrong on the first try because I didn’t read the instructions carefully. Also, make sure you change the file.ical.path property to something like:

file.ical.path=/home/yourusername/google.ics

Steps 6 and upward are Rainlendar specific (Rainlendar is some shitty desktop widget calendar for windows btw) so you can safely ignore them. Once you start the daemon, it should put the google.ics file into ~/.GCALDaemon.

Now open Kontact, and pull up Calendar. On the left hand side you should see a box labeled Calendar. It probably has Default KOrganizer Resource entry in it:

Add New Calendar

Hit the Add button in the lower left corner. When prompted what kind of calendar you want to create, choose Calendar in Local File:

Calendar in Local File

Finally, name your calendar and point it to the google.ics file in your home directory:

Set it up with google.ics

If everything went right, you should see your GCal entries pop up in Kontact calendar. If they are not, it means you did something wrong. Go back and check your settings. Make sure you copied and pasted the whole encrypted password, and check both paths. I can verify that this setup works.

This is a two way sync meaning that you can add events on either side (KOrganizer and GCal interface) and they will transfer to the other medium. Sometimes you might run into issues when you edit the same entry on both sides in a really short amount of time. You never know which edit will stick – but then again, that’s to be expected.

Now all you have to do is to make the GCALDaemon run on startup. You can start it in several way. The best one would probably be an rc script. But since I use it on my laptop, which always runs KDE I decided to make it a KDE startup entry. I simply created a gcaldaemon.desktop file in my ~/.kde/Autostart directory with the following contents:

[Desktop Entry]
Exec=/opt/GCALDaemon/bin/standalone-start.sh
Name=GCALDaemon
Type=Application
X-KDE-StartupNotify=false
X-KDE-autostart-phase=2

It’s probably not the best or most robust method, but it works.

So that’s it – this is all you need to do to convince your Kontact Calendar and GCalc to start talking with each other. Enjoy!

[tags]kontact, korganizer, calendar, gcal, google calendar, gcaldaemon, kontact and gcal, sync kontact with gcal, calendar sync, sync, two way sync[/tags]

This entry was posted in Uncategorized. Bookmark the permalink.



29 Responses to Howto: Two Way Sync Between Kontact and GCal

  1. jambarama UNITED STATES Epiphany Ubuntu Linux Terminalist says:

    I’ve been looking for good calendaring on Linux for a while. Long ago I came to the conclusion that they are all either too bulky or too feature poor. So I started using google calendar, and now I’m hooked.

    I’d love to give it up, there are many situations where I don’t have internet access (I guess I could print to file the agendas) and need to add something to my calendar. And switching to something else would bork me when I’m not around my school laptop (I use several computers throughout a day).

    Even still, on my school laptop I use fluxbox and evolution/kazehakase on a stripped down xubuntu install – not because the laptop is old (1.8ghz Pent M, 1.5 gig ram) but because I appreciate quick lightweight apps. From boot to a usable system, my laptop takes 45-50 seconds. It wakes up from standby in less than 5, and from hibernation in closer to 15. Heavy kde/gnome stuff is fine on a desktop I don’t frequently power down, but for a laptop you can’t beat that boot speed.

    All the desktop calendar apps I’ve looked at are deficient in important ways, for example: korganizer, kontact, and evolution all have high quality calendars, but they are coupled with mail clients and a thousand libraries. Xcal and orage are just too feature poor to be handy. Sunbird isn’t in the deb repos, but something like gdeskcal would be awesome if it could two-way sync with google calendar.

    rainlender2 looked like the solution to my problems – it syncs easily with google calendar (via gcaldaemon), and it is lightweight. Unfortunately it isn’t in the deb repos (proprietary reasons I think) and the directions I’ve found on arsgeek & howtogeek give me an error “Unable to load resources from path: /opt/rainlendar2/resources/”. I’ve checked the file permissions and I’ve checked to be certain that path exists – it should work on both counts. So I’m stuck again.

    If the kdelibs ever get light enough they don’t slow down my laptop, I’d jump on korganizer in a second (and kmail instead of korganizer if gmail supported imap, but that is another story). But for now I’m stuck taking notes in a tiddlywiki page and using google calendar, neither of which are really all that bad.

    Reply  |  Quote
  2. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Btw, I stopped relying on Ubuntu repositories for Mozilla apps when I realized no one is interested in backporting the newest releases to Dapper. I still use Dapper on my laptop and I don’t feel like changing just yet. Hey, it’s LTS so I’m not really left behind with respect to security patches.

    The version of FF that is in Dapper repos right now is 1.5.8 if I’m not mistaken. I’m using the generic linux binaries from the FF website instead. I installed them in /opt and every once in a while I run FF with sudo and do the automatic upgrade thing which just works.

    I suspect that you could do the same thing with sunbird. Screw Ubuntu repos – just install the generic binary in /opt and use it. :)

    Btw, gcaldaemon will work with just about any calendaring app that supports ical. All you have to do is to set it up and then point your client to the ical file.

    Since I already use KMail for my work email (which is POP3) this is a perfect solution for me. Especially since people around here like to send out those funky Outlook based meeting reminders. When you click Accept on one of them it automatically creates an entry in KOrganizer. Now it syncs up with my GCal so I can actually check my meeting times anywhere at any time. :)

    Reply  |  Quote
  3. Pingback: it’s about time» Blog Archive » links for 2007-10-17 UNITED STATES WordPress

  4. bjoern GERMANY Mozilla Firefox Ubuntu Linux says:

    Thank you for this howto!
    I got it to work, and now even my nokia is included in the calendar syncing stuff.
    Is there a way to do the same kind of thing with to-do lists and contacts?

    Reply  |  Quote
  5. Luke Maciak UNITED STATES Mozilla Firefox Windows says:

    Well, GCal does not really have a todo feature, and I’m not sure how Kontact stores the todo lists. I don’t think they are held in the ical file though, which would mean that syncing them up would require something more than just this daemon.

    Contacts on the other hand can be done, I think. I haven’t really looked into it but GCalDaemon has the functionality to sync contact info.

    Reply  |  Quote
  6. Excellent! Thanks for these instructions.

    Reply  |  Quote
  7. Trevor Storr NEW ZEALAND Mozilla Firefox Ubuntu Linux says:

    Thanks for this, works great!

    The latest version has a GUI configuration editor.

    Reply  |  Quote
  8. Pingback: Truco: integrar Google Calendar en el calendario de Gnome y KDE SPAIN WordPress

  9. Phlogiston SWITZERLAND Mozilla Firefox Windows says:

    Anyone knows how to sync a calendar that I have added to my google calendar? Because only my own is synced with GCALDaemon.

    Reply  |  Quote
  10. All this seems so good,
    but I have a strange time zone (?) pb:

    I use GCalDaemon with the sync-now.sh
    as I don’t always have the internet link with my eeePC.

    Everything seems right at first:
    my google calendar events get correctly on the local copy I use thru Kontact…
    BUT after several sync, I noticed that my events are shifting
    one our after each sync…

    At first I thought I got the time zone incorrectly on eigther
    side, but :

    I am in France / Paris
    and the correct time zone is selected on google and on the eeePC.
    The GCalDaemon logs tell about using CET.

    And after reflexion, would the problem be that the shift sould occur only one, and since the very first sync.

    Any idea ??

    Reply  |  Quote
  11. Niels Hoffmann NEW ZEALAND Mozilla Firefox Windows says:

    I have the exact same issue with the one hour time shift between Google Calendar and KOrganizer on my eeePC… Both are set to pacific/Auckland time zones. Anyone found a solution for this yet?

    Cheers, Niels

    Reply  |  Quote
  12. Bill JAPAN Mozilla Firefox Ubuntu Linux says:

    According to this there is a time-zone sync bug in Kontact (i.e. KOrganizer):
    I’m still looking for a solution, too.
    Cheers

    Reply  |  Quote
  13. Luke Maciak UNITED STATES Mozilla Firefox Windows Terminalist says:

    @Bill – good find! I’ll keep an eye on that thread. :)

    Reply  |  Quote
  14. Bill JAPAN Mozilla Firefox Linux says:

    Well, I installed Mandriva 2009 RC1 that has KOrganizer Version 4.1.0. I was hoping the bug would be fixed, but alas, it is not.
    Not sure what I’m going to do now… ;(

    Reply  |  Quote
  15. Dan UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Thanks. This was too easy. Now I’m ready for Android. :)

    Reply  |  Quote
  16. SJ SWITZERLAND Mozilla Firefox Ubuntu Linux says:

    Hi there

    it works great for me, however I wonder if there’s a way to also sync the birthdays/anniversaries from kaddressbook that show in korganizer?

    SJ

    Reply  |  Quote
  17. rob CANADA Mozilla Firefox Ubuntu Linux says:

    Anyone have an issue with the contacts not getting downloaded? I used the GUI tool to config everything, the calendar works great, but the contacts fail with the following error:

    ERROR | Unable to load contact list!
    java.lang.Exception: Login failed (check username/password)!
    at org.gcaldaemon.core.GmailEntry.connectLDAP(GmailEntry.java:231)
    at org.gcaldaemon.core.GmailEntry.connect(GmailEntry.java:147)
    at org.gcaldaemon.core.GmailPool.borrow(GmailPool.java:98)
    at org.gcaldaemon.core.ldap.ContactLoader.loadContacts(ContactLoader.java  :274)
    at org.gcaldaemon.core.ldap.ContactLoader.run(ContactLoader.java:220)

    It looks like the username/password is incorrect, but they were set to the same value by the config tool. If I run the password encryption script it also spits out the same password for both the calendar and the contacts.

    Reply  |  Quote
  18. BONeal UNITED STATES Mozilla Firefox Windows says:

    I have the same issue connecting to the contacts on my google aps account. I am using java 1.5 on Ubuntu with GCal 1.0 Beta 16. User name and password were cut and pasted in the config file and checked hundred times. However the error protists.

    INFO | GCALDaemon V1.0 beta 16 starting…
    INFO | RSS/ATOM feed converter enabled.
    INFO | Local time zone is GMT-07:00.
    INFO | HTTP server starting on port 9090…
    WARN | Set the ‘http.allowed.hostnames’ parameter to limit remote access.
    INFO | HTTP server started successfully.
    INFO | File listener disabled.
    WARN | Set the ‘ldap.allowed.hostnames’ parameter to limit remote access.
    INFO | LDAP server starting on port 9080…
    INFO | LDAP server started successfully.
    INFO | Gmail notifier disabled.
    INFO | Sendmail service disabled.
    INFO | Mail terminal disabled.
    WARN | Response from Google:

    … shows html of login page a few times…

    ERROR | Unable to load contact list!
    java.lang.Exception: Login failed (check username/password)!
    at org.gcaldaemon.core.GmailEntry.connectLDAP(GmailEntry.java:231)
    at org.gcaldaemon.core.GmailEntry.connect(GmailEntry.java:147)
    at org.gcaldaemon.core.GmailPool.borrow(GmailPool.java:98)
    at org.gcaldaemon.core.ldap.ContactLoader.loadContacts(ContactLoader.java  :274)
    at org.gcaldaemon.core.ldap.ContactLoader.run(ContactLoader.java:220)

    Reply  |  Quote
  19. Vijit Coomara SRI LANKA Mozilla Firefox Ubuntu Linux says:

    I have the same problem as above for contacts.
    Interestingly if I use my username@gmail.com (personal e-mail) it works fine.

    When I use my work google apps domain, that is when I get the same error as above
    java.lang.Exception: Login failed (check username/password)!

    user: username@mydomain.com (custom google apps domain)
    password: (encrypted password for this domain user)

    Reply  |  Quote
  20. theguzz GERMANY Konqueror Linux says:

    Hey Folks,

    does anybody get this contacts stuff working??????
    I don’t get errors, but can’t see any contacts in my kaddrassbook…

    Reply  |  Quote
  21. Jo GERMANY Mozilla Firefox Fedora Linux says:

    Hi,

    I had the same annoying issue with the contacts. After reading your posts I just changed “xyz@googlemail.com” to “xyz@gmail.com” and restarted gcaldaemon. 5 seconds later I had all contacts in my work folder.

    Hope you get the same result.

    Reply  |  Quote
  22. The workaround for “Login failed” issue is here:

    http://sourceforge.net/projects/gcaldaemon/forums/forum/643348/topic/3 417160/index/page/1

    It worked for me: Ubuntu 9.10 with Java6

    Reply  |  Quote
  23. Very nice tutorial.
    Still wished for a more integrated solution in kontact …

    Regards,

    Jack

    Reply  |  Quote
  24. Dansei BELGIUM Mozilla Firefox Ubuntu Linux says:

    @ Pierre DEDIEU:

    I have the same problem (very annoying)
    Any answer by now

    J’ai le même problème
    As-tu trouvé une solution à ce problème (c’est vraiment agaçant)

    Reply  |  Quote
  25. Matt Powell AUSTRALIA Google Chrome Mac OS says:

    Hi all,

    I’ve downloaded the source and ripped out all the broken Gmail linkage (it was relying on a very old Gmail protocol) and replaced it with some working code. It works nicely and more robustly than the original, at least for me.

    If anyone is interested, respond here and I can upload a ZIP somewhere.

    //matt

    Reply  |  Quote
  26. Anonamice AUSTRALIA Mozilla Firefox Windows says:

    @ Matt Powell:

    Matt I’d love to get a copy of it if I can?

    Cheers

    Reply  |  Quote
  27. manoflinux UNITED STATES Mozilla Firefox Ubuntu Linux says:

    @ Anonamice:
    hey please I would like a copy, I can find and setup a free host for it.

    Reply  |  Quote
  28. manoflinux UNITED STATES Mozilla Firefox Ubuntu Linux says:

    please reply to this one I it should go to my email.

    Reply  |  Quote
  29. Matt Powell AUSTRALIA Google Chrome Mac OS says:

    Ok, I finally got around to putting the new code up here:

    https://github.com/matpowel/GLDAPDaemon

    Enjoy, and fork away.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *