Comment 16 for bug 286567

Revision history for this message
Tim Holy (holy-wustl) wrote :

OK, I did more reading (ruby is pretty cool). The "Z" substitution line can be changed to
            line = line.sub(/Z[\r$]/,'')
and I think the script works as you intended. (The \r part is needed because korganizer seems to save its data in a DOS-style text file; I put the $ in there for safety.)

However, it turns out that the concern I raised above about not converting the times is indeed a problem. Here's why: in scheduling, korganizer has already done the conversion to UTC when it saves an event in the format YYYYMMDDTHHMMSSZ. If we just strip the Z off the end without converting to local time, then all the times will be off by the UTC offset.

So I poked around and came up with a solution. I've attached a script that seems to work for me. I had to install the "tzinfo" gem http://tzinfo.rubyforge.org/doc/files/README.html

and I run this script with
ruby -rubygems migrateics.rb

One oddity: when I first start kontact, switching to the "calendar" component of kontact now takes much longer than it used to: 20 seconds! It used to take 4 seconds.

One other issue: suppose the script bombs on certain std.ics files (it works on mine, but just suppose), so that it either deletes the data or converts it into something that crashes korganizer (which I've now done a lot recently). If the user runs the script twice, without copying the backup std.ics from $HOME back to .kde/share/apps/korganizer in between, then the user won't have any backup of his/her data. Would it be worth checking to make sure that the "make a backup copy" step doesn't overwrite an existing file?

Once these last points are taken care of, I imagine this script might be ready for wider use.