Fix
bug 442607 - Reminder details link does not work if calendar window is closed. r=decathlon
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.js
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js
@@ -95,22 +95,24 @@ function onDismissAllAlarms() {
/**
* Event handler fired when the alarm widget's "Details..." label was clicked.
* Open the event dialog in the most recent Sunbird or Thunderbird window
*
* @param event The itemdetails event.
*/
function onItemDetails(event) {
- // We want this to happen in a calendar window.
- let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- let calWindow = wm.getMostRecentWindow("calendarMainWindow") ||
- wm.getMostRecentWindow("mail:3pane");
- calWindow.modifyEventWithDialog(event.target.item, null, true);
+ // We want this to happen in a calendar window if possible. Otherwise open
+ // it using our window.
+ let calWindow = cal.getCalendarWindow();
+ if (calWindow) {
+ calWindow.modifyEventWithDialog(event.target.item, null, true);
+ } else {
+ modifyEventWithDialog(event.target.item, null, true);
+ }
}
/**
* Sets up the alarm dialog, initializing the default snooze length and setting
* up the relative date update timer.
*/
var gRelativeDateUpdateTimer;
function setupWindow() {
@@ -323,8 +325,15 @@ function closeIfEmpty() {
*/
function onSelectAlarm(event) {
let richList = document.getElementById("alarm-richlist")
if (richList == event.target) {
richList.ensureElementIsVisible(richList.getSelectedItem(0));
richList.userSelectedWidget = true;
}
}
+
+function ensureCalendarVisible(aCalendar) {
+ // This function is called on the alarm dialog from calendar-item-editing.js.
+ // Normally, it makes sure that the calendar being edited is made visible,
+ // but the alarm dialog is too far away from the calendar views that it
+ // makes sense to force visiblity for the calendar. Therefore, do nothing.
+}
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.xul
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.xul
@@ -39,31 +39,34 @@
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/skin/calendar-alarm-dialog.css" type="text/css"?>
<!-- used for button-text and button-menu-dropmarker classes -->
<?xml-stylesheet href="chrome://global/skin/button.css" type="text/css"?>
+<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
+
<!-- DTD File with all strings specific to the calendar -->
<!DOCTYPE dialog SYSTEM "chrome://calendar/locale/calendar.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="calendar-alarm-dialog"
title="&calendar.alarm.title.label;"
windowtype="Calendar:AlarmWindow"
persist="screenX screenY width height"
onload="setupWindow(); window.arguments[0].wrappedJSObject.window_onLoad();"
onunload="finishWindow();"
onfocus="onFocusWindow();"
onkeypress="if (event.keyCode == event.DOM_VK_ESCAPE) { window.close(); }"
width="600"
height="300">
<script type="application/javascript" src="chrome://calendar/content/calendar-alarm-dialog.js"/>
+ <script type="application/javascript" src="chrome://calendar/content/calendar-item-editing.js"/>
<script type="application/javascript" src="chrome://calendar/content/calUtils.js"/>
<richlistbox id="alarm-richlist" flex="1" onselect="onSelectAlarm(event)"/>
<hbox pack="end" id="alarm-actionbar" align="center">
<button id="alarm-snooze-all-button"
type="menu"
label="&calendar.alarm.snoozeallfor.label;">