Bug 391082 - Use 'customize toolbar'-dialog from toolkit for event dialog, r=philipp
git-svn-id: svn://10.0.0.236/trunk@233390 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1fedfe1e3e
commit
4aca178943
@ -54,7 +54,7 @@ calendar.jar:
|
||||
content/calendar/preferences/views.xul (content/preferences/views.xul)
|
||||
content/calendar/sound.wav (/calendar/resources/content/sound.wav)
|
||||
content/calendar/sun-calendar-event-dialog.css (/calendar/prototypes/wcap/sun-calendar-event-dialog.css)
|
||||
content/calendar/sun-calendar-event-dialog.js (/calendar/prototypes/wcap/sun-calendar-event-dialog.js)
|
||||
* content/calendar/sun-calendar-event-dialog.js (/calendar/prototypes/wcap/sun-calendar-event-dialog.js)
|
||||
content/calendar/sun-calendar-event-dialog.xul (/calendar/prototypes/wcap/sun-calendar-event-dialog.xul)
|
||||
content/calendar/sun-calendar-event-dialog-attendees.xml (/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xml)
|
||||
content/calendar/sun-calendar-event-dialog-freebusy.xml (/calendar/prototypes/wcap/sun-calendar-event-dialog-freebusy.xml)
|
||||
@ -69,8 +69,6 @@ calendar.jar:
|
||||
content/calendar/sun-calendar-event-dialog-timezone.xul (/calendar/prototypes/wcap/sun-calendar-event-dialog-timezone.xul)
|
||||
content/calendar/sun-calendar-event-dialog-attendees.xul (/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.xul)
|
||||
content/calendar/sun-calendar-event-dialog-attendees.js (/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.js)
|
||||
content/calendar/sun-calendar-customize-toolbar.xul (/calendar/prototypes/wcap/sun-calendar-customize-toolbar.xul)
|
||||
content/calendar/sun-calendar-customize-toolbar.js (/calendar/prototypes/wcap/sun-calendar-customize-toolbar.js)
|
||||
% skin calendar classic/1.0 %skin/classic/calendar/
|
||||
skin/classic/calendar/abcard.png (themes/common/abcard.png)
|
||||
#expand skin/classic/calendar/cal-icon32.png (themes/__THEME__/cal-icon32.png)
|
||||
|
||||
@ -69,8 +69,14 @@ initDialog = function()
|
||||
|
||||
// set the toolbar selection according to the current mode.
|
||||
// this list allows to hop from one toolbar to another without
|
||||
// leaving the customize dialog.
|
||||
document.getElementById("selector-list").value = window.arguments[3];
|
||||
// leaving the customize dialog. if this feature is to be used outside
|
||||
// of mail/news main application window, we detect this case and disable
|
||||
// all relevant controls and stuff.
|
||||
var selectorList = document.getElementById("selector-list");
|
||||
selectorList.value = window.arguments[3];
|
||||
if (selectorList.selectedItem.value != window.arguments[3]) {
|
||||
document.getElementById("selector-container").collapsed = true;
|
||||
}
|
||||
|
||||
// now call the original initDialog() function
|
||||
gInitDialog();
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
src="chrome://lightning/content/customize-toolbar.js"/>
|
||||
|
||||
<vbox id="main-box" flex="1" collapsed="true">
|
||||
<box orient="vertical" insertbefore="instructions">
|
||||
<box id="selector-container" orient="vertical" insertbefore="instructions">
|
||||
<box align="center" orient="horizontal">
|
||||
<label value="&customize.toolbar.selector.label;"/>
|
||||
<menulist id="selector-list"
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://calendar/skin/calendar-toolbar.css" type="text/css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://calendar/skin/calendar-toolbar.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://calendar/skin/sun-calendar-event-dialog.css"?>
|
||||
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" />
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
<!ENTITY event.menu.view.label "View">
|
||||
<!ENTITY event.menu.view.toolbars.label "Toolbars">
|
||||
<!ENTITY event.menu.view.toolbars.event.label "Event Toolbar">
|
||||
<!ENTITY event.menu.view.toolbars.customize.label "Customize">
|
||||
<!ENTITY event.menu.view.toolbars.customize.label "Customize...">
|
||||
|
||||
<!ENTITY event.menu.options.label "Options">
|
||||
<!ENTITY event.menu.options.spellcheck.label "Check Spelling…">
|
||||
|
||||
@ -1,91 +1,203 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Buettner <michael.buettner@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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog toolbar buttons
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.cal-toolbarbutton-2 {
|
||||
-moz-box-orient: vertical;
|
||||
min-width: 0px;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
}
|
||||
|
||||
toolbar[mode="full"] .cal-toolbarbutton-2 {
|
||||
min-width: 55px;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog toolbar buttons - small
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
toolbar[iconsize="small"] .cal-toolbarbutton-2 {
|
||||
-moz-box-orient: vertical;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* invite attendees button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #1 */
|
||||
#button-attendees {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 64px 32px 32px);
|
||||
}
|
||||
#button-attendees:hover:active {
|
||||
-moz-image-region: rect(32px 64px 64px 32px);
|
||||
}
|
||||
#button-attendees[disabled="true"] {
|
||||
#button-attendees[disabled="true"],
|
||||
#button-attendees[disabled="true"]:hover,
|
||||
#button-attendees[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 64px 96px 32px);
|
||||
}
|
||||
#button-attendees:hover {
|
||||
-moz-image-region: rect(32px 64px 64px 32px);
|
||||
}
|
||||
#button-attendees:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* spellcheck button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #2 */
|
||||
#button-spellcheck {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 96px 32px 64px);
|
||||
}
|
||||
#button-spellcheck:hover:active {
|
||||
-moz-image-region: rect(32px 96px 64px 64px);
|
||||
}
|
||||
#button-spellcheck[disabled="true"] {
|
||||
#button-spellcheck[disabled="true"],
|
||||
#button-spellcheck[disabled="true"]:hover,
|
||||
#button-spellcheck[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 96px 96px 64px);
|
||||
}
|
||||
#button-spellcheck:hover {
|
||||
-moz-image-region: rect(32px 96px 64px 64px);
|
||||
}
|
||||
#button-spellcheck:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* documents button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #10 */
|
||||
#button-url {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 128px 32px 96px);
|
||||
}
|
||||
#button-url:hover:active {
|
||||
-moz-image-region: rect(32px 128px 64px 96px);
|
||||
}
|
||||
#button-url[disabled="true"] {
|
||||
#button-url[disabled="true"],
|
||||
#button-url[disabled="true"]:hover,
|
||||
#button-url[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 128px 96px 96px);
|
||||
}
|
||||
#button-url:hover {
|
||||
-moz-image-region: rect(32px 128px 64px 96px);
|
||||
}
|
||||
#button-url:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #4 */
|
||||
#button-privacy {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 160px 32px 128px);
|
||||
}
|
||||
#button-privacy:hover:active {
|
||||
-moz-image-region: rect(32px 160px 64px 128px);
|
||||
}
|
||||
#button-privacy[disabled="true"] {
|
||||
#button-privacy[disabled="true"],
|
||||
#button-privacy[disabled="true"]:hover,
|
||||
#button-privacy[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 160px 96px 128px);
|
||||
}
|
||||
#button-privacy:hover {
|
||||
-moz-image-region: rect(32px 160px 64px 128px);
|
||||
}
|
||||
#button-privacy:hover:active {
|
||||
}
|
||||
|
||||
/* icon #5 */
|
||||
/*--------------------------------------------------------------------
|
||||
* save button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-save {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 192px 32px 160px);
|
||||
}
|
||||
#button-save:hover:active {
|
||||
-moz-image-region: rect(32px 192px 64px 160px);
|
||||
}
|
||||
#button-save[disabled="true"] {
|
||||
#button-save[disabled="true"],
|
||||
#button-save[disabled="true"]:hover,
|
||||
#button-save[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 192px 96px 160px);
|
||||
}
|
||||
#button-save:hover {
|
||||
-moz-image-region: rect(32px 192px 64px 160px);
|
||||
}
|
||||
#button-save:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* print button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #18 */
|
||||
#button-print {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 608px 32px 576px);
|
||||
}
|
||||
#button-print:hover:active {
|
||||
-moz-image-region: rect(32px 608px 64px 576px);
|
||||
}
|
||||
#button-print[disabled="true"] {
|
||||
#button-print[disabled="true"],
|
||||
#button-print[disabled="true"]:hover,
|
||||
#button-print[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 608px 96px 576px);
|
||||
}
|
||||
#button-print:hover {
|
||||
-moz-image-region: rect(32px 608px 64px 576px);
|
||||
}
|
||||
#button-print:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* help button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #23 */
|
||||
#button-question {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 768px 32px 736px);
|
||||
}
|
||||
#button-question:hover:active {
|
||||
-moz-image-region: rect(32px 768px 64px 736px);
|
||||
}
|
||||
#button-question[disabled="true"] {
|
||||
#button-question[disabled="true"],
|
||||
#button-question[disabled="true"]:hover,
|
||||
#button-question[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(64px 768px 96px 736px);
|
||||
}
|
||||
#button-question:hover {
|
||||
-moz-image-region: rect(32px 768px 64px 736px);
|
||||
}
|
||||
#button-question:hover:active {
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog statusbar images
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.cal-statusbar-1 {
|
||||
-moz-box-orient: vertical;
|
||||
min-width: 0px;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "public" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #0 */
|
||||
#button-privacy-public {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
}
|
||||
#button-privacy-public:hover:active {
|
||||
@ -95,63 +207,62 @@
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
}
|
||||
|
||||
/* icon #1 */
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "private" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy-private {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
#button-privacy-private:hover:active {
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
#button-privacy-private[disabled="true"] {
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
|
||||
/* icon #2 */
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "confidential" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy-confidential {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
#button-privacy-confidential:hover:active {
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
#button-privacy-confidential[disabled="true"] {
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
|
||||
/* icon #3 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "low" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-low {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
#button-importance-low:hover:active {
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
#button-importance-low[disabled="true"] {
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
|
||||
/* icon #4 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "medium" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-medium {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
#button-importance-medium:hover:active {
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
#button-importance-medium[disabled="true"] {
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
|
||||
/* icon #5 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "high" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-high {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
#button-importance-high:hover:active {
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
#button-importance-high[disabled="true"] {
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
|
||||
|
||||
@ -1,156 +1,266 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Sun Microsystems code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Buettner <michael.buettner@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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog toolbar buttons
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.cal-toolbarbutton-2 {
|
||||
-moz-box-orient: vertical;
|
||||
min-width: 0px;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
}
|
||||
|
||||
toolbar[mode="full"] .cal-toolbarbutton-2 {
|
||||
min-width: 55px;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog toolbar buttons - small
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
toolbar[iconsize="small"] .cal-toolbarbutton-2 {
|
||||
-moz-box-orient: vertical;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* invite attendees button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* icon #1 */
|
||||
#button-attendees {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 48px 24px 24px);
|
||||
-moz-image-region: rect(0px 48px 24px 24px);
|
||||
}
|
||||
#button-attendees[disabled="true"],
|
||||
#button-attendees[disabled="true"]:hover,
|
||||
#button-attendees[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 48px 72px 24px);
|
||||
}
|
||||
#button-attendees:hover {
|
||||
-moz-image-region: rect(24px 48px 48px 24px);
|
||||
}
|
||||
#button-attendees:hover:active {
|
||||
-moz-image-region: rect(24px 48px 48px 24px);
|
||||
}
|
||||
#button-attendees[disabled="true"] {
|
||||
-moz-image-region: rect(48px 48px 72px 24px);
|
||||
}
|
||||
|
||||
/* icon #2 */
|
||||
/*--------------------------------------------------------------------
|
||||
* spellcheck button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-spellcheck {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 72px 24px 48px);
|
||||
-moz-image-region: rect(0px 72px 24px 48px);
|
||||
}
|
||||
#button-spellcheck[disabled="true"],
|
||||
#button-spellcheck[disabled="true"]:hover,
|
||||
#button-spellcheck[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 72px 72px 48px);
|
||||
}
|
||||
#button-spellcheck:hover {
|
||||
-moz-image-region: rect(24px 72px 48px 48px);
|
||||
}
|
||||
#button-spellcheck:hover:active {
|
||||
-moz-image-region: rect(24px 72px 48px 48px);
|
||||
}
|
||||
#button-spellcheck[disabled="true"] {
|
||||
-moz-image-region: rect(48px 72px 72px 48px);
|
||||
}
|
||||
|
||||
/* icon #3 */
|
||||
/*--------------------------------------------------------------------
|
||||
* documents button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-url {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 96px 24px 72px);
|
||||
-moz-image-region: rect(0px 96px 24px 72px);
|
||||
}
|
||||
#button-url[disabled="true"],
|
||||
#button-url[disabled="true"]:hover,
|
||||
#button-url[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 96px 72px 72px);
|
||||
}
|
||||
#button-url:hover {
|
||||
-moz-image-region: rect(24px 96px 48px 72px);
|
||||
}
|
||||
#button-url:hover:active {
|
||||
-moz-image-region: rect(24px 96px 48px 72px);
|
||||
}
|
||||
#button-url[disabled="true"] {
|
||||
-moz-image-region: rect(48px 96px 72px 72px);
|
||||
}
|
||||
|
||||
/* icon #4 */
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 120px 24px 96px);
|
||||
-moz-image-region: rect(0px 120px 24px 96px);
|
||||
}
|
||||
#button-privacy[disabled="true"],
|
||||
#button-privacy[disabled="true"]:hover,
|
||||
#button-privacy[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 120px 72px 96px);
|
||||
}
|
||||
#button-privacy:hover {
|
||||
-moz-image-region: rect(24px 120px 48px 96px);
|
||||
}
|
||||
#button-privacy:hover:active {
|
||||
-moz-image-region: rect(24px 120px 48px 96px);
|
||||
}
|
||||
#button-privacy[disabled="true"] {
|
||||
-moz-image-region: rect(48px 120px 72px 96px);
|
||||
}
|
||||
|
||||
/* icon #5 */
|
||||
/*--------------------------------------------------------------------
|
||||
* save button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-save {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 144px 24px 120px);
|
||||
-moz-image-region: rect(0px 144px 24px 120px);
|
||||
}
|
||||
#button-save[disabled="true"],
|
||||
#button-save[disabled="true"]:hover,
|
||||
#button-save[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 144px 72px 120px);
|
||||
}
|
||||
#button-save:hover {
|
||||
-moz-image-region: rect(24px 144px 48px 120px);
|
||||
}
|
||||
#button-save:hover:active {
|
||||
-moz-image-region: rect(24px 144px 48px 120px);
|
||||
}
|
||||
#button-save[disabled="true"] {
|
||||
-moz-image-region: rect(48px 144px 72px 120px);
|
||||
}
|
||||
|
||||
/* icon #18 */
|
||||
/*--------------------------------------------------------------------
|
||||
* print button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-print {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 456px 24px 432px);
|
||||
-moz-image-region: rect(0px 456px 24px 432px);
|
||||
}
|
||||
#button-print[disabled="true"],
|
||||
#button-print[disabled="true"]:hover,
|
||||
#button-print[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 456px 72px 432px);
|
||||
}
|
||||
#button-print:hover {
|
||||
-moz-image-region: rect(24px 456px 48px 432px);
|
||||
}
|
||||
#button-print:hover:active {
|
||||
-moz-image-region: rect(24px 456px 48px 432px);
|
||||
}
|
||||
#button-print[disabled="true"] {
|
||||
-moz-image-region: rect(48px 456px 72px 432px);
|
||||
}
|
||||
|
||||
/* icon #23 */
|
||||
/*--------------------------------------------------------------------
|
||||
* help button
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-question {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog-toolbar.png");
|
||||
-moz-image-region: rect(0px 576px 24px 552px);
|
||||
-moz-image-region: rect(0px 576px 24px 552px);
|
||||
}
|
||||
#button-question[disabled="true"],
|
||||
#button-question[disabled="true"]:hover,
|
||||
#button-question[disabled="true"]:hover:active {
|
||||
-moz-image-region: rect(48px 576px 72px 552px);
|
||||
}
|
||||
#button-question:hover {
|
||||
-moz-image-region: rect(24px 576px 48px 552px);
|
||||
}
|
||||
#button-question:hover:active {
|
||||
-moz-image-region: rect(24px 576px 48px 552px);
|
||||
}
|
||||
#button-question[disabled="true"] {
|
||||
-moz-image-region: rect(48px 576px 72px 552px);
|
||||
}
|
||||
|
||||
/* icon #0 */
|
||||
/*--------------------------------------------------------------------
|
||||
* Event dialog statusbar images
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.cal-statusbar-1 {
|
||||
-moz-box-orient: vertical;
|
||||
min-width: 0px;
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "public" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy-public {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
}
|
||||
#button-privacy-public:hover:active {
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
}
|
||||
#button-privacy-public[disabled="true"] {
|
||||
-moz-image-region: rect(0px 28px 16px 0px);
|
||||
}
|
||||
|
||||
/* icon #1 */
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "private" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy-private {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
#button-privacy-private:hover:active {
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
#button-privacy-private[disabled="true"] {
|
||||
-moz-image-region: rect(0px 56px 16px 28px);
|
||||
}
|
||||
|
||||
/* icon #2 */
|
||||
/*--------------------------------------------------------------------
|
||||
* privacy "confidential" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-privacy-confidential {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
#button-privacy-confidential:hover:active {
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
#button-privacy-confidential[disabled="true"] {
|
||||
-moz-image-region: rect(0px 84px 16px 56px);
|
||||
}
|
||||
|
||||
/* icon #3 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "low" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-low {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
#button-importance-low:hover:active {
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
#button-importance-low[disabled="true"] {
|
||||
-moz-image-region: rect(0px 100px 16px 84px);
|
||||
}
|
||||
|
||||
/* icon #4 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "medium" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-medium {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
#button-importance-medium:hover:active {
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
#button-importance-medium[disabled="true"] {
|
||||
-moz-image-region: rect(0px 116px 16px 100px);
|
||||
}
|
||||
|
||||
/* icon #5 */
|
||||
/*--------------------------------------------------------------------
|
||||
* importance "high" image
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
#button-importance-high {
|
||||
list-style-image: url("chrome://calendar/skin/sun-calendar-event-dialog.png");
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
#button-importance-high:hover:active {
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
#button-importance-high[disabled="true"] {
|
||||
-moz-image-region: rect(0px 132px 16px 116px);
|
||||
}
|
||||
|
||||
@ -1,968 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 David Hyatt.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@apple.com>
|
||||
* Blake Ross <blaker@netscape.com>
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
* Michael Buettner <michael.buettner@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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const kRowMax = 4;
|
||||
const kWindowWidth = 600;
|
||||
const kWindowHeight = 400;
|
||||
const kAnimateIncrement = 50;
|
||||
const kAnimateSteps = kWindowHeight / kAnimateIncrement - 1;
|
||||
const kVSizeSlop = 5;
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
var gToolboxDocument = null;
|
||||
var gToolbox = null;
|
||||
var gCurrentDragOverItem = null;
|
||||
var gToolboxChanged = false;
|
||||
|
||||
function onLoad() {
|
||||
gToolbox = window.arguments[0];
|
||||
gToolboxDocument = gToolbox.ownerDocument;
|
||||
|
||||
gToolbox.addEventListener("draggesture", onToolbarDragGesture, false);
|
||||
gToolbox.addEventListener("dragover", onToolbarDragOver, false);
|
||||
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
|
||||
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
|
||||
repositionDialog();
|
||||
|
||||
initDialog();
|
||||
}
|
||||
|
||||
function onUnload(aEvent) {
|
||||
removeToolboxListeners();
|
||||
unwrapToolbarItems();
|
||||
persistCurrentSets();
|
||||
|
||||
notifyParentComplete();
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
// restore the saved toolbarset for each customizeable toolbar
|
||||
// Restore the defaultset for fixed toolbars.
|
||||
var toolbar = gToolbox.firstChild;
|
||||
while (toolbar) {
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
if (!toolbar.hasAttribute("customindex")) {
|
||||
var previousset = toolbar.getAttribute("previousset");
|
||||
if (previousset) {
|
||||
toolbar.currentSet = previousset;
|
||||
}
|
||||
}
|
||||
}
|
||||
toolbar = toolbar.nextSibling;
|
||||
}
|
||||
|
||||
// Now rebuild the palette.
|
||||
buildPalette();
|
||||
|
||||
// Now re-wrap the items on the toolbar.
|
||||
wrapToolbarItems();
|
||||
|
||||
repositionDialog();
|
||||
gToolboxChanged = true;
|
||||
|
||||
// We restored the default toolbar, act like a normal accept event now.
|
||||
return onAccept();
|
||||
}
|
||||
|
||||
function onAccept(aEvent) {
|
||||
document.getElementById("main-box").collapsed = true;
|
||||
window.close();
|
||||
}
|
||||
|
||||
function initDialog() {
|
||||
document.getElementById("main-box").collapsed = false;
|
||||
|
||||
var mode = gToolbox.getAttribute("mode");
|
||||
document.getElementById("modelist").value = mode;
|
||||
var iconSize = gToolbox.getAttribute("iconsize");
|
||||
var smallIconsCheckbox = document.getElementById("smallicons");
|
||||
if (mode == "text") {
|
||||
smallIconsCheckbox.disabled = true;
|
||||
} else {
|
||||
smallIconsCheckbox.checked = (iconSize == "small");
|
||||
}
|
||||
|
||||
// Build up the palette of other items.
|
||||
buildPalette();
|
||||
|
||||
// Wrap all the items on the toolbar in toolbarpaletteitems.
|
||||
wrapToolbarItems();
|
||||
}
|
||||
|
||||
function repositionDialog() {
|
||||
// Position the dialog touching the bottom of the toolbox and centered with
|
||||
// it. We must resize the window smaller first so that it is positioned
|
||||
// properly.
|
||||
var screenX = gToolbox.boxObject.screenX +
|
||||
((gToolbox.boxObject.width - kWindowWidth) / 2);
|
||||
var screenY = gToolbox.boxObject.screenY + gToolbox.boxObject.height;
|
||||
|
||||
var newHeight = Math.min(kWindowHeight,
|
||||
screen.availHeight - screenY - kVSizeSlop);
|
||||
|
||||
window.resizeTo(kWindowWidth, newHeight);
|
||||
window.moveTo(screenX, screenY);
|
||||
}
|
||||
|
||||
function removeToolboxListeners() {
|
||||
gToolbox.removeEventListener("draggesture", onToolbarDragGesture, false);
|
||||
gToolbox.removeEventListener("dragover", onToolbarDragOver, false);
|
||||
gToolbox.removeEventListener("dragexit", onToolbarDragExit, false);
|
||||
gToolbox.removeEventListener("dragdrop", onToolbarDragDrop, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke a callback on the toolbox to notify it that the dialog is done
|
||||
* and going away.
|
||||
*/
|
||||
function notifyParentComplete() {
|
||||
if ("customizeDone" in gToolbox) {
|
||||
gToolbox.customizeDone(gToolboxChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function getToolbarAt(i) {
|
||||
return gToolbox.childNodes[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the current set of buttons in all customizable toolbars to
|
||||
* localstore.
|
||||
*/
|
||||
function persistCurrentSets() {
|
||||
if (!gToolboxChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
var customCount = 0;
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
// Look for customizable toolbars that need to be persisted.
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
// Calculate currentset and store it in the attribute.
|
||||
var currentSet = toolbar.currentSet;
|
||||
toolbar.setAttribute("currentset", currentSet);
|
||||
|
||||
var customIndex = toolbar.hasAttribute("customindex");
|
||||
if (customIndex) {
|
||||
if (!toolbar.firstChild) {
|
||||
// Remove custom toolbars whose contents have been removed.
|
||||
gToolbox.removeChild(toolbar);
|
||||
--i;
|
||||
} else {
|
||||
// Persist custom toolbar info on the <toolbarset/>
|
||||
gToolbox.toolbarset.setAttribute("toolbar" +
|
||||
(++customCount),
|
||||
toolbar.toolbarName + ":" +
|
||||
currentSet);
|
||||
gToolboxDocument.persist(gToolbox.toolbarset.id,
|
||||
"toolbar" + customCount);
|
||||
}
|
||||
} else {
|
||||
// Persist the currentset attribute directly on hardcoded
|
||||
// toolbars.
|
||||
gToolboxDocument.persist(toolbar.id, "currentset");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove toolbarX attributes for removed toolbars.
|
||||
while (gToolbox.toolbarset.hasAttribute("toolbar" + (++customCount))) {
|
||||
gToolbox.toolbarset.removeAttribute("toolbar" + customCount);
|
||||
gToolboxDocument.persist(gToolbox.toolbarset.id,
|
||||
"toolbar" + customCount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps all items in all customizable toolbars in a toolbox.
|
||||
*/
|
||||
function wrapToolbarItems() {
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
// Save off the current set for each toolbar in case the user hits
|
||||
// cancel.
|
||||
toolbar.setAttribute('previousset', toolbar.currentSet);
|
||||
|
||||
for (var k = 0; k < toolbar.childNodes.length; ++k) {
|
||||
var item = toolbar.childNodes[k];
|
||||
if (isToolbarItem(item)) {
|
||||
var nextSibling = item.nextSibling;
|
||||
|
||||
var wrapper = wrapToolbarItem(item);
|
||||
if (nextSibling) {
|
||||
toolbar.insertBefore(wrapper, nextSibling);
|
||||
} else {
|
||||
toolbar.appendChild(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unwraps all items in all customizable toolbars in a toolbox.
|
||||
*/
|
||||
function unwrapToolbarItems() {
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
// remove previous set attribute
|
||||
toolbar.removeAttribute('previousset');
|
||||
|
||||
for (var k = 0; k < toolbar.childNodes.length; ++k) {
|
||||
var paletteItem = toolbar.childNodes[k];
|
||||
var toolbarItem = paletteItem.firstChild;
|
||||
|
||||
if (isToolbarItem(toolbarItem)) {
|
||||
var nextSibling = paletteItem.nextSibling;
|
||||
|
||||
if (paletteItem.hasAttribute("itemcommand")) {
|
||||
var command = paletteItem.getAttribute("itemcommand");
|
||||
toolbarItem.setAttribute("command", command);
|
||||
}
|
||||
if (paletteItem.hasAttribute("itemobserves")) {
|
||||
var observes = paletteItem.getAttribute("itemobserves");
|
||||
toolbarItem.setAttribute("observes", observes);
|
||||
}
|
||||
|
||||
paletteItem.removeChild(toolbarItem);
|
||||
paletteItem.parentNode.removeChild(paletteItem);
|
||||
|
||||
if (nextSibling) {
|
||||
toolbar.insertBefore(toolbarItem, nextSibling);
|
||||
} else {
|
||||
toolbar.appendChild(toolbarItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wrapper that can be used to contain a toolbaritem and prevent
|
||||
* it from receiving UI events.
|
||||
*/
|
||||
function createWrapper(aId) {
|
||||
var wrapper = document.createElementNS(kXULNS, "toolbarpaletteitem");
|
||||
|
||||
wrapper.id = "wrapper-" + aId;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an item that has been cloned from a template and adds
|
||||
* it to the end of a row in the palette.
|
||||
*/
|
||||
function wrapPaletteItem(aPaletteItem, aCurrentRow, aSpacer) {
|
||||
var wrapper = createWrapper(aPaletteItem.id);
|
||||
|
||||
wrapper.setAttribute("flex", 1);
|
||||
wrapper.setAttribute("align", "center");
|
||||
wrapper.setAttribute("pack", "center");
|
||||
wrapper.setAttribute("minheight", "0");
|
||||
wrapper.setAttribute("minwidth", "0");
|
||||
|
||||
wrapper.appendChild(aPaletteItem);
|
||||
|
||||
// XXX We need to call this AFTER the palette item has been appended
|
||||
// to the wrapper or else we crash dropping certain buttons on the
|
||||
// palette due to removal of the command and disabled attributes - JRH
|
||||
cleanUpItemForPalette(aPaletteItem, wrapper);
|
||||
|
||||
if (aSpacer) {
|
||||
aCurrentRow.insertBefore(wrapper, aSpacer);
|
||||
} else {
|
||||
aCurrentRow.appendChild(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an item that is currently on a toolbar and replaces the item
|
||||
* with the wrapper. This is not used when dropping items from the palette,
|
||||
* only when first starting the dialog and wrapping everything on the toolbars.
|
||||
*/
|
||||
function wrapToolbarItem(aToolbarItem) {
|
||||
var wrapper = createWrapper(aToolbarItem.id);
|
||||
|
||||
cleanupItemForToolbar(aToolbarItem, wrapper);
|
||||
wrapper.flex = aToolbarItem.flex;
|
||||
|
||||
if (aToolbarItem.parentNode) {
|
||||
aToolbarItem.parentNode.removeChild(aToolbarItem);
|
||||
}
|
||||
|
||||
wrapper.appendChild(aToolbarItem);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of ids for the current set of items on each toolbar.
|
||||
*/
|
||||
function getCurrentItemIds() {
|
||||
var currentItems = {};
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
var child = toolbar.firstChild;
|
||||
while (child) {
|
||||
if (isToolbarItem(child)) {
|
||||
currentItems[child.id] = 1;
|
||||
}
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the palette of draggable items that are not yet in a toolbar.
|
||||
*/
|
||||
function buildPalette() {
|
||||
// Empty the palette first.
|
||||
var paletteBox = document.getElementById("palette-box");
|
||||
while (paletteBox.lastChild) {
|
||||
paletteBox.removeChild(paletteBox.lastChild);
|
||||
}
|
||||
|
||||
var currentRow = document.createElementNS(kXULNS, "hbox");
|
||||
currentRow.setAttribute("class", "paletteRow");
|
||||
|
||||
// Add the toolbar separator item.
|
||||
var templateNode = document.createElementNS(kXULNS, "toolbarseparator");
|
||||
templateNode.id = "separator";
|
||||
wrapPaletteItem(templateNode, currentRow, null);
|
||||
|
||||
// Add the toolbar spring item.
|
||||
templateNode = document.createElementNS(kXULNS, "toolbarspring");
|
||||
templateNode.id = "spring";
|
||||
templateNode.flex = 1;
|
||||
wrapPaletteItem(templateNode, currentRow, null);
|
||||
|
||||
// Add the toolbar spacer item.
|
||||
templateNode = document.createElementNS(kXULNS, "toolbarspacer");
|
||||
templateNode.id = "spacer";
|
||||
templateNode.flex = 1;
|
||||
wrapPaletteItem(templateNode, currentRow, null);
|
||||
|
||||
var rowSlot = 3;
|
||||
|
||||
var currentItems = getCurrentItemIds();
|
||||
templateNode = gToolbox.palette.firstChild;
|
||||
while (templateNode) {
|
||||
// Check if the item is already in a toolbar before adding it to the
|
||||
// palette.
|
||||
if (!(templateNode.id in currentItems)) {
|
||||
var paletteItem = templateNode.cloneNode(true);
|
||||
|
||||
if (rowSlot == kRowMax) {
|
||||
// Append the old row.
|
||||
paletteBox.appendChild(currentRow);
|
||||
|
||||
// Make a new row.
|
||||
currentRow = document.createElementNS(kXULNS, "hbox");
|
||||
currentRow.setAttribute("class", "paletteRow");
|
||||
rowSlot = 0;
|
||||
}
|
||||
|
||||
++rowSlot;
|
||||
wrapPaletteItem(paletteItem, currentRow, null);
|
||||
}
|
||||
|
||||
templateNode = templateNode.nextSibling;
|
||||
}
|
||||
|
||||
if (currentRow) {
|
||||
fillRowWithFlex(currentRow);
|
||||
paletteBox.appendChild(currentRow);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new palette item for a cloned template node and
|
||||
* adds it to the last slot in the palette.
|
||||
*/
|
||||
function appendPaletteItem(aItem) {
|
||||
var paletteBox = document.getElementById("palette-box");
|
||||
var lastRow = paletteBox.lastChild;
|
||||
var lastSpacer = lastRow.lastChild;
|
||||
|
||||
if (lastSpacer.localName != "spacer") {
|
||||
// The current row is full, so we have to create a new row.
|
||||
lastRow = document.createElementNS(kXULNS, "hbox");
|
||||
lastRow.setAttribute("class", "paletteRow");
|
||||
paletteBox.appendChild(lastRow);
|
||||
|
||||
wrapPaletteItem(aItem, lastRow, null);
|
||||
|
||||
fillRowWithFlex(lastRow);
|
||||
} else {
|
||||
// Decrement the flex of the last spacer or remove it entirely.
|
||||
var flex = lastSpacer.getAttribute("flex");
|
||||
if (flex == 1) {
|
||||
lastRow.removeChild(lastSpacer);
|
||||
lastSpacer = null;
|
||||
} else {
|
||||
lastSpacer.setAttribute("flex", --flex);
|
||||
}
|
||||
|
||||
// Insert the wrapper where the last spacer was.
|
||||
wrapPaletteItem(aItem, lastRow, lastSpacer);
|
||||
}
|
||||
}
|
||||
|
||||
function fillRowWithFlex(aRow) {
|
||||
var remainingFlex = kRowMax - aRow.childNodes.length;
|
||||
if (remainingFlex > 0) {
|
||||
var spacer = document.createElementNS(kXULNS, "spacer");
|
||||
spacer.setAttribute("flex", remainingFlex);
|
||||
aRow.appendChild(spacer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that an item that has been cloned from a template
|
||||
* is stripped of all properties that may adversely affect it's
|
||||
* appearance in the palette.
|
||||
*/
|
||||
function cleanUpItemForPalette(aItem, aWrapper) {
|
||||
aWrapper.setAttribute("place", "palette");
|
||||
setWrapperType(aItem, aWrapper);
|
||||
|
||||
if (aItem.hasAttribute("title")) {
|
||||
aWrapper.setAttribute("title", aItem.getAttribute("title"));
|
||||
} else if (isSpecialItem(aItem)) {
|
||||
var stringBundle = document.getElementById("stringBundle");
|
||||
var title = stringBundle.getString(aItem.id + "Title");
|
||||
aWrapper.setAttribute("title", title);
|
||||
}
|
||||
|
||||
// Remove attributes that screw up our appearance.
|
||||
aItem.removeAttribute("command");
|
||||
aItem.removeAttribute("observes");
|
||||
aItem.removeAttribute("disabled");
|
||||
aItem.removeAttribute("type");
|
||||
|
||||
if (aItem.localName == "toolbaritem" && aItem.firstChild) {
|
||||
aItem.firstChild.removeAttribute("observes");
|
||||
|
||||
// So the throbber doesn't throb in the dialog,
|
||||
// cute as that may be...
|
||||
aItem.firstChild.removeAttribute("busy");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that an item that has been cloned from a template
|
||||
* is stripped of all properties that may adversely affect it's
|
||||
* appearance in the toolbar. Store critical properties on the
|
||||
* wrapper so they can be put back on the item when we're done.
|
||||
*/
|
||||
function cleanupItemForToolbar(aItem, aWrapper) {
|
||||
setWrapperType(aItem, aWrapper);
|
||||
aWrapper.setAttribute("place", "toolbar");
|
||||
|
||||
if (aItem.hasAttribute("command")) {
|
||||
aWrapper.setAttribute("itemcommand", aItem.getAttribute("command"));
|
||||
aItem.removeAttribute("command");
|
||||
}
|
||||
|
||||
if (aItem.hasAttribute("observes")) {
|
||||
aWrapper.setAttribute("itemobserves", aItem.getAttribute("observes"));
|
||||
aItem.removeAttribute("observes");
|
||||
}
|
||||
|
||||
if (aItem.disabled) {
|
||||
aWrapper.setAttribute("itemdisabled", "true");
|
||||
aItem.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function setWrapperType(aItem, aWrapper) {
|
||||
if (aItem.localName == "toolbarseparator") {
|
||||
aWrapper.setAttribute("type", "separator");
|
||||
} else if (aItem.localName == "toolbarspring") {
|
||||
aWrapper.setAttribute("type", "spring");
|
||||
} else if (aItem.localName == "toolbarspacer") {
|
||||
aWrapper.setAttribute("type", "spacer");
|
||||
} else if (aItem.localName == "toolbaritem" && aItem.firstChild) {
|
||||
aWrapper.setAttribute("type", aItem.firstChild.localName);
|
||||
}
|
||||
}
|
||||
|
||||
function setDragActive(aItem, aValue) {
|
||||
var node = aItem;
|
||||
var direction = window.getComputedStyle(aItem, null).direction;
|
||||
var value = direction == "ltr" ? "left" : "right";
|
||||
if (aItem.localName == "toolbar") {
|
||||
node = aItem.lastChild;
|
||||
value = (direction == "ltr"? "right" : "left");
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aValue) {
|
||||
if (!node.hasAttribute("dragover")) {
|
||||
node.setAttribute("dragover", value);
|
||||
}
|
||||
} else {
|
||||
node.removeAttribute("dragover");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the default set of buttons to fixed toolbars,
|
||||
* remove all custom toolbars, and rebuild the palette.
|
||||
*/
|
||||
function restoreDefaultSet() {
|
||||
// Restore the defaultset for fixed toolbars.
|
||||
var toolbar = gToolbox.firstChild;
|
||||
while (toolbar) {
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
if (!toolbar.hasAttribute("customindex")) {
|
||||
var defaultSet = toolbar.getAttribute("defaultset");
|
||||
if (defaultSet) {
|
||||
toolbar.currentSet = defaultSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
toolbar = toolbar.nextSibling;
|
||||
}
|
||||
|
||||
// Remove all of the customized toolbars.
|
||||
var child = gToolbox.lastChild;
|
||||
while (child) {
|
||||
if (child.hasAttribute("customindex")) {
|
||||
var thisChild = child;
|
||||
child = child.previousSibling;
|
||||
gToolbox.removeChild(thisChild);
|
||||
} else {
|
||||
child = child.previousSibling;
|
||||
}
|
||||
}
|
||||
|
||||
// Now rebuild the palette.
|
||||
buildPalette();
|
||||
|
||||
// Now re-wrap the items on the toolbar.
|
||||
wrapToolbarItems();
|
||||
|
||||
repositionDialog();
|
||||
gToolboxChanged = true;
|
||||
}
|
||||
|
||||
function updateIconSize(aUseSmallIcons) {
|
||||
var val = aUseSmallIcons ? "small" : null;
|
||||
|
||||
setAttribute(gToolbox, "iconsize", val);
|
||||
gToolboxDocument.persist(gToolbox.id, "iconsize");
|
||||
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
setAttribute(toolbar, "iconsize", val);
|
||||
gToolboxDocument.persist(toolbar.id, "iconsize");
|
||||
}
|
||||
}
|
||||
|
||||
repositionDialog();
|
||||
}
|
||||
|
||||
function updateToolbarMode(aModeValue) {
|
||||
setAttribute(gToolbox, "mode", aModeValue);
|
||||
gToolboxDocument.persist(gToolbox.id, "mode");
|
||||
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
setAttribute(toolbar, "mode", aModeValue);
|
||||
gToolboxDocument.persist(toolbar.id, "mode");
|
||||
}
|
||||
}
|
||||
|
||||
var iconSizeCheckbox = document.getElementById("smallicons");
|
||||
if (aModeValue == "text") {
|
||||
iconSizeCheckbox.disabled = true;
|
||||
iconSizeCheckbox.checked = false;
|
||||
updateIconSize(false);
|
||||
} else {
|
||||
iconSizeCheckbox.disabled = false;
|
||||
}
|
||||
|
||||
repositionDialog();
|
||||
}
|
||||
|
||||
function setAttribute(aElt, aAttr, aVal) {
|
||||
if (aVal) {
|
||||
aElt.setAttribute(aAttr, aVal);
|
||||
} else {
|
||||
aElt.removeAttribute(aAttr);
|
||||
}
|
||||
}
|
||||
|
||||
function isCustomizableToolbar(aElt) {
|
||||
return aElt.localName == "toolbar" &&
|
||||
aElt.getAttribute("customizable") == "true";
|
||||
}
|
||||
|
||||
function isSpecialItem(aElt) {
|
||||
return aElt.localName == "toolbarseparator" ||
|
||||
aElt.localName == "toolbarspring" ||
|
||||
aElt.localName == "toolbarspacer";
|
||||
}
|
||||
|
||||
function isToolbarItem(aElt) {
|
||||
return aElt.localName == "toolbarbutton" ||
|
||||
aElt.localName == "toolbaritem" ||
|
||||
aElt.localName == "toolbarseparator" ||
|
||||
aElt.localName == "toolbarspring" ||
|
||||
aElt.localName == "toolbarspacer";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// Drag and Drop observers
|
||||
|
||||
function onToolbarDragGesture(aEvent) {
|
||||
nsDragAndDrop.startDrag(aEvent, dragStartObserver);
|
||||
}
|
||||
|
||||
function onToolbarDragOver(aEvent) {
|
||||
nsDragAndDrop.dragOver(aEvent, toolbarDNDObserver);
|
||||
}
|
||||
|
||||
function onToolbarDragDrop(aEvent) {
|
||||
nsDragAndDrop.drop(aEvent, toolbarDNDObserver);
|
||||
}
|
||||
|
||||
function onToolbarDragExit(aEvent) {
|
||||
if (gCurrentDragOverItem) {
|
||||
setDragActive(gCurrentDragOverItem, false);
|
||||
}
|
||||
}
|
||||
|
||||
var dragStartObserver = {
|
||||
onDragStart: function dSO_onDragStart(aEvent,
|
||||
aXferData,
|
||||
aDragAction) {
|
||||
var documentId = gToolboxDocument.documentElement.id;
|
||||
|
||||
var item = aEvent.target;
|
||||
while (item && item.localName != "toolbarpaletteitem") {
|
||||
item = item.parentNode;
|
||||
}
|
||||
|
||||
item.setAttribute("dragactive", "true");
|
||||
|
||||
aXferData.data = new TransferDataSet();
|
||||
var data = new TransferData();
|
||||
data.addDataForFlavour("text/toolbarwrapper-id/" + documentId,
|
||||
item.firstChild.id);
|
||||
aXferData.data.push(data);
|
||||
}
|
||||
};
|
||||
|
||||
var toolbarDNDObserver = {
|
||||
onDragOver: function tDO_onDragOver(aEvent,
|
||||
aFlavour,
|
||||
aDragSession) {
|
||||
var toolbar = aEvent.target;
|
||||
var dropTarget = aEvent.target;
|
||||
while (toolbar && toolbar.localName != "toolbar") {
|
||||
dropTarget = toolbar;
|
||||
toolbar = toolbar.parentNode;
|
||||
}
|
||||
|
||||
var previousDragItem = gCurrentDragOverItem;
|
||||
|
||||
// Make sure we are dragging over a customizable toolbar.
|
||||
if (!isCustomizableToolbar(toolbar)) {
|
||||
gCurrentDragOverItem = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dropTarget.localName == "toolbar") {
|
||||
gCurrentDragOverItem = dropTarget;
|
||||
} else {
|
||||
gCurrentDragOverItem = null;
|
||||
|
||||
var direction = window.getComputedStyle(dropTarget.parentNode, null)
|
||||
.direction;
|
||||
var dropTargetCenter = dropTarget.boxObject.x +
|
||||
(dropTarget.boxObject.width / 2);
|
||||
if (direction == "ltr") {
|
||||
dragAfter = aEvent.clientX > dropTargetCenter;
|
||||
} else {
|
||||
dragAfter = aEvent.clientX < dropTargetCenter;
|
||||
}
|
||||
|
||||
if (dragAfter) {
|
||||
gCurrentDragOverItem = dropTarget.nextSibling;
|
||||
if (!gCurrentDragOverItem) {
|
||||
gCurrentDragOverItem = toolbar;
|
||||
}
|
||||
} else {
|
||||
gCurrentDragOverItem = dropTarget;
|
||||
}
|
||||
}
|
||||
|
||||
if (previousDragItem && gCurrentDragOverItem != previousDragItem) {
|
||||
setDragActive(previousDragItem, false);
|
||||
}
|
||||
|
||||
setDragActive(gCurrentDragOverItem, true);
|
||||
|
||||
aDragSession.canDrop = true;
|
||||
},
|
||||
|
||||
onDrop: function tDO_onDrop(aEvent,
|
||||
aXferData,
|
||||
aDragSession) {
|
||||
if (!gCurrentDragOverItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
setDragActive(gCurrentDragOverItem, false);
|
||||
|
||||
var draggedItemId = aXferData.data;
|
||||
if (gCurrentDragOverItem.id == draggedItemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
var toolbar = aEvent.target;
|
||||
while (toolbar.localName != "toolbar") {
|
||||
toolbar = toolbar.parentNode;
|
||||
}
|
||||
|
||||
var draggedPaletteWrapper = document.getElementById("wrapper-" +
|
||||
draggedItemId);
|
||||
if (!draggedPaletteWrapper) {
|
||||
// The wrapper has been dragged from the toolbar.
|
||||
|
||||
// Get the wrapper from the toolbar document and make sure that
|
||||
// it isn't being dropped on itself.
|
||||
var wrapper = gToolboxDocument.getElementById("wrapper-" +
|
||||
draggedItemId);
|
||||
if (wrapper == gCurrentDragOverItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow static kids (e.g., the menubar) to move.
|
||||
var wrapParent = wrapper.parentNode;
|
||||
if ((wrapParent.firstPermanentChild &&
|
||||
wrapParent.firstPermanentChild.id == wrapper.firstChild.id) ||
|
||||
(wrapParent.lastPermanentChild &&
|
||||
wrapParent.lastPermanentChild.id == wrapper.firstChild.id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the item from it's place in the toolbar.
|
||||
wrapper.parentNode.removeChild(wrapper);
|
||||
|
||||
// Determine which toolbar we are dropping on.
|
||||
var dropToolbar = null;
|
||||
if (gCurrentDragOverItem.localName == "toolbar") {
|
||||
dropToolbar = gCurrentDragOverItem;
|
||||
} else {
|
||||
dropToolbar = gCurrentDragOverItem.parentNode;
|
||||
}
|
||||
|
||||
// Insert the item into the toolbar.
|
||||
if (gCurrentDragOverItem != dropToolbar) {
|
||||
dropToolbar.insertBefore(wrapper, gCurrentDragOverItem);
|
||||
} else {
|
||||
dropToolbar.appendChild(wrapper);
|
||||
}
|
||||
} else {
|
||||
// The item has been dragged from the palette
|
||||
|
||||
// Create a new wrapper for the item. We don't know the id yet.
|
||||
var wrapper = createWrapper("");
|
||||
|
||||
// Ask the toolbar to clone the item's template, place it inside the
|
||||
// wrapper, and insert it in the toolbar.
|
||||
var newItem = toolbar.insertItem(draggedItemId,
|
||||
gCurrentDragOverItem == toolbar ?
|
||||
null :
|
||||
gCurrentDragOverItem,
|
||||
wrapper);
|
||||
|
||||
// Prepare the item and wrapper to look good on the toolbar.
|
||||
cleanupItemForToolbar(newItem, wrapper);
|
||||
wrapper.id = "wrapper-" + newItem.id;
|
||||
wrapper.flex = newItem.flex;
|
||||
|
||||
// Remove the wrapper from the palette.
|
||||
var currentRow = draggedPaletteWrapper.parentNode;
|
||||
if (draggedItemId != "separator" &&
|
||||
draggedItemId != "spring" &&
|
||||
draggedItemId != "spacer") {
|
||||
currentRow.removeChild(draggedPaletteWrapper);
|
||||
|
||||
while (currentRow) {
|
||||
// Pull the first child of the next row up
|
||||
// into this row.
|
||||
var nextRow = currentRow.nextSibling;
|
||||
|
||||
if (!nextRow) {
|
||||
var last = currentRow.lastChild;
|
||||
var first = currentRow.firstChild;
|
||||
if (first == last) {
|
||||
// Kill the row.
|
||||
currentRow.parentNode.removeChild(currentRow);
|
||||
break;
|
||||
}
|
||||
|
||||
if (last.localName == "spacer") {
|
||||
var flex = last.getAttribute("flex");
|
||||
last.setAttribute("flex", ++flex);
|
||||
// Reflow doesn't happen for some reason. Trigger
|
||||
// it with a hide/show. ICK! -dwh
|
||||
last.hidden = true;
|
||||
last.hidden = false;
|
||||
break;
|
||||
} else {
|
||||
// Make a spacer and give it a flex of 1.
|
||||
var spacer = document.createElementNS(kXULNS,
|
||||
"spacer");
|
||||
spacer.setAttribute("flex", "1");
|
||||
currentRow.appendChild(spacer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
currentRow.appendChild(nextRow.firstChild);
|
||||
currentRow = currentRow.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gCurrentDragOverItem = null;
|
||||
|
||||
repositionDialog();
|
||||
gToolboxChanged = true;
|
||||
},
|
||||
|
||||
_flavourSet: null,
|
||||
|
||||
getSupportedFlavours: function tDO_getSupportedFlavours() {
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
var documentId = gToolboxDocument.documentElement.id;
|
||||
this._flavourSet.appendFlavour("text/toolbarwrapper-id/" +
|
||||
documentId);
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
};
|
||||
|
||||
var paletteDNDObserver = {
|
||||
onDragOver: function pDO_onDragOver(aEvent,
|
||||
aFlavour,
|
||||
aDragSession) {
|
||||
aDragSession.canDrop = true;
|
||||
},
|
||||
|
||||
onDrop: function pDO_onDrop(aEvent,
|
||||
aXferData,
|
||||
aDragSession) {
|
||||
var itemId = aXferData.data;
|
||||
|
||||
var wrapper = gToolboxDocument.getElementById("wrapper-" + itemId);
|
||||
if (wrapper) {
|
||||
// Don't allow static kids (e.g., the menubar) to move.
|
||||
var wrapParent = wrapper.parentNode;
|
||||
if ((wrapParent.firstPermanentChild &&
|
||||
wrapParent.firstPermanentChild.id == wrapper.firstChild.id) ||
|
||||
(wrapParent.lastPermanentChild &&
|
||||
wrapParent.lastPermanentChild.id == wrapper.firstChild.id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The item was dragged out of the toolbar.
|
||||
wrapper.parentNode.removeChild(wrapper);
|
||||
|
||||
var wrapperType = wrapper.getAttribute("type");
|
||||
if (wrapperType != "separator" &&
|
||||
wrapperType != "spacer" &&
|
||||
wrapperType != "spring") {
|
||||
// Find the template node in the toolbox palette
|
||||
var templateNode = gToolbox.palette.firstChild;
|
||||
while (templateNode) {
|
||||
if (templateNode.id == itemId) {
|
||||
break;
|
||||
}
|
||||
templateNode = templateNode.nextSibling;
|
||||
}
|
||||
if (!templateNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clone the template and add it to our palette.
|
||||
var paletteItem = templateNode.cloneNode(true);
|
||||
appendPaletteItem(paletteItem);
|
||||
}
|
||||
}
|
||||
|
||||
repositionDialog();
|
||||
gToolboxChanged = true;
|
||||
},
|
||||
|
||||
_flavourSet: null,
|
||||
|
||||
getSupportedFlavours: function pDO_getSupportedFlavours() {
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
var documentId = gToolboxDocument.documentElement.id;
|
||||
this._flavourSet.appendFlavour("text/toolbarwrapper-id/" +
|
||||
documentId);
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
};
|
||||
@ -1,102 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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 Sun Microsystems code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Sun Microsystems.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- David Hyatt (hyatt@apple.com)
|
||||
- Blake Ross (blaker@netscape.com)
|
||||
- Michael Buettner <michael.buettner@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
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd"> %customizeToolbarDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet type="text/css" href="chrome://communicator/skin/"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/content/customizeToolbar.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin/customizeToolbar.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://calendar/skin/sun-calendar-event-dialog.css" ?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/addressbook/addressbook.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/messengercompose/messengercompose.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/smime/msgCompSMIMEOverlay.css"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/primaryToolbar.css"?>
|
||||
|
||||
<dialog id="CustomizeToolbarWindow"
|
||||
title="&dialog.title;"
|
||||
onload="onLoad();"
|
||||
onunload="onUnload();"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return onAccept();"
|
||||
ondialogcancel="return onCancel();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<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"/>
|
||||
|
||||
<keyset>
|
||||
<key id="cmd_close_sheet" keycode="VK_ESCAPE" oncommand="onCancel();" />
|
||||
<key id="cmd_close_sheet" keycode="VK_RETURN" oncommand="onAccept();" />
|
||||
<key id="cmd_close_sheet" keycode="VK_ENTER" oncommand="onAccept();" />
|
||||
</keyset>
|
||||
|
||||
<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="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();"/>
|
||||
</box>
|
||||
|
||||
<separator class="groove"/>
|
||||
</vbox>
|
||||
</dialog>
|
||||
@ -390,11 +390,6 @@ listbox {
|
||||
color: #E09EBD;
|
||||
}
|
||||
|
||||
.toolbarbutton-1 {
|
||||
-moz-box-orient: vertical;
|
||||
min-width: 0px;
|
||||
}
|
||||
|
||||
#content-frame {
|
||||
border-left: 1px solid ThreeDDarkShadow;
|
||||
border-right: 1px solid ThreeDLightShadow;
|
||||
|
||||
@ -1840,21 +1840,65 @@ function onCommandViewToolbar(aToolbarId, aMenuItemId) {
|
||||
document.persist(aMenuItemId, 'checked');
|
||||
}
|
||||
|
||||
function onCommandCustomize() {
|
||||
var id = "event-toolbox";
|
||||
var aToolbarId = 'event-toolbar';
|
||||
var aMenuItemId = 'menu-view-toolbar';
|
||||
var toolbar = document.getElementById(aToolbarId);
|
||||
var toolbarCollapsed = toolbar.collapsed;
|
||||
if (toolbarCollapsed) {
|
||||
onCommandViewToolbar(aToolbarId, aMenuItemId);
|
||||
}
|
||||
/**
|
||||
* DialogToolboxCustomizeDone() is called after the customize toolbar dialog
|
||||
* has been closed by the user. We need to restore the state of all buttons
|
||||
* and commands of all customizable toolbars.
|
||||
*/
|
||||
|
||||
window.openDialog(
|
||||
"chrome://calendar/content/sun-calendar-customize-toolbar.xul",
|
||||
"CustomizeToolbar",
|
||||
"chrome,all,dependent",
|
||||
document.getElementById(id));
|
||||
function DialogToolboxCustomizeDone(aToolboxChanged) {
|
||||
|
||||
var menubar = document.getElementById("event-menubar");
|
||||
for (var i = 0; i < menubar.childNodes.length; ++i) {
|
||||
menubar.childNodes[i].removeAttribute("disabled");
|
||||
}
|
||||
|
||||
// make sure our toolbar buttons have the correct enabled state restored to them...
|
||||
document.commandDispatcher.updateCommands('itemCommands');
|
||||
|
||||
// Enable the toolbar context menu items
|
||||
document.getElementById("cmd_customize").removeAttribute("disabled");
|
||||
}
|
||||
|
||||
function onCommandCustomize() {
|
||||
// install the callback that handles what needs to be
|
||||
// done after a toolbar has been customized.
|
||||
var toolbox = document.getElementById("event-toolbox");
|
||||
toolbox.customizeDone = DialogToolboxCustomizeDone;
|
||||
|
||||
var menubar = document.getElementById("event-menubar");
|
||||
for (var i = 0; i < menubar.childNodes.length; ++i) {
|
||||
menubar.childNodes[i].setAttribute("disabled", true);
|
||||
}
|
||||
|
||||
// Disable the toolbar context menu items
|
||||
document.getElementById("cmd_customize").setAttribute("disabled", "true");
|
||||
|
||||
var id = "event-toolbox";
|
||||
if (gIsSunbird) {
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
var newwindow = window.openDialog("chrome://calendar/content/customizeToolbar.xul",
|
||||
"CustomizeToolbar",
|
||||
"chrome,all,dependent",
|
||||
document.getElementById(id));
|
||||
#else
|
||||
window.openDialog("chrome://global/content/customizeToolbar.xul",
|
||||
"CustomizeToolbar",
|
||||
"chrome,all,dependent",
|
||||
document.getElementById(id));
|
||||
#endif
|
||||
} else {
|
||||
var wintype = document.documentElement.getAttribute("windowtype");
|
||||
wintype = wintype.replace(/:/g, "");
|
||||
|
||||
window.openDialog("chrome://global/content/customizeToolbar.xul",
|
||||
"CustomizeToolbar" + wintype,
|
||||
"chrome,all,dependent",
|
||||
document.getElementById(id), // toolbar dom node
|
||||
false, // is mode toolbar yes/no?
|
||||
null, // callback function
|
||||
"dialog"); // name of this mode
|
||||
}
|
||||
}
|
||||
|
||||
function editStartTimezone() {
|
||||
|
||||
@ -246,7 +246,13 @@
|
||||
command="cmd_selectAll"/>
|
||||
</keyset>
|
||||
|
||||
<!-- Toolbox contains the toolbar and menubar -->
|
||||
<popup id="event-dialog-toolbar-context-menu">
|
||||
<menuitem id="CustomizeDialogToolbar"
|
||||
label="&event.menu.view.toolbars.customize.label;"
|
||||
command="cmd_customize"/>
|
||||
</popup>
|
||||
|
||||
<!-- Toolbox contains the toolbar and menubar -->
|
||||
<toolbox id="event-toolbox" class="toolbox-top" mode="full">
|
||||
|
||||
<!-- Menubar -->
|
||||
@ -428,18 +434,21 @@
|
||||
|
||||
<!-- Toolbar -->
|
||||
<toolbarpalette id="event-toolbar-palette">
|
||||
<toolbarbutton class="toolbarbutton-1"
|
||||
id="button-save"
|
||||
<toolbarbutton id="button-save"
|
||||
mode="dialog"
|
||||
class="cal-toolbarbutton-2"
|
||||
label="&event.toolbar.save.label;"
|
||||
command="cmd_accept"/>
|
||||
<toolbarbutton class="toolbarbutton-1 event-only"
|
||||
id="button-attendees"
|
||||
<toolbarbutton id="button-attendees"
|
||||
mode="dialog"
|
||||
class="cal-toolbarbutton-2 event-only"
|
||||
disable-on-readonly="true"
|
||||
label="&event.toolbar.attendees.label;"
|
||||
command="cmd_attendees"/>
|
||||
<toolbarbutton class="toolbarbutton-1"
|
||||
<toolbarbutton id="button-privacy"
|
||||
mode="dialog"
|
||||
class="cal-toolbarbutton-2"
|
||||
type="menu-button"
|
||||
id="button-privacy"
|
||||
disable-on-readonly="true"
|
||||
label="&event.toolbar.privacy.label;">
|
||||
<menupopup>
|
||||
@ -454,8 +463,9 @@
|
||||
command="cmd_privacy_private"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton class="toolbarbutton-1"
|
||||
id="button-url"
|
||||
<toolbarbutton id="button-url"
|
||||
mode="dialog"
|
||||
class="cal-toolbarbutton-2"
|
||||
label="&event.toolbar.link.label;"
|
||||
command="cmd_url"
|
||||
disable-on-readonly="true"/>
|
||||
@ -464,6 +474,7 @@
|
||||
<toolbar id="event-toolbar"
|
||||
class="chromeclass-toolbar"
|
||||
customizable="true"
|
||||
context="event-dialog-toolbar-context-menu"
|
||||
defaultset="button-save,button-attendees,button-privacy,button-url"/>
|
||||
|
||||
<toolbarset id="custom-toolbars"/>
|
||||
@ -831,7 +842,7 @@
|
||||
flex="1"
|
||||
pack="start"
|
||||
privacy="PUBLIC">
|
||||
<image id="button-privacy-public"/>
|
||||
<image id="button-privacy-public" class="cal-statusbar-1"/>
|
||||
<label value="&event.menu.options.privacy.public.label;"/>
|
||||
</statusbarpanel>
|
||||
<statusbarpanel id="status-privacy-confidential"
|
||||
@ -840,7 +851,7 @@
|
||||
flex="1"
|
||||
pack="start"
|
||||
privacy="CONFIDENTIAL">
|
||||
<image id="button-privacy-confidential"/>
|
||||
<image id="button-privacy-confidential" class="cal-statusbar-1"/>
|
||||
<label value="&event.menu.options.privacy.confidential.label;"/>
|
||||
</statusbarpanel>
|
||||
<statusbarpanel id="status-privacy-private"
|
||||
@ -849,7 +860,7 @@
|
||||
flex="1"
|
||||
pack="start"
|
||||
privacy="PRIVATE">
|
||||
<image id="button-privacy-private"/>
|
||||
<image id="button-privacy-private" class="cal-statusbar-1"/>
|
||||
<label value="&event.menu.options.privacy.private.label;"/>
|
||||
</statusbarpanel>
|
||||
<statusbarpanel id="status-priority"
|
||||
@ -858,12 +869,15 @@
|
||||
pack="start">
|
||||
<label value="&event.priority.label;"/>
|
||||
<image id="button-importance-low"
|
||||
class="cal-statusbar-1"
|
||||
collapsed="true"
|
||||
value="low"/>
|
||||
<image id="button-importance-medium"
|
||||
class="cal-statusbar-1"
|
||||
collapsed="true"
|
||||
value="normal"/>
|
||||
<image id="button-importance-high"
|
||||
class="cal-statusbar-1"
|
||||
collapsed="true"
|
||||
value="high"/>
|
||||
</statusbarpanel>
|
||||
|
||||
@ -61,8 +61,8 @@
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
toolbox = window.arguments[0];
|
||||
toolboxDocument = toolbox.ownerDocument;
|
||||
var toolbox = window.arguments[0];
|
||||
var toolboxDocument = toolbox.ownerDocument;
|
||||
|
||||
var sheetList = toolboxDocument.styleSheets;
|
||||
for (var i=0; i < sheetList.length; ++i) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user