customizable toolbars for sunbird

bug 234373, r=mostafah
This commit is contained in:
mvl%exedo.nl 2004-07-15 15:21:00 +00:00
Родитель 2ebd61764c
Коммит 63850c28a9
8 изменённых файлов: 200 добавлений и 58 удалений

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

@ -249,6 +249,9 @@ function calendarInit()
//All is settled, enable feedbacks to observers
gICalLib.batchMode = false;
var toolbox = document.getElementById("calendar-toolbox");
toolbox.customizeDone = CalendarToolboxCustomizeDone;
}
// Set the date and time on the clock and set up a timeout to refresh the clock when the
@ -1599,3 +1602,30 @@ function srGetStrBundle(path)
}
return strBundle;
}
function CalendarCustomizeToolbar()
{
// Disable the toolbar context menu items
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", true);
var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.setAttribute("disabled", "true");
window.openDialog("chrome://calendar/content/customizeToolbar.xul", "CustomizeToolbar",
"chrome,all,dependent", document.getElementById("calendar-toolbox"));
}
function CalendarToolboxCustomizeDone(aToolboxChanged)
{
// Re-enable parts of the UI we disabled during the dialog
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", false);
var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.removeAttribute("disabled");
// XXX Shouldn't have to do this, but I do
window.focus();
}

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

@ -294,6 +294,12 @@
<!-- Window Title -->
<!ENTITY window.title "Mozilla Calendar">
<!-- customizable toolbars -->
<!ENTITY calendar.context.customize.label "Customize">
<!ENTITY calendar.context.customize.accesskey "C">
<!ENTITY calendar.maintoolbar.name "Main Toolbar">
<!ENTITY calendar.maintoolbar.accesskey "M">
<!-- Context Menu -->
<!ENTITY calendar.context.newevent.label "New Event">
<!ENTITY calendar.context.newevent.accesskey "N">

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

@ -64,6 +64,7 @@
.toolbarbutton-1 {
list-style-image: url("chrome://calendar/skin/btn1.png");
-moz-box-orient: vertical;
}

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

@ -41,7 +41,7 @@
// pref("startup.homepage_override_url","chrome://browser-region/locale/region.properties");
pref("general.startup.calendar", true);
pref("browser.chromeURL","chrome://browser/content/");
pref("browser.chromeURL","chrome://calendar/content/");
pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul");
pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
pref("xpinstall.dialog.progress", "chrome://mozapps/content/downloads/downloads.xul");

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

@ -47,7 +47,6 @@
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/skin/calendar.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/minimonth.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/communicator.css" type="text/css"?>
<!-- Overlays -->
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
@ -132,6 +131,8 @@
<command id="close_calendar_command" key="key_close" oncommand="closeCalendar()"/>
<command id="wizard_command" oncommand="launchWizard()" collapsed="true"/>
<command id="cmd_CustomizeToolbars" oncommand="CalendarCustomizeToolbar()"/>
</commandset>
<keyset>
@ -403,14 +404,23 @@
observes="publish_calendar"/>
</popup>
<popup id="toolbar-context-menu">
<menuitem command="cmd_CustomizeToolbars"
label="&calendar.context.customize.label;"
accesskey="&calendar.context.customize.accesskey;"/>
</popup>
<commandset id="commands"/>
<toolbox id="calendar-toolbox" class="toolbox-top" deferattached="true">
<toolbox id="calendar-toolbox" class="toolbox-top">
<!-- Menu -->
<menubar id="main-menubar" persist="collapsed"/>
<toolbar type="menubar" id="main-menubar" class="chromeclass-menubar" customizable="true"
defaultset="menubar-items"
mode="icons" iconsize="small" context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center"/>
</toolbar>
<toolbar class="toolbar-primary chromeclass-toolbar" id="calendar-bar" persist="collapsed" tbalign="stretch">
<!--<toolbarbutton class="toolbarbutton-1" id="calendar-new-task-button" label="&calendar.newtask.button.label;" tooltiptext="&calendar.newtask.button.tooltip;" observes="new_todo_command"/>-->
<toolbarpalette id="calendarToolbarPalette">
<toolbarbutton class="toolbarbutton-1"
id="calendar-new-event-button"
label="&calendar.newevent.button.label;"
@ -426,7 +436,6 @@
label="&calendar.delete.button.label;"
tooltiptext="&calendar.delete.button.tooltip;"
observes="delete_command"/>
<toolbarseparator class="toolbarseparator-primary"/>
<toolbarbutton class="toolbarbutton-1"
id="calendar-day-view-button"
label="&calendar.dayview.button.label;"
@ -448,14 +457,19 @@
tooltiptext="&calendar.monthview.button.tooltip;"
observes="month_view_command"/>
<spacer flex="1"/>
<toolbaritem id="throbber-box" align="center" pack="center">
<button id="navigator-throbber2"
oncommand="openAboutDialog();"
tooltiptext="&aboutCmd.label;"/>
</toolbaritem>
</toolbar>
</toolbarpalette>
<toolbar class="toolbar-primary chromeclass-toolbar" id="calendar-bar"
iconsize="big"
defaultset="calendar-new-event-button,calendar-edit-event-button,calendar-delete-event-button,separator,calendar-day-view-button,calendar-week-view-button,calendar-multiweek-view-button,calendar-month-view-button,spring,throbber-box"
customizable="true" mode="full"
toolbarname="&calendar.maintoolbar.name;" accesskey="&calendar.maintoolbar.accesskey;"
context="toolbar-context-menu"/>
<toolbarset id="customToolbars" context="toolbar-context-menu"/>
</toolbox>
<tooltip id="eventTreeListTooltip" onpopupshowing="changeToolTipTextForEvent( event );return( checkTooltip( event ) );"/>
@ -527,10 +541,7 @@
</tabpanel>
</tabpanels>
</tabbox>
<splitter id="calendar-todo-splitter" collapse="before" persist="state"
class="chromeclass-extrachrome" orient="vertical">
<grippy/>
</splitter>
<splitter id="calendar-todo-splitter" collapse="before" persist="state" orient="vertical"/>
<vbox id="left-hand-below-splitter" flex="1" persist="height">
<box align="left">
<label flex="1" crop="end" style="font-weight: bold" value="&calendar.unifinder.todoitems.label;"/>
@ -595,9 +606,8 @@
</vbox>
<splitter id="calendar-splitter" collapse="before" persist="state"
class="chromeclass-extrachrome sidebar-splitter" orient="horizontal" onmouseup="setTimeout( 'gCalendarWindow.onMouseUpCalendarSplitter()', 1 );">
<grippy class="sidebar-splitter-grippy"/>
</splitter>
class="chromeclass-extrachrome sidebar-splitter" orient="horizontal"
onmouseup="setTimeout( 'gCalendarWindow.onMouseUpCalendarSplitter()', 1 );"/>
<vbox flex="1">
<vbox id="bottom-events-box" persist="height">

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

@ -0,0 +1,93 @@
<?xml version="1.0"?>
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# David Hyatt (hyatt@apple.com)
# Blake Ross (blaker@netscape.com)
<!DOCTYPE dialog [
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
]>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/customizeToolbar.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/customizeToolbar.css" type="text/css"?>
<window id="CustomizeToolbarWindow"
title="&dialog.title;"
onload="onLoad();"
onunload="onUnload();"
onclose="onAccept(); return false;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
<![CDATA[
toolbox = window.arguments[0];
toolboxDocument = toolbox.ownerDocument;
var sheetList = toolboxDocument.styleSheets;
for (var i=0; i < sheetList.length; ++i) {
var newPI = document.createProcessingInstruction("xml-stylesheet", 'href="'+sheetList[i].href+'" type="text/css"');
document.insertBefore(newPI, document.firstChild);
}
]]>
</script>
<script type="application/x-javascript" src="chrome://global/content/customizeToolbar.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<stringbundle id="stringBundle" src="chrome://global/locale/customizeToolbar.properties"/>
<vbox id="main-box" flex="1" collapsed="true">
<description id="instructions">
&instructions.description;
</description>
<vbox flex="1" id="palette-box"
ondraggesture="gDraggingFromPalette = true; nsDragAndDrop.startDrag(event, dragStartObserver);"
ondragover="nsDragAndDrop.dragOver(event, paletteDNDObserver);"
ondragdrop="nsDragAndDrop.drop(event, paletteDNDObserver);"/>
<box align="center">
<label value="&show.label;"/>
<menulist id="modelist" value="icons" oncommand="updateToolbarMode(this.value);">
<menupopup>
<menuitem value="full" label="&iconsAndText.label;"/>
<menuitem value="icons" label="&icons.label;"/>
<menuitem value="text" label="&text.label;"/>
</menupopup>
</menulist>
<checkbox id="smallicons" oncommand="updateIconSize(this.checked);" label="&useSmallIcons.label;"/>
<button label="&addNewToolbar.label;" oncommand="addNewToolbar();"/>
<button label="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();"/>
</box>
<separator class="groove"/>
<hbox align="center" pack="end">
<button label="&saveChanges.label;" oncommand="onAccept();" default="true"/>
</hbox>
</vbox>
</window>

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

@ -89,11 +89,12 @@
<!-- Menu -->
<menubar id="main-menubar" class="chromeclass-menubar">
<menu id="menu_File"
label="&fileMenu.label;"
accesskey="&fileMenu.accesskey;">
<menupopup id="menu_FilePopup">
<toolbaritem id="menubar-items">
<menubar id="main-menubar" style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
<menu id="menu_File"
label="&fileMenu.label;"
accesskey="&fileMenu.accesskey;">
<menupopup id="menu_FilePopup">
<menuitem id="calendar-new-event-menu"
key="new_event_key"
label="&event.new.event;"
@ -129,13 +130,13 @@
label="&calendar.print.label;"
accesskey="&calendar.print.accesskey;"
observes="print_command"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="menu_Edit"
label="&editMenu.label;"
accesskey="&editMenu.accesskey;">
<menupopup id="mppEdit">
<menu id="menu_Edit"
label="&editMenu.label;"
accesskey="&editMenu.accesskey;">
<menupopup id="mppEdit">
<menuitem id="calendar-cut-menu"
key="key_cut"
label="&calendar.cut.label;"
@ -166,13 +167,13 @@
label="&calendar.selectall.label;"
accesskey="&calendar.selectall.accesskey;"
observes="select_all_command"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="menu_View"
label="&viewMenu.label;"
accesskey="&viewMenu.accesskey;">
<menupopup id="mppView">
<menu id="menu_View"
label="&viewMenu.label;"
accesskey="&viewMenu.accesskey;">
<menupopup id="mppView">
<menuitem id="calendar-view-menu-day"
key="view_day_key"
label="&calendar.flat.topbar.dayview;"
@ -240,13 +241,13 @@
label="&calendar.menu.numberofweeks.6;"/>
</menupopup>
</menu>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="menu_Go"
label="&goMenu.label;"
accesskey="&goMenu.accesskey;">
<menupopup id="mppView">
<menu id="menu_Go"
label="&goMenu.label;"
accesskey="&goMenu.accesskey;">
<menupopup id="mppView">
<menuitem id="calendar-go-menu-today"
key="go_to_today_key"
label="&goTodayCmd.label;"
@ -267,13 +268,13 @@
label="&goNextCmd.label;"
accesskey="&goNextCmd.accesskey;"
observes="next_command"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="tasksMenu"
label="&toolsMenu.label;"
accesskey="&toolsMenu.accesskey;">
<menupopup id="taskPopup">
<menu id="tasksMenu"
label="&toolsMenu.label;"
accesskey="&toolsMenu.accesskey;">
<menupopup id="taskPopup">
<menuitem id="calendar-wizard-menu"
key="wizard_key"
label="&calendar.wizard.label;"
@ -307,14 +308,14 @@
label="&preferencesCmd.label;"
accesskey="&preferencesCmd.accesskey;"
oncommand="openPreferences();"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="menu_Help"
label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;">
<menupopup id="menu_HelpPopup">
<menu id="menu_Help"
label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;">
<menupopup id="menu_HelpPopup">
<menuitem accesskey="&releaseCmd.accesskey;"
label="&releaseCmd.label;"
oncommand="openTopWin('&releaseURL;');"/>
@ -323,8 +324,8 @@
label="&aboutCmd.label;"
accesskey="&aboutCmd.accesskey;"
oncommand="openAboutDialog();"/>
</menupopup>
</menu>
</menubar>
</menupopup>
</menu>
</menubar>
</toolbaritem>
</overlay>

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

@ -1,3 +1,4 @@
calendar.jar:
content/calendar/calendar.xul (content/calendar.xul)
content/calendar/menuOverlay.xul (content/menuOverlay.xul)
content/calendar/calendar.xul (content/calendar.xul)
content/calendar/menuOverlay.xul (content/menuOverlay.xul)
* content/calendar/customizeToolbar.xul (content/customizeToolbar.xul)