Fix bug 453195 - Allow providers to disable imip. r=dbo

git-svn-id: svn://10.0.0.236/trunk@253974 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla%kewis.ch 2008-09-02 12:27:51 +00:00
parent f42f05f287
commit 01ede8681f
11 changed files with 95 additions and 32 deletions

View File

@ -93,8 +93,14 @@
}
}
document.getElementById("prompt").value = window.arguments[0].promptText;
listbox.selectedIndex = selectedIndex;
listbox.ensureIndexIsVisible(selectedIndex);
if (calendars.length) {
listbox.selectedIndex = selectedIndex;
listbox.ensureIndexIsVisible(selectedIndex);
} else {
// If there are no calendars, then disable the accept button
document.documentElement.getButton("accept").setAttribute("disabled", "true");
}
}
function doOK() {

View File

@ -105,6 +105,7 @@ calendar.jar:
#expand skin/classic/calendar/calendar-toolbar.css (themes/__THEME__/calendar-toolbar.css)
#expand skin/classic/calendar/today-pane.css (themes/__THEME__/today-pane.css)
#expand skin/classic/calendar/widgets/calendar-widgets.css (themes/__THEME__/widgets/calendar-widgets.css)
#expand skin/classic/calendar/calendar-creation-wizard.css (themes/__THEME__/calendar-creation-wizard.css)
#expand skin/classic/calendar/calendar-event-dialog.css (themes/__THEME__/calendar-event-dialog.css)
#expand skin/classic/calendar/calendar-occurrence-prompt.css (themes/__THEME__/calendar-occurrence-prompt.css)
#expand skin/classic/calendar/calendar-occurrence-prompt.png (themes/__THEME__/calendar-occurrence-prompt.png)

View File

@ -142,6 +142,10 @@ interface calICalendar : nsISupports
* [nsresult] currentStatus The current error status of the calendar (transient).
*
* [calIItipTransport] itip.transport If the provider implements a custom calIItipTransport (transient)
* If null, then Email Scheduling will effectively be
* disabled. This means for example, the calendar will
* not show up in the list of calendars to store an
* invitation in.
* [boolean] itip.disableRevisionChecks If true, the iTIP handling code disables revision checks
* against SEQUENCE and DTSTAMP, and will never reject an
* iTIP message as outdated

View File

@ -425,16 +425,20 @@ calItipProcessor.prototype = {
/**
* Centralized location for obtaining the proper transport. If a calendar is
* specified, the transport is taken from the provider. If the provider
* does not specify a transport, or no calendar is specified, the default
* email transport is returned.
* specified, the transport is taken from the provider. Otherwise, the
* default email transport is returned.
*
* Its ok to assume there is an itip.transport here, since if it would
* return null (i.e imip is disabled) then we never get here, since the
* respective calendar will not be available as a target calendar.
*/
_getTransport: function cipGT(aCalendar) {
var ret = (aCalendar && aCalendar.getProperty("itip.transport"));
if (!ret) {
ret = Components.classes["@mozilla.org/calendar/itip-transport;1?type=email"]
.getService(Components.interfaces.calIItipTransport);
if (aCalendar) {
return aCalendar.getProperty("itip.transport")
.QueryInterface(Components.interfaces.calIItipTransport);
} else {
return Components.classes["@mozilla.org/calendar/itip-transport;1?type=email"]
.getService(Components.interfaces.calIItipTransport);
}
return ret.QueryInterface(Components.interfaces.calIItipTransport);
}
}

View File

@ -37,3 +37,7 @@
#calendar-properties-grid {
margin-left: 20px;
}
#calendar-properties-rows > row {
min-height: 26px;
}

View File

@ -37,3 +37,7 @@
#calendar-properties-grid {
margin-left: 20px;
}
#calendar-properties-rows > row {
min-height: 26px;
}

View File

@ -410,8 +410,14 @@ function getMsgRecipient() {
* Call the calendar picker
*/
function getTargetCalendar() {
function filterCalendars(c) {
// Only consider calendars that are writable and have a transport.
return isCalendarWritable(c) &&
c.getProperty("itip.transport") != null;
}
var calendarToReturn;
var calendars = getCalendarManager().getCalendars({}).filter(isCalendarWritable);
var calendars = getCalendarManager().getCalendars({}).filter(filterCalendars);
// XXXNeed an error message if there is no writable calendar
// try to further limit down the list to those calendars that are configured to a matching attendee;

View File

@ -21,6 +21,7 @@
-
- Contributor(s):
- Daniel Boelzle <daniel.boelzle@sun.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -55,9 +56,12 @@
insertafter="customize-suppressAlarms-row">
<label value="&lightning.calendarproperties.email.label;"
control="email-identity-menulist"/>
<menulist id="email-identity-menulist">
<menupopup id="email-identity-menupopup"/>
</menulist>
<box>
<menulist id="email-identity-menulist">
<menupopup id="email-identity-menupopup"/>
</menulist>
<label id="email-identity-label"/>
</box>
</row>
</rows>

View File

@ -21,6 +21,7 @@
-
- Contributor(s):
- Daniel Boelzle <daniel.boelzle@sun.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -56,10 +57,13 @@
<label value="&lightning.calendarproperties.email.label;"
control="email-identity-menulist"
disable-with-calendar="true"/>
<menulist id="email-identity-menulist"
disable-with-calendar="true">
<menupopup id="email-identity-menupopup"/>
</menulist>
<box>
<menulist id="email-identity-menulist"
disable-with-calendar="true">
<menupopup id="email-identity-menupopup"/>
</menulist>
<label id="email-identity-label"/>
</box>
</row>
</rows>

View File

@ -72,21 +72,46 @@ function ltnGetString(aBundleName, aStringName, aParams) {
// shared by lightning-calendar-properties.js and lightning-calendar-creation.js:
function ltnInitMailIdentitiesRow() {
if (gCalendar) {
uncollapseElement("calendar-email-identity-row"); // in case user steps back and firth in wizard on different types
var menuPopup = document.getElementById("email-identity-menupopup");
addMenuItem(menuPopup, ltnGetString("lightning", "imipNoIdentity"), "none");
var identities = getAccountManager().allIdentities;
for (var i = 0; i < identities.Count(); ++i) {
var identity = identities.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIdentity);
addMenuItem(menuPopup, identity.identityName, identity.key);
}
try {
var sel = gCalendar.getProperty("imip.identity");
if (sel) {
sel = sel.QueryInterface(Components.interfaces.nsIMsgIdentity);
// in case user steps back and firth in wizard on different types
uncollapseElement("calendar-email-identity-row");
var hasTransport = (gCalendar.getProperty("itip.transport") != null);
setElementValue("email-identity-menulist",
!hasTransport && "true",
"hidden");
setElementValue("email-identity-label",
hasTransport && "true",
"hidden");
if (gCalendar.getProperty("itip.transport")) {
var menuPopup = document.getElementById("email-identity-menupopup");
addMenuItem(menuPopup, ltnGetString("lightning", "imipNoIdentity"), "none");
var identities = getAccountManager().allIdentities;
for (var i = 0; i < identities.Count(); ++i) {
var identity = identities.GetElementAt(i)
.QueryInterface(Components.interfaces.nsIMsgIdentity);
addMenuItem(menuPopup, identity.identityName, identity.key);
}
try {
var sel = gCalendar.getProperty("imip.identity");
if (sel) {
sel = sel.QueryInterface(Components.interfaces.nsIMsgIdentity);
}
menuListSelectItem("email-identity-menulist", sel ? sel.key : "none");
} catch (exc) {
}
} else {
// No transport, therefore we can just show the label with the
// organizerId and common name. Use an attendee object so we don't
// have to duplicate code to compose the string.
var organizer = createAttendee();
organizer.id = gCalendar.getProperty("organizerId");
organizer.commonName = gCalendar.getProperty("organizerCN");
if (organizer.id) {
setElementValue("email-identity-label", organizer.toString());
} else {
collapseElement("calendar-email-identity-row");
}
menuListSelectItem("email-identity-menulist", sel ? sel.key : "none");
} catch (exc) {
}
} else {
collapseElement("calendar-email-identity-row");

View File

@ -40,6 +40,7 @@
<!-- Style sheets -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/skin/calendar-creation-wizard.css" type="text/css"?>
<!DOCTYPE dialog
[