From c8c662f1ad14d0ea06ce8cc8a5c3f3e893580c10 Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Wed, 16 Jan 2013 23:52:12 +0100 Subject: [PATCH] Fix bug 489162 - No accept/ decline button for invitations with GCal. r=mmecca --- calendar/base/modules/calItipUtils.jsm | 10 ++++++++-- .../en-US/chrome/lightning/lightning.properties | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/calendar/base/modules/calItipUtils.jsm b/calendar/base/modules/calItipUtils.jsm index 73d6e0c2e6..4da23b60f3 100644 --- a/calendar/base/modules/calItipUtils.jsm +++ b/calendar/base/modules/calItipUtils.jsm @@ -147,6 +147,7 @@ cal.itip = { return (cal.itip.isSchedulingCalendar(aCalendar) && cal.userCanAddItemsToCalendar(aCalendar)); } + let writableCalendars = cal.getCalendarManager().getCalendars({}).filter(isWritableCalendar); if (writableCalendars.length > 0) { let compCal = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"] @@ -245,7 +246,10 @@ cal.itip = { data[btn] = { label: null, actionMethod: "" }; } - if (Components.isSuccessCode(rc) && !actionFunc) { + if (rc == Components.interfaces.calIErrors.CAL_IS_READONLY) { + // No writable calendars, tell the user about it + data.label = _gs("imipBarNotWritable"); + } else if (Components.isSuccessCode(rc) && !actionFunc) { // This case, they clicked on an old message that has already been // added/updated, we want to tell them that. data.label = _gs("imipBarAlreadyProcessedText"); @@ -497,7 +501,9 @@ cal.itip = { // Per iTIP spec (new Draft 4), multiple items in an iTIP message MUST have // same ID, this simplifies our searching, we can just look for Item[0].id let itemList = itipItem.getItemList({}); - if (itemList.length > 0) { + if (!itipItem.targetCalendar) { + optionsFunc(itipItem, Components.interfaces.calIErrors.CAL_IS_READONLY); + } else if (itemList.length > 0) { ItipItemFinderFactory.findItem(itemList[0].id, itipItem, optionsFunc); } else if (optionsFunc) { optionsFunc(itipItem, Components.results.NS_OK); diff --git a/calendar/locales/en-US/chrome/lightning/lightning.properties b/calendar/locales/en-US/chrome/lightning/lightning.properties index 830e5be6e8..1ecef5d5ae 100644 --- a/calendar/locales/en-US/chrome/lightning/lightning.properties +++ b/calendar/locales/en-US/chrome/lightning/lightning.properties @@ -44,6 +44,7 @@ imipBarProcessedNeedsAction=This message contains an event that you have not yet imipBarReplyText=This message contains a reply to an invitation. imipBarUnsupportedText=This message contains an event that this version of Lightning cannot process. imipBarProcessingFailed=Processing message failed. Status: %1$S. +imipBarNotWritable=No writable calendars are configured for invitations, please check the calendar properties. imipAcceptInvitation.label=Accept imipCancelInvitation.label=Delete imipDeclineInvitation.label=Decline