392584-Calendar-Mode cleanup needed;r=mickey

This commit is contained in:
Berend.Cornelius%sun.com 2007-11-30 10:42:51 +00:00
Родитель 7bf5281232
Коммит 2027530cbe
5 изменённых файлов: 521 добавлений и 117 удалений

Просмотреть файл

@ -1407,7 +1407,7 @@ function sameDay(date1, date2) {
/**
* This is a centralized function for setting the prodid and version on an
* ical components. This should be used whenever you need to set the prodid
* ical component. This should be used whenever you need to set the prodid
* and version on a calIcalComponent object.
*
* @param
@ -1422,3 +1422,30 @@ function calSetProdidVersion(aIcalComponent) {
aIcalComponent.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
aIcalComponent.version = "2.0";
}
/**
* This function returns a sibling of a XUL element, that is positioned behind
* it in the DOM hierarchy *
* @param
* aElement The XUL element to derive the sibling from
* @param
* aDistance An integer value denoting how the relative position
* of the returned sibling within the parent container
*/
function getAdjacentSibling(aElement, aDistance) {
var retElement = aElement;
if (aDistance > 0) {
for (var i = 0; i < aDistance; i++) {
if (retElement) {
try {
retElement = retElement.nextSibling;
} catch (e) {
retElement = null;
i = aDistance;
}
}
}
}
return retElement;
}

Просмотреть файл

@ -174,7 +174,7 @@ var CalendarController =
onEvent: function ccOE(event) {
// do nothing here...
},
isCalendarInForeground: function ccIC() {
return document.getElementById("displayDeck").selectedPanel.id == "calendar-view-box";
}
@ -279,7 +279,7 @@ function ltnOnLoad(event)
}
return toolbars;
}
var restoreToolbarProperties = function(toolbox,toolbars)
{
var toolbar = toolbox.firstChild;
@ -296,7 +296,7 @@ function ltnOnLoad(event)
toolbar = toolbar.nextSibling;
}
}
// DOMAttrModified handler that listens on the toolbox element
var onModified = function(aEvent)
{
@ -310,7 +310,6 @@ function ltnOnLoad(event)
// place the mode toolbox at the top of the left pane
modeToolbox = contentPanel.parentNode.insertBefore(modeToolbox, contentPanel);
modeToolbox.palette = palette;
var toolbar = document.getElementById("mode-toolbar");
} else if(aEvent.newValue == "bottom" && aEvent.prevValue == "top") {
// place the mode toolbox at the bottom of the left pane
modeToolbox = contentPanel.parentNode.appendChild(modeToolbox);
@ -404,6 +403,7 @@ function ltnOnLoad(event)
} else {
CalendarController.defaultController = controller;
top.controllers.insertControllerAt(0, CalendarController);
ltnInitializeCalendarMenu();
}
}
injectCommandController();
@ -462,6 +462,49 @@ function ltnSelectCalendarView(type) {
}
function toggleControlDisplay(aCommandId, aControlId) {
var control = document.getElementById(aControlId);
var command = document.getElementById(aCommandId);
if (control.getAttribute("collapsedinMode") == "false") {
if (control.hasAttribute("collapsed")) {
control.removeAttribute("collapsed");
command.setAttribute("checked", "true");
return;
}
}
command.setAttribute("checked", "false");
}
function toggleControlinMode(aCommandId, aControlId) {
var control = document.getElementById(aControlId);
var command = document.getElementById(aCommandId);
if (control.hasAttribute("collapsed")) {
control.removeAttribute("collapsed");
control.setAttribute("collapsedinMode", "false");
command.setAttribute("checked","true");
}
else {
control.setAttribute("collapsed", "true");
control.setAttribute("collapsedinMode", "true");
command.setAttribute("checked", "false");
}
}
function toggleToolbar(aCommandId, aToolbarId) {
var toolBar = document.getElementById(aToolbarId);
var command = document.getElementById(aCommandId);
if (toolBar.hasAttribute("collapsed")) {
toolBar.removeAttribute("collapsed");
command.setAttribute("checked", "true");
}
else {
toolBar.setAttribute("collapsed", "true");
command.setAttribute("checked", "false");
}
}
/**
* Show the calendar view, also switching to calendar mode if in mail mode
*/
@ -495,18 +538,6 @@ function toggleTodayPaneinMailMode()
}
}
function selectedCalendarPane(event)
{
var deck = document.getElementById("displayDeck");
// If we're already showing a calendar view, don't do anything
if (deck.selectedPanel.id == "calendar-view-box")
return;
deck.selectedPanel = document.getElementById("calendar-view-box");
ltnShowCalendarView('week');
}
/**
* This function has the sole responsibility to switch back to
@ -576,6 +607,207 @@ SelectFolder = function(folderUri) {
gSelectFolder(folderUri);
}
var calendarpopuplist = new Array();
var mailpopuplist = new Array();
var menulist = new Array();
function ltnInitializeCalendarMenu() {
function copyPopupMenus() {
addToPopuplists(document.getElementById("menu_File"));
addToPopuplists(document.getElementById("menu_Edit"));
var menuView = document.getElementById("menu_View");
addToPopuplists(menuView);
addToPopuplists(menuView.nextSibling, document.getElementById("calendar-GoPopupMenu"));
addToPopuplists(document.getElementById("messageMenu"), document.getElementById("calendarCalendarPopupMenu"));
var tasksMenu = document.getElementById("tasksMenu");
addToPopuplists(tasksMenu);
}
function addToPopuplists(aMenuElement, acalendarpopupmenu) {
var child = aMenuElement.firstChild;
if (child) {
if (child.localName == "menupopup") {
var newcalendarPopupMenu = acalendarpopupmenu;
if (newcalendarPopupMenu == null) {
newcalendarPopupMenu = child.cloneNode(true);
}
if (aMenuElement.getAttribute("id") != "menu_Edit") {
newcalendarPopupMenu.removeAttribute("onpopupshowing");
}
removeMenuElements(child, "calendar");
calendarpopuplist.push(newcalendarPopupMenu);
mailpopuplist.push(child);
menulist.push(aMenuElement);
}
}
}
function getCalendarMenuElementById(aElementId, aMenuPopup) {
var element = null;
var elements = aMenuPopup.getElementsByAttribute("id", aElementId);
if (elements.length > 0) {
element = elements[0];
}
return element;
}
copyPopupMenus();
// "File" - menu
[getCalendarMenuElementById("openMessageFileMenuitem", calendarpopuplist[0]),
getCalendarMenuElementById("newAccountMenuItem", calendarpopuplist[0]),
getCalendarMenuElementById("fileAttachmentMenu", calendarpopuplist[0]),
getAdjacentSibling(getCalendarMenuElementById("menu_saveAs", calendarpopuplist[0]), 2),
// "Edit" - menu
getCalendarMenuElementById("menu_find", calendarpopuplist[1]),
getCalendarMenuElementById("menu_favoriteFolder", calendarpopuplist[1]),
getCalendarMenuElementById("menu_properties", calendarpopuplist[1]),
getCalendarMenuElementById("menu_accountmgr", calendarpopuplist[1]),
// "View"-menu
getCalendarMenuElementById("menu_showMessengerToolbar", calendarpopuplist[2]),
// "Tools"-menu
getCalendarMenuElementById("tasksMenuMail", calendarpopuplist[5]),
getCalendarMenuElementById("menu_import", calendarpopuplist[5])].forEach(function(element) {
try {
if (element) {
element.parentNode.removeChild(element);
}
} catch (e) {
dump("Element '" + element.getAttribute("id") + "' could not be removed\n");
}
});
calendarpopuplist.forEach(function(aMenuPopup) {
var child = aMenuPopup.lastChild;
if (child) {
if (child.localName == "menuseparator") {
try {
aMenuPopup.removeChild(child)
} catch (e) {
dump("Element '" + child.getAttribute("id") + "' could not be removed\n");
}
}
}
});
// "File" - menu
[getCalendarMenuElementById("menu_newFolder", calendarpopuplist[0]),
getCalendarMenuElementById("menu_saveAs", calendarpopuplist[0]),
getCalendarMenuElementById("menu_getnextnmsg", calendarpopuplist[0]),
getCalendarMenuElementById("menu_renameFolder", calendarpopuplist[0]),
getCalendarMenuElementById("offlineMenuItem", calendarpopuplist[0]),
// "Edit" - menu
getCalendarMenuElementById("menu_delete", calendarpopuplist[1]),
getCalendarMenuElementById("menu_select", calendarpopuplist[1]),
// "View"-menu
getCalendarMenuElementById("menu_MessagePaneLayout", calendarpopuplist[2]),
getCalendarMenuElementById("viewSortMenu", calendarpopuplist[2]),
getCalendarMenuElementById("viewheadersmenu", calendarpopuplist[2]),
getCalendarMenuElementById("viewTextSizeMenu", calendarpopuplist[2]),
getCalendarMenuElementById("pageSourceMenuItem", calendarpopuplist[2]),
// "Tools"-menu
getCalendarMenuElementById("filtersCmd", calendarpopuplist[5]),
getCalendarMenuElementById("runJunkControls", calendarpopuplist[5])].forEach(function(element){
/** removes all succeedingmenu elements of a container up to the next
* menuseparator that thus denotes the end of the section. Elements with the
* attribute mode == 'calendar' are ignored
*/
function removeMenuElementsInSection(aElement) {
var element = aElement
var bleaveloop = false;
while (!bleaveloop) {
var ignore = false;
bleaveloop = element.localName == "menuseparator";
if (bleaveloop) {
// we delete the menuseparator only if it's the last element
// within its container
bleaveloop = (element.nextSibling != null);
}
if (element.hasAttribute("mode")) {
ignore = element.getAttribute("mode") == "calendar";
}
var nextMenuElement = element.nextSibling;
if (!ignore) {
try {
element.parentNode.removeChild(element);
} catch (e) {
dump("Element '" + element.getAttribute("id") + "' could not be removed\n");
}
}
if (!bleaveloop) {
element = nextMenuElement;
bleaveloop = (element == null);
}
}
}
removeMenuElementsInSection(element);
});
document.getElementById("calendar-toolbar").setAttribute("collapsed", "true")
var modeToolbar = document.getElementById("mode-toolbar");
var visible = !modeToolbar.hasAttribute("collapsed");
document.getElementById("modeBroadcaster").setAttribute("checked", visible);
}
function swapPopupMenus() {
var showStatusbar = document.getElementById("menu_showTaskbar").getAttribute("checked");
var oldmenupopuplist = null;
var newmenupopuplist = null;
if (gCurrentMode == "mail") {
oldmenupopuplist = calendarpopuplist;
newmenupopuplist = mailpopuplist;
}
else if (gCurrentMode == "calendar") {
oldmenupopuplist = mailpopuplist;
newmenupopuplist = calendarpopuplist;
}
for (var i = 0; i < menulist.length; i++) {
var menu = menulist[i];
var oldmenupopup = menu.firstChild;
if (oldmenupopup) {
var newmenupopup = null;
oldmenupopuplist[i] = oldmenupopup;
menu.replaceChild(newmenupopuplist[i], oldmenupopup);
}
}
document.getElementById("menu_showTaskbar").setAttribute("checked", showStatusbar);
var messageMenu = document.getElementById("messageMenu");
if (gCurrentMode == "mail") {
messageMenu.setAttribute("label", messagemenulabel);
messageMenu.setAttribute("accesskey", messagemenuaccesskey);
}
else {
messageMenu.setAttribute("label", calendarmenulabel);
messageMenu.setAttribute("accesskey", calendarmenuaccesskey);
}
}
function removeMenuElements(aRoot, aModeValue) {
var modeElements = aRoot.getElementsByAttribute("mode", aModeValue);
if (modeElements.length > 0) {
for (var i = modeElements.length-1; i >=0; i--) {
var element = modeElements[i];
if (element) {
var localName = element.localName;
if (localName =="menuitem" || localName == "menuseparator" || localName == "menu"){
element.parentNode.removeChild(element);
}
}
}
}
}
SelectMessage = function(messageUri) {
document.getElementById("switch2mail").doCommand();
gSelectMessage(messageUri);

Просмотреть файл

@ -28,6 +28,7 @@
- Stefan Sitter <ssitter@googlemail.com>
- Philipp Kewisch <mozilla@kewis.ch>
- Michael Buettner <michael.buettner@sun.com>
- Berend Cornelius <berend.cornelius@sun.com>
- 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,6 +56,7 @@
<?xml-stylesheet href="chrome://calendar/content/calendar-view-bindings.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/skin/calendar-views.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/menu.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/calendar-bindings.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/minimonth.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/datetimepickers.css" type="text/css"?>
@ -82,120 +84,166 @@
<script type="application/x-javascript" src="chrome://calendar/content/calendar-dnd-listener.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<menupopup id="menu_NewPopup">
<menuseparator />
<menuitem id="ltnNewEvent" label="&lightning.menupopup.new.event.label;"
observes="calendar_new_event_command"/>
<menuitem id="ltnNewTask" label="&lightning.menupopup.new.task.label;"
observes="calendar_new_todo_command"/>
<menuitem id="ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
observes="calendar_new_calendar_command"/>
</menupopup>
<!-- Hide the Thunderbird Open menuitem. Don't remove it, since other extensions
might depend on its position. A visible menuitem will be added below. -->
<menuitem id="openMessageFileMenuitem" hidden="true" accesskey="" key=""/>
<script type="application/x-javascript">
var calendarmenulabel = "&lightning.calendar.label;";
var calendarmenuaccesskey = "&lightning.calendar.accesskey;";
var messagemenulabel = "&msgMenu.label;";
var messagemenuaccesskey = "&msgMenu.accesskey;";
</script>
<menupopup id="menu_FilePopup">
<menu id="menu_Open"
mode="calendar"
label="&lightning.menupopup.open.label;"
accesskey="&lightning.menupopup.open.accesskey;"
insertbefore="openMessageFileMenuitem">
insertafter="menu_New">
<menupopup id="menu_OpenPopup">
<menuitem id="ltnOpenMessageFileMenuitem"
mode="calendar"
label="&lightning.menupopup.open.message.label;"
accesskey="&lightning.menupopup.open.message.accesskey;"
oncommand="MsgOpenFromFile();"/>
<menuitem id="ltnOpenCalendarFileMenuitem"
mode="calendar"
label="&lightning.menupopup.open.calendar.label;"
accesskey="&lightning.menupopup.open.calendar.accesskey;"
oncommand="openLocalCalendar();"/>
</menupopup>
</menu>
<menuitem id="calendar-export-selection-menu"
mode="calendar"
label="&calendar.export.selection.label;"
accesskey="&calendar.export.selection.accesskey;"
observes="calendar_export_selection_command"
insertafter="menu_close"/>
<menuitem id="calendar-export-menu"
mode="calendar"
label="&calendar.export.calendar;"
accesskey="&calendar.export.calendar.accesskey;"
observes="calendar_export_command"
insertafter="menu_close"/>
<menuitem id="calendar-import-menu"
label="&calendar.importcalendar.label;"
accesskey="&calendar.import.accesskey;"
observes="calendar_import_command"
mode="calendar"
insertafter="menu_close"/>
<menuseparator id="afterMenu_close"
mode="calendar"
insertafter="menu_close"/>
</menupopup>
<menubar id="mail-menubar">
<menu id="ltnCalendarMenu" label="&lightning.calendar.label;"
accesskey="&lightning.calendar.accesskey;"
insertbefore="tasksMenu">
<menupopup id="ltncalendarMenuPopup">
<menuitem id="ltnEditSelectedCalendar"
label="&lightning.toolbar.edit.calendar.label;"
accesskey="&lightning.toolbar.edit.calendar.accesskey;"
observes="calendar_edit_calendar_command"/>
<menuitem id="ltnDeleteSelectedCalendar"
label="&lightning.toolbar.delete.calendar.label;"
accesskey="&lightning.toolbar.delete.calendar.accesskey;"
observes="calendar_delete_calendar_command"/>
<menuseparator/>
<menuitem id="ltnChangeViewDay"
label="&lightning.toolbar.day.label;"
accesskey="&lightning.toolbar.day.accesskey;"
type="radio"
name="calendarMenuViews"
observes="calendar_day-view_command"/>
<menuitem id="ltnChangeViewWeek"
label="&lightning.toolbar.week.label;"
accesskey="&lightning.toolbar.week.accesskey;"
type="radio"
name="calendarMenuViews"
observes="calendar_week-view_command"/>
<menuitem id="ltnChangeViewMultiweek"
label="&lightning.toolbar.multiweek.label;"
accesskey="&lightning.toolbar.multiweek.accesskey;"
type="radio"
name="calendarMenuViews"
observes="calendar_multiweek-view_command"/>
<menuitem id="ltnChangeViewMonth"
label="&lightning.toolbar.month.label;"
accesskey="&lightning.toolbar.month.accesskey;"
type="radio"
name="calendarMenuViews"
observes="calendar_month-view_command"/>
<menuseparator/>
<menu label="&viewMenu.label;" accesskey="&viewMenu.accesskey;">
<menupopup>
<menuitem type="checkbox"
id="ltn-workdays-only"
label="&calendar.onlyworkday.checkbox.label;"
accesskey="&calendar.onlyworkday.checkbox.accesskey;"
observes="calendar_toggle_workdays_only_command"/>
<menuitem type="checkbox"
id="ltn-tasks-in-view"
label="&calendar.displaytodos.checkbox.label;"
accesskey="&calendar.displaytodos.checkbox.accesskey;"
observes="calendar_toggle_tasks_in_view_command"/>
<menuitem type="checkbox"
id="calendar_view_orientation"
label="&calendar.orientation.label;"
accesskey="&calendar.orientation.accesskey;"
observes="calendar_toggle_orientation_command"/>
</menupopup>
</menu>
<menuitem id="ltnGoToToday"
label="&calendar.context.gototoday.label;"
accesskey="&calendar.context.gototoday.accesskey;"
observes="calendar_go_to_today_command"/>
<menuseparator/>
<menuitem id="calendar-import-menu"
label="&calendar.import.calendar;"
accesskey="&calendar.import.accesskey;"
observes="calendar_import_command"/>
<menuitem id="calendar-export-menu"
label="&calendar.export.calendar.label;"
accesskey="&calendar.export.calendar.accesskey;"
observes="calendar_export_command"/>
<menuitem id="calendar-export-selection-menu"
label="&calendar.export.selection.label;"
accesskey="&calendar.export.selection.accesskey;"
observes="calendar_export_selection_command"/>
</menupopup>
</menu>
</menubar>
<menupopup id="menu_NewPopup">
<menuitem id="ltnNewEvent" label="&lightning.menupopup.new.event.label;"
accesskey="&event.new.event.accesskey;"
key="newEventKey"
observes="calendar_new_event_command"
mode="calendar"
position="2"/>
<menuitem id="ltnNewTask" label="&lightning.menupopup.new.task.label;"
accesskey="&event.new.todo.accesskey;"
key="newTaskKey"
observes="calendar_new_todo_command"
mode="calendar"
position="3"/>
<menuseparator id="afterltnNewTask" position="4"/>
<menuseparator id="beforenewAccountMenuItem"
mode="mail"
insertbefore="newAccountMenuItem"/>
<menuitem id="ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
observes="calendar_new_calendar_command"
accesskey="&calendar.new.server.accesskey;"
mode="calendar"
insertafter="newAccountMenuItem"/>
</menupopup>
<menupopup id="menu_View_Popup">
<menu label="&showCurrentView.label;"
mode="calendar"
accesskey="&showCurrentView.accesskey;">
<menupopup>
<menuitem type="checkbox"
id="ltn-workdays-only"
persist="checked"
label="&calendar.onlyworkday.checkbox.label;"
accesskey="&calendar.onlyworkday.checkbox.accesskey;"
mode="calendar"
oncommand="toggleWorkdaysOnly()"/>
<menuitem type="checkbox"
id="ltn-tasks-in-view"
persist="checked"
label="&calendar.displaytodos.checkbox.label;"
accesskey="&calendar.displaytodos.checkbox.accesskey;"
mode="calendar"
oncommand="toggleTasksInView()"/>
<menuitem type="checkbox"
id="ltn-multiday-rotated"
persist="checked"
disabled="true"
label="&calendar.orientation.label;"
accesskey="&calendar.orientation.accesskey;"
mode="calendar"
oncommand="updateOrientation()"/>
</menupopup>
</menu>
<menuseparator id="before-Calendar-View-Section" mode="calendar"/>
<menuitem id="ltnChangeViewDay"
label="&lightning.toolbar.day.label;"
accesskey="&lightning.toolbar.day.accesskey;"
type="radio"
name="calendarMenuViews"
mode="calendar"
key="day-view-key"
observes="calendar_day-view_command"/>
<menuitem id="ltnChangeViewWeek"
label="&lightning.toolbar.week.label;"
accesskey="&lightning.toolbar.week.accesskey;"
type="radio"
name="calendarMenuViews"
mode="calendar"
key="week-view-key"
observes="calendar_week-view_command"/>
<menuitem id="ltnChangeViewMultiweek"
label="&lightning.toolbar.multiweek.label;"
accesskey="&lightning.toolbar.multiweek.accesskey;"
type="radio"
name="calendarMenuViews"
mode="calendar"
key="multiweek-view-key"
observes="calendar_multiweek-view_command"/>
<menuitem id="ltnChangeViewMonth"
label="&lightning.toolbar.month.label;"
accesskey="&lightning.toolbar.month.accesskey;"
type="radio"
name="calendarMenuViews"
mode="calendar"
key="month-view-key"
observes="calendar_month-view_command"/>
</menupopup>
<menupopup id="view_toolbars_popup">
<menuitem id="ltnCalendarToolbar"
type="checkbox"
label="&calendar.toolbar.label;"
accesskey="&calendar.toolbar.accesskey;"
mode="calendar"
observes="cmd_toggleCalendarToolbar"
position="1"/>
<menuitem id="ltnModeToolbar"
type="checkbox"
label="&mode.toolbar.label;"
accesskey="&mode.toolbar.accesskey;"
observes="modeBroadcaster"
command="cmd_toggleModeToolbar"
position="2"/>
</menupopup>
<!-- Hide the Thunderbird Open menuitem. Don't remove it, since other extensions
might depend on its position. A visible menuitem will be added below. -->
<menuitem id="openMessageFileMenuitem" hidden="true" accesskey="" key=""/>
<window id="messengerWindow">
<broadcasterset id="calendar_broadcasters">
<broadcaster id="is_editable" hidden="false"/>
<broadcaster id="modeBroadcaster" checked="true"/>
</broadcasterset>
<!-- Be sure to keep these sets, since they will be overlayed by
calendar/base/content/calendar-common-sets.xul -->
@ -205,11 +253,27 @@
<command id="switch2calendar" oncommand="ltnSwitch2Calendar()"/>
<command id="switch2task" oncommand="ltnSwitch2Task()"/>
<command id="cmd_toggleTodayPane" oncommand="toggleTodayPaneinMailMode()"/>
</commandset>
<command id="cmd_toggleModeToolbar" oncommand="toggleToolbar('cmd_toggleModeToolbar', 'mode-toolbar')"/>
<command id="cmd_toggleCalendarToolbar" oncommand="toggleControlinMode('cmd_toggleCalendarToolbar', 'calendar-toolbar')"/>
<command id="calendar-delete-command" oncommand="ltnDeleteSelectedItem()" disabledwhennoeventsselected="true"/>
<command id="calendar_new_todo_command" oncommand="createTodoWithDialog(getSelectedCalendar());"/>
<command id="modify_todo_command" oncommand="editToDo()"/>
<command id="delete_todo_command" oncommand="deleteToDoCommand()" disabled="true"/>
<command id="cmd_gotoToday" oncommand="goToToday()"/>
</commandset>
<keyset id="ltnKeys">
<key id="openLightningKey" modifiers="accel" key="3" observes="switch2calendar"/>
<key id="todaypanekey" command="cmd_toggleTodayPane" keycode="VK_F11"/>
<key id="newEventKey" key="I" modifiers="accel" command="calendar_new_event_command"/>
<key id="newTaskKey" key="D" modifiers="accel" command="calendar_new_todo_command"/>
<key id="day-view-key" key="1" modifiers="alt" command="calendar_day-view_command"/>
<key id="week-view-key" key="2" modifiers="alt" command="calendar_week-view-command"/>
<key id="multiweek-view-key" key="3" modifiers="alt" command="calendar_multiweek-view_command"/>
<key id="month-view-key" key="4" modifiers="alt" command="calendar_month-view_command"/>
<!-- not yet in use...-->
<key id="switchtotask-key" key="4" modifiers="accel"/>
<key id="gotoToday-key" command="cmd_gotoToday" modifiers="accel" keycode="VK_DOWN"/>
<keyset id="ltnKeys">
<key id="openLightningKey" modifiers="accel" key="3" observes="switch2calendar"/>
<key id="todaypanekey" modifiers="accel" key="D" command="cmd_toggleTodayPane"/>
</keyset>
<popupset id="calendar-popupset">
@ -243,6 +307,76 @@
accesskey="&calendar.context.deleteitem.accesskey;"
observes="calendar_delete_event_command"/>
</popup>
<menupopup id="calendar-GoPopupMenu">
<menuitem id="ltnGoToToday"
label="&goTodayCmd.label;"
accesskey="&goTodayCmd.accesskey;"
observes="calendar_go_to_today_command"
key="gotoToday-key"/>
<menuseparator id="before-ModeMenuItems"/>
<menuitem id="ltnMenu_mail"
type="radio"
name="modemenu"
label="&lightning.toolbar.mail.label;"
accesskey="&lightning.toolbar.mail.accesskey;"
command="switch2mail"
key="key_mail" modifiers="accel"/>
<menuitem id="ltnMenu_calendar"
type="radio"
name="modemenu"
checked="true"
label="&lightning.toolbar.calendar.label;"
accesskey="&lightning.toolbar.calendar.accesskey;"
command="switch2calendar"
key="openLightningKey"/>
<menuseparator id="before-AddressBook"/>
<menuitem id="addressBook-calendar" label="&addressBookCmd.label;"
accesskey="&addressBookCmd.accesskey;"
key="key_addressbook"
mode="calendar"
oncommand="toOpenWindowByType('mail:addressbook', 'chrome://messenger/content/addressbook/addressbook.xul');"/>
</menupopup>
<menupopup id="calendarCalendarPopupMenu">
<menuitem id="ltnNewEvent2" label="&event.new.event;"
accesskey="&event.new.event.accesskey;"
key="newEventKey"
observes="calendar_new_event_command"
position="2"/>
<menuitem id="ltnNewTask2" label="&event.new.todo;"
accesskey="&event.new.todo.accesskey;"
key="newTaskKey"
observes="calendar_new_todo_command"
position="3"/>
<menuseparator id="firstCalendarSeparator" mode="calendar"/>
<menuitem id="subscribeCalendar"
disabled="true"
label="&calendar.subscribeshort.label;"
accesskey="&calendar.subscribeshort.accesskey;"
oncommand="openWcapSubscriptionsDialog();"/>
<menuitem id="publishCalendar"
label="&calendar.publish.label;"
accesskey="&calendar.publish.accesskey;"
observes="calendar_publish_calendar"/>
<menuseparator id="afterSubscription"/>
<menuitem label="&calendar.context.newserver.label;"
id="calpopup-new"
accesskey="&calendar.context.newserver.accesskey;"
observes="calendar_new_calendar_command"/>
<menuitem id="ltnDeleteSelectedCalendar"
label="&calendar.context.deleteserver.label;"
accesskey="&calendar.context.deleteserver.accesskey;"
observes="calendar_delete_calendar_command"/>
<menuseparator id="beforeProperties"/>
<menuitem label="&calendar.properties.label;"
id="calendarproperties"
accesskey="&calendar.properties.accesskey;"
observes="calendar_edit_calendar_command"/>
</menupopup>
<menu id="ltnCalendarMenu" label="&lightning.calendar.label;"
accesskey="&lightning.calendar.accesskey;"
mode="calendar">
</menu>
</popupset>
<tooltip id="itemTooltip" noautohide="true"/>
@ -312,7 +446,8 @@
class="chromeclass-toolbar"
customizable="true"
defaultset="mail-switch-button,calendar-switch-button,task-switch-button,spring"
context="mode-toolbar-context-menu"/>
context="mode-toolbar-context-menu"
persist="collapsed"/>
<toolbarset id="custom-toolbars"/>
</toolbox>

Просмотреть файл

@ -97,8 +97,14 @@ function ltnSwitch2Mail() {
switch2task.removeAttribute("checked");
gCurrentMode = 'mail';
swapPopupMenus();
var mailToolbar = getMailBar();
var mailToolbarMenuItem = document.getElementById("menu_showMessengerToolbar");
if (mailToolbarMenuItem.getAttribute("checked") == "true") {
mailToolbar.removeAttribute("collapsed");
}
var calendarToolbar = document.getElementById("calendar-toolbar");
mailToolbar.removeAttribute("collapsed");
calendarToolbar.setAttribute("collapsed", "true");
@ -146,11 +152,13 @@ function ltnSwitch2Calendar() {
switch2task.removeAttribute("checked");
gCurrentMode = 'calendar';
swapPopupMenus();
var mailToolbar = getMailBar();
var calendarToolbar = document.getElementById("calendar-toolbar");
mailToolbar.setAttribute("collapsed", "true");
calendarToolbar.removeAttribute("collapsed");
toggleControlDisplay("cmd_toggleCalendarToolbar", "calendar-toolbar", "calendar");
// the content deck should display the calendar panel
var contentDeck = document.getElementById("contentPanel");

Просмотреть файл

@ -180,7 +180,9 @@
customizable="true"
context="toolbar-context-menu"
collapsed="true"
defaultset="calendar-new-event-button,calendar-new-task-button,separator,calendar-go-to-today-button,separator,calendar-day-view-button,calendar-week-view-button,calendar-multiweek-view-button,calendar-month-view-button,separator,calendar-delete-event-button,calendar-print-button,separator,calendar-remote-reload-button,spring"/>
collapsedinMode="false"
defaultset="calendar-new-event-button,calendar-new-task-button,separator,calendar-go-to-today-button,separator,calendar-day-view-button,calendar-week-view-button,calendar-multiweek-view-button,calendar-month-view-button,separator,calendar-delete-event-button,calendar-print-button,separator,calendar-remote-reload-button,spring"
persist="collapsedinMode"/>
</toolbox>
</overlay>