Last Comment Bug 360753 - Add migration support for migrating data from Vista's calendaring application.
: Add migration support for migrating data from Vista's calendaring application.
Product: Calendar
Classification: Client Software
Component: General (show other bugs)
: Trunk
: x86 Windows Vista
-- enhancement with 1 vote (vote)
: 1.9
Assigned To: Philipp Kewisch [:Fallen]
Depends on:
  Show dependency treegraph
Reported: 2006-11-14 17:59 PST by matthaeus123
Modified: 2012-09-14 10:59 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

untested patch (3.52 KB, patch)
2006-12-07 14:30 PST, Joey Minta
no flags Details | Diff | Splinter Review
Fix - v2 (12.33 KB, patch)
2009-09-06 02:00 PDT, Philipp Kewisch [:Fallen]
no flags Details | Diff | Splinter Review
Fix - v3 (12.31 KB, patch)
2012-01-29 10:59 PST, Philipp Kewisch [:Fallen]
matthew.mecca: review+
Details | Diff | Splinter Review

Description User image matthaeus123 2006-11-14 17:59:49 PST
Migration support is needed for Windows Vista's integrated calendaring application "Windows Calendar". Support should be implemented into the Migration Wizard.

All of the calendar files are saved as ".ics". They are all saved in the same folder depending on the profile.

C:\Users\"profile name"\AppData\Local\Microsoft\Windows Calendar\Calendars

- the text "profile name" represents the name of the profile, which will change depending on the user.

This directory has only been confirmed on Microsoft Vista RC1 (Build 5600).
Comment 1 User image matthaeus123 2006-11-25 12:55:52 PST
I know that it has not been tested on the final version of Microsoft Windows Vista, but the paths probably will not change from RC1 to RTM.
Comment 2 User image Joey Minta 2006-12-07 14:30:50 PST
Created attachment 247882 [details] [diff] [review]
untested patch

I had to eyeball this patch, since I don't have Vista.  The checking part at least runs without errors, so I don't think it'll break anything, but I can't promise it'll pick up data from Vista calendars.  If someone could test that, I'd appreciate it.
Comment 3 User image Stefan Sitter 2006-12-07 15:16:45 PST
Depends on Bug 360659? (At least on win2k and winxp the migration wizard fails)
Comment 4 User image Philipp Kewisch [:Fallen] 2009-09-06 02:00:46 PDT
Created attachment 398918 [details] [diff] [review]
Fix - v2

This patch should take care. I have Vista installed, but no development environment installed, so I can't test if getting the path works correctly. What I did for testing is to initialize a file object with /media/disk/Users/... instead of getting it from the directory service. From there it works fine for me.

I would appreciate if someone with vista could test this patch. to open the migrator on an existing profile, call this from the error console:

Comment 5 User image Martin Schröder [:mschroeder] 2009-09-19 09:26:50 PDT
ssitter, can you take the review over? I don't have access to a box with Vista, but maybe you have.
Comment 6 User image Philipp Kewisch [:Fallen] 2009-09-21 01:19:28 PDT
As I've just noticed, please pretend there is a try-catch block around the get() for LocalAppData, as this throws on Linux.
Comment 7 User image Martin Schröder [:mschroeder] 2012-01-29 05:53:27 PST
Comment on attachment 398918 [details] [diff] [review]
Fix - v2

I won't be able to review this. Also, this patch has been lying around for a long time and may be bitrotted.
Comment 8 User image Philipp Kewisch [:Fallen] 2012-01-29 10:59:44 PST
Created attachment 592524 [details] [diff] [review]
Fix - v3

Unbitrotted, but not tested since I'm on mac now. Matthew, could you look into this instead?
Comment 9 User image Matthew Mecca [:mmecca] 2012-02-13 20:41:14 PST
Comment on attachment 592524 [details] [diff] [review]
Fix - v3

Review of attachment 592524 [details] [diff] [review]:

::: calendar/base/content/dialogs/calendar-migration-dialog.js
@@ +548,5 @@
> +        if (!settingsxml || !settingsxml.exists()) {
> +            // No Settings.xml, maybe Windows Calendar was never started?
> +            return [];
> +        }
> +        let settingsXmlUri = gDataMigrator.ioService.newFileURI(settingsxml);

This throws "Error: gDataMigrator.ioService is undefined". I see gDataMigrator has a mIoService property, but it doesn't seem to be initialized or referenced anywhere. Maybe cal.getIOService().newFileURI would work here, I don't have a dev environment set up on a Vista machine at the moment so I didn't try it.
Comment 10 User image Philipp Kewisch [:Fallen] 2012-02-15 00:10:03 PST
Indeed, the mIOService should have been removed some time in the past, the patches age is to be blamed :-) The better way would be to use Services.jsm and then
Comment 11 User image Matthew Mecca [:mmecca] 2012-02-15 11:18:52 PST
With the ioService part fixed the import still fails with multiple 

Error: [calStorageCalendar] Message: Error selecting events with recurrence!
Exception: TypeError: this.mSelectEventsWithRecurrence is undefined


Error: [calStorageCalendar] Message: prepareStatement exception
Exception: TypeError: aStmt is undefined

It appears that the storage calendar isn't initialized fully because the id hasn't been set before the items are added.

Adding " = cal.getUUID();" after the calendar is created in the importICSToStorage function here:
fixed this and the import worked fine.
Comment 12 User image Matthew Mecca [:mmecca] 2012-02-15 11:21:33 PST
Comment on attachment 592524 [details] [diff] [review]
Fix - v3

r=mmecca with aforementioned fixes
Comment 13 User image Philipp Kewisch [:Fallen] 2012-08-09 11:36:00 PDT
Pushed to comm-central changeset 27959b5eab05

Note You need to log in before you can comment on or make changes to this bug.