The Kuest for Kalendars

It all started in September, a week before Software Freedom Day, when I was considering ways to leverage our events calendar in Floss-Pa to let everybody carry our calendar around. I started playing with remote iCals in my cell phone and, of course, in KDE which was at 4.7.1 at that time - and that didnt' work. I noticed adding a remote URL as an iCal resource worked (as in "added the events in KOrganizer and the Calendar applet") but caused constant Plasma crashes. I replicated the issue in both my PC and my Laptop, so I was quite sure it was a bug.

I had recently been accepted as a KDE Developer, just working on Kig mainly, so I thought it was a good chance to try patching somewhere else. I found out it was actually Akonadi related, so I started looking around for the particular KDE PIM project that dealt with the code and eventually (after fetching pretty much all of the main PIM projects) found the code at KDE PIM Libs and tried the simplest patch I could think of to avoid the crash: a simple if statement a couple of lines of code before the crash line that would basically "cancel everything if it didn't look good". The patch was rejected by Stephen Kelly, the author of most of the model code behind Akonadi, because the patch would hide a real and larger problem that was causing the issue.

I then knew I had to try harder to get a fix for that issue, so I thought about looking at KDE's Bugzilla to see if someone else was already working on that. I remember I queried for "ical calendar" - which turned out to be a bad idea. I found a list of 4 bugs, none related to what I was looking for, but all of which I could confirm based on my couple of weeks of playing around with calendars in KDE.

There were two related to not being able to import custom timezones from an iCal resource. I had not tried that before, but Stephan Diestelhorst provided excellent feedback in the bug reports and attached an example of a resource with embedded custom timezones which made it trivially easy to reproduce the bug.  It turned out to be a bug in KDE PIM Libs, a project I had already checked out for working with the calendar issues. After two weeks of trying out examples and isolating the problem, I was finally able to submit a patch for review, which was eventually accepted and committed.

In the meantime, while waiting for reviews on my previous patch, I was still working on finding out what was the real cause of the Plasma crash, and at the same time working on another report of the four I found about the Calendar widget displaying events in the wrong time due to Timezone issues, although KOrganizer would display them right. That was one of the things I noticed the very first time I tried using iCal in KDE, so I was very interested in fixing it. After debugging the issue, and after a couple of weeks of finding out the right way to address the situation, I eventually came up with a patch that dealt with the inner mechanisms of Akonadi's calendar support which wasn't of the like of many: Sergio Martins and John Layt were in favor of an approach that would fix stuff upper in the layers of code, closer to the visualization layer. I had spent weeks working on that issue so  I was pretty sure there was no way to address it from the visualization layer, but I thought I might as well take another look at the visualization code just to make sure I was right... and I wasn't. I found a much cleaner and better way to handle the issue and came up with a patch that followed John and Sergio's suggestions and was eventually accepted and committed.

While working on the Calendar applet patch I was still using Stephan's example from the previous bug I was working on, and while working with it in KOrganizer, I discovered the custom timezone caused KOrganizer to crash when editing the event. Since previously there was no way to include custom timezones in the iCal events, there was no way KDE users would notice the bug in the editors, so this issue had to be fixed together with the patch for custom timezones in iCal resources. Unfortunately, due to the review processes being independent and so close to the 4.7.3 release, the patch for custom timezones was included in 4.7.3 but the editor patch will have to wait for 4.7.4.

With most issues cleared out of the way, I was finally able to return to my original intention to fix the Plasma crash with remote iCals. I had previously posted in the Plasma Development mailing list about the situation I found was causing the crash, and Christian Mollekopf pointed me out to an interesting approach to achieve the same behavior without using broken code. I ended up implementing that approach which was recently approved and committed, so ending my long quest to fix many sorts of calendar issues in KDE.

The bottom line of this post is actually not to showcase my recent work in KDE Development, but to illustrate a whole process of collaboration among experienced KDE developers helping newcomers do real fixes and close bug reports - and how much can a user like Stephan help in the bug squashing process. Although some of those fixes are already included in 4.7.3, most of them are coming with 4.7.4 so I really hope the user experience with calendars in KDE improves in the upcoming release. There might have been loose ends here and there, so don't hesitate to use the Bugzilla to let us know about them. I actually still have a list of checks and weird stuff I've seen along the way which are probably just more bugs to squash.