Closed Bug 212792 Opened 21 years ago Closed 17 years ago

opening a .ics attachment launches calendar window but fails to import calendar event from attachment

Categories

(Calendar :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: wgianopoulos, Assigned: sebo.moz)

References

Details

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

We use Lotus Notes mail and calendaring at work.  If I use Mozilla to read my
Notes mail via IMAP and have the calendar installed as well I would expect to be
able to respond to meeting invitations by oepning the calendar attacment .ics
file.  This does end up bringing me to the calendar window, but does not import
the data from the .ics file or give a pop-up asking if that is what I want to
do.  The only way I have found to enter the invitations in the Mozilla calendar
is to save the attachement to my hard drive then go to the Mozilla calendar and
import the calendar entry from teh hard-drive.  THis should all be more integrated.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
New contact from mikep@oeone.com to mostafah@oeone.com
Filter on string OttawaMBA to get rid of these messages. 
Sorry for the spam.
Assignee: mikep → mostafah
I can confirm this bug.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
Mozilla Calendar 2003092613-cal

Oddly enough it worked for Moz 1.3 & an earlier build of calendar.
Severity: enhancement → normal
*** Bug 257594 has been marked as a duplicate of this bug. ***
Summary: opning a .ics attachment launches calendar window but fails to import calendar event from attachment → opening a .ics attachment launches calendar window but fails to import calendar event from attachment
confirming.

From reading the code, opening the attachment should bring up the editEvent dialog.
I think we should download the file to disk, and let the import code handle
this. It makes the downloading code easier (always download to disk, never to
memory), and it reuses import code (No need to copy that functionality)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Using Sunbird this problem is worse.  I cannot get it to open sunbird at all.  I
think the main issue here is that if there is a command line option to launch
sunbird giving it a file containing an event, it does not appear to be
documented anywhere.
With recent versions, I cannot open .ics files in any way, with either
Mozilla+Calendar or Sunbird. More than the problem with opening .ics files,
Mozilla no longer lists any calendar in the "Calendars" tab.

Note: When starting sunbird from a terminal (to get messages), I get in the
terminal:

error creating table cal_calendars -- probably already exists

The summary should be clearer (nothing to do with attachments). The severity
should be critical since Calendar/Sunbird is completely useless. The hardware/OS
should be All/All (here the problem occurs under Linux, with both a PC and a Mac).
Hmm... looking at the dates, this may be a new, more general bug after all.
Vincent: trunk calendar builds are known to be unusable for normal use.
news://news.mozilla.org:119/ctu4o4$18a4@ripley.netscape.com
Confirmed, with Thunderbird 1.0.2 (20050404) and Calendar 2005011113 on
Ubuntu Hoary.

I found that if I double-click on the .ics attachment several times in
succession, quickly enough, there's a good chance that the "New Event"
dialog will come up.

I stepped through the code in Venkman, and the onStreamComplete callback
passed to  nsIStreamLoader.init() is never getting called.  The URI spec
looks correct; it's an imap:// URL with parameters specifying the
particular MIME part and filename (event.ics).  So it looks like it starts
loading the attachment using a stream loader, but that process never
completes, and so the "New Event" dialog is not launched.
Aha!  I'm using IMAP as well.  I found that if I configure the containing folder
for offline use, then I can consistently get the "New Event" pop-up to appear. 
Other folks with this problem, does this solution work for you?  If so, there
would appear to be a problem streaming the .ics data from the IMAP server.
The workaround works for me too.  I set my Inbox for offline, and I now
consistenly get the import dialog when I double-click on the attachement.

I don't know if it should be mentioned here or in another bug, but when the
meeting requests come from Exchange, they are mime/alternative, and they don't
show up as attachments.  I have to have a filter to change the mime/alternative
to mime/multipart so I can see them to click on them.  This is less than ideal.
*** Bug 305229 has been marked as a duplicate of this bug. ***
QA Contact: gurganbl → general
*** Bug 305929 has been marked as a duplicate of this bug. ***
Changing OS as a result of Bug 305929.
OS: Windows XP → All
*** Bug 330728 has been marked as a duplicate of this bug. ***
Reassigning all automatically assigned bugs from Mostafa to nobody@m.o

Bugspam filter: TorontoMostafaMove
Assignee: mostafah → nobody
" P2 	 Double-clicking an .ICS file should open it (or subscribe, or offer to import it)"

blocking 0.5?
Flags: blocking-calendar0.5?
Attached patch subscribe to flagless argument in commandline (obsolete) — — Splinter Review
This is starting sunbird from commandline in the form

>sunbird [URI/to/calendar/to/subscribe/to]

using this patch it is also possible to doubleclick *.ics files and calendar will be launched and the file subscribed to. It also works to subscribe to e-mail-attached ics files using "Open with sunbird" in Thunderbird.

I wrote the patch in a way that allows subscription to multiple files in one step. This way a typical sunbird environment can be easily set up.

Tested with Sunbird/TRUNK on Linux and Windows.
Attachment #252820 - Flags: first-review?(lilmatt)
I found a mistake when handling unknown flags (e.g. "-height 800"). Now they are removed before proceeding.
Attachment #252820 - Attachment is obsolete: true
Attachment #252848 - Flags: first-review?(lilmatt)
Attachment #252820 - Flags: first-review?(lilmatt)
We won't hold up 0.5 for this.
Flags: blocking-calendar0.5? → blocking-calendar0.5-
Whiteboard: [patch in hand]
Comment on attachment 252848 [details] [diff] [review]
2nd try, treating flagless arguments as ics calendars to subscribe to

>Index: calendar/resources/content/calendar.js
>===================================================================
>RCS file: /cvsroot/mozilla/calendar/resources/content/calendar.js,v
>retrieving revision 1.249
>diff -u -8 -p -r1.249 calendar.js
>--- calendar/resources/content/calendar.js	25 Jan 2007 17:41:03 -0000	1.249
>+++ calendar/resources/content/calendar.js	26 Jan 2007 00:50:32 -0000
>@@ -136,46 +136,61 @@ function calendarInit() 
>            dump("unknown argument passed to main window\n");
>            continue;
>        }
>        handleCommandLine(cl);
>    }
> }
> 
> function handleCommandLine(aComLine) {
>-    var calurl;
>+    var calurl = new Array();
>     try {
>-        calurl = aComLine.handleFlagWithParam("subscribe", false);
>-    } catch(ex) {}
>-    if (calurl) {
>-        var uri = aComLine.resolveURI(calurl);
>-        var cal = getCalendarManager().createCalendar('ics', uri);
>-        getCalendarManager().registerCalendar(cal);
>-
>-        // Strip ".ics" from filename for use as calendar name, taken from 
>-        // calendarCreation.js
>-        var fullPathRegex = new RegExp("([^/:]+)[.]ics$");
>-        var prettyName = calurl.match(fullPathRegex);
>-        var name;
>-
>-        if (prettyName && prettyName.length >= 1) {
>-            name = decodeURIComponent(prettyName[1]);
>-        } else {
>-            name = calGetString("calendar", "untitledCalendarName");
>+        var subscribeContent = aComLine.handleFlagWithParam("subscribe", false);
>+        if (subscribeContent != null) {
>+        calurl.push( subscribeContent );
This line ^^^ should be indented.
>         }
>-        cal.name = name;
>-    }
>+    } catch(ex) {}
> 
>     var date;
>     try {
>         date = aComLine.handleFlagWithParam("showdate", false);
>     } catch(ex) {}
>     if (date) {
>         currentView().goToDay(jsDateToDateTime(new Date(date)));
>     }
>+    if (aComLine.length >= 1) {
>+        for (var i = 0; i < aComLine.length; i++) {
>+            if (!aComLine.getArgument(i).match(/^-/) && !aComLine.getArgument(i).match(/\s/)) {
>+               calurl.push( aComLine.getArgument(i) );
>+            } else {
>+            aComLine.removeArguments(i, i);
This line should be indented. ^^^


>+    if (calurl.length >= 1) {
>+        for (var i = 0; i < calurl.length; i++) {
>+            var uri = aComLine.resolveURI(calurl[i]);
>+            var cal = getCalendarManager().createCalendar('ics', uri);
>+            getCalendarManager().registerCalendar(cal);
>+
>+            // Strip ".ics" from filename for use as calendar name, taken from 
>+            // calendarCreation.js
>+            var fullPathRegex = new RegExp("([^/:]+)[.]ics$");
>+            var file = uri.QueryInterface(Components.interfaces.nsIURL).fileName;
>+            var prettyName = file.match(fullPathRegex);
>+            var name;
>+
>+            if (prettyName && prettyName.length >= 1) {
>+            name = decodeURIComponent(prettyName[1]);
>+            } else {
>+            name = calGetString("calendar", "untitledCalendarName");
>+            }
>+            cal.name = name;
>+        }
>+    }
This bit is duplicated.  This code should be separated out into a helper function, rather than duplicating it.


Having recently touched this code in bug 358110, I don't think we will want to continue with the current architecture.  One drawback you'll notice is that with this code (and mine in the other bug, and with what's in the tree), if Sunbird is already running, double-clicking and .ICS file does NOT subscribe you to it.  It simply brings Sunbird to the foreground.  Subscribing from the command line only works on first launch of the app.

Minusing on all that.
Attachment #252848 - Flags: first-review?(lilmatt) → first-review-
Whiteboard: [patch in hand]
Flags: blocking-calendar0.7?
I think the re-architecture question is important, but I don't think it is something we can really resolve in the 0.7 time frame.  Furthermore, this bug was not to "subscribe on double click". This bug was filed to make it easier to move an ICS file from application X to Sunbird.  Having the ability to associate Sunbird as an ICS handler, and have it properly open ICS on double click seems like a good interim step.

I think we'd like to take this patch and file a follow-on bug for the architectural issues that lilmatt noted.  Sebastian, can you submit a patch that applies to current codebase and addresses Matt's points?

Marking blocking for 0.7 and assigning to Sebo.
Assignee: nobody → sebo.moz
Flags: blocking-calendar0.7? → blocking-calendar0.7+
Attached patch subscribe to flagless arguments v3 (obsolete) — — Splinter Review
That would be a version that applies to the current tree. I also changed the .ics stripping part to do the regexp on the URI path rather than the input. This way we can also handle windows-style (\).
I will ask for UI-review to address the question of subscribe vs. import.chr
Attachment #252848 - Attachment is obsolete: true
Attachment #275000 - Flags: ui-review?
Attachment #275000 - Flags: review?(ctalbert)
Attachment #275000 - Flags: ui-review? → ui-review?(christian.jansen)
Status: NEW → ASSIGNED
Hardware: PC → All
Comment on attachment 275000 [details] [diff] [review]
subscribe to flagless arguments v3

Looks pretty good, except where paths have spaces in them, see below...

Index: calendar/resources/content/calendar.js
===================================================================
RCS file: /cvsroot/mozilla/calendar/resources/content/calendar.js,v
retrieving revision 1.200.2.45
diff -u -8 -p -r1.200.2.45 calendar.js
--- calendar/resources/content/calendar.js	30 Jul 2007 16:41:17 -0000	1.200.2.45
+++ calendar/resources/content/calendar.js	2 Aug 2007 20:15:28 -0000
@@ -152,16 +152,17 @@ function calendarInit() 
+
+    //Look for arguments without a flag. This is needed to handle double-click on Windows and Linux.
Break this line so that it is two lines less than 80 characters long

+    if (comLine.length >= 1) {
+        for (var i = 0; i < comLine.length; i++) {
+            if (!comLine.getArgument(i).match(/^-/) && !comLine.getArgument(i).match(/\s/)) {
Bend the if around the && sign:
if (!comLine.getARgument(i).match(/^-/) &&
   !comLine.getArgument(i).match(/\s/)) {

I also think this comparison has issues with paths that have embedded spaces.
For example, if you double click on an ics file in "C:\my documents\happy.ics"
then this code will open sunbird, but the happy.ics file will not be opened.

However: c:\nospaces\happy.ics will work.

I verified that windows passes the ICS file with a complete path which is enclosed in double quotes (the quotes are always present regardless if there are embedded spaces).  I think you can check for a command line of the form:
sunbird.exe "path to file.ics" on windows.

Tested it on Windows XP with Sunbird build: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7pre) Gecko/20070809 Calendar/0.7pre

Unfortunately, have to - due to this.  Look forward to next version of patch.
Attachment #275000 - Flags: review?(ctalbert) → review-
FWIW, I like the UI, where the ICS name is used as the calendar name.  I think that is a nice touch.
Attachment #275000 - Flags: ui-review?(christian.jansen)
(In reply to comment #24)
> 
> I also think this comparison has issues with paths that have embedded spaces.
> For example, if you double click on an ics file in "C:\my documents\happy.ics"
> then this code will open sunbird, but the happy.ics file will not be opened.
> 
I changed the code to only check for leading whitespaces. From what I see this should be fine. I tested this on Linux and Windows and it seems to work.

I'm unclear if I should ask for UI review here.
Attachment #275000 - Attachment is obsolete: true
Attachment #276149 - Flags: review?(ctalbert)
Furthermore, what I have found during testing is that subscribing to a file that sunbird is already subscribed to is possible and causes ambiguities. However, that has been possible before and should probably be handled in a different bug.
Comment on attachment 276149 [details] [diff] [review]
subscribe to flagless arguments v4

Looks good to me.  r=ctalbert Please file a separate bug for the issue you mention in comment 27.
Attachment #276149 - Flags: review?(ctalbert) → review+
Whiteboard: checkin-needed
Blocks: 252736
Keywords: checkin-needed
Whiteboard: checkin-needed
Target Milestone: --- → 0.7
Patch checked in on HEAD and MOZILLA_1_8_BRANCH.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Verified with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7pre) Gecko/20070829 Calendar/0.7pre
Status: RESOLVED → VERIFIED
Flags: blocking-calendar0.7+
Flags: blocking-calendar0.5-
I get an error in the developer console when I try to open a .ics file using the -url NAME -foreground method in Icedove/Lightning.

Error: [Exception... "'Failure' when calling method: [nsICommandLineHandler::handle]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "<unknown>"  data: no]

Bet perhaps, my Icedove lags begind Thunderbird headrev.  It required an older build of the Lightning plugin:

  Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20111010 Lightning/1.0b3pre Icedove/3.1.15
Ilguiz, this was fixed in Mozilla Sunbird application. The Lightning extension for Thunderbird doesn't offer a similar feature yet, see the open enhancement requests.
that would be bug 359807 and bug 357480
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: