Bug 476814 - Unfork/Unify customizeToolbar.* and customizeToolbarSheet.*; Patch v1.0 Unfork OSX; r=mano

This commit is contained in:
Philip Chee 2009-02-16 16:27:20 +01:00
Родитель 6f5b6eb627
Коммит ca96b90531
2 изменённых файлов: 30 добавлений и 8 удалений

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

@ -45,11 +45,19 @@ var gToolbox = null;
var gCurrentDragOverItem = null; var gCurrentDragOverItem = null;
var gToolboxChanged = false; var gToolboxChanged = false;
var gToolboxIconSize = false; var gToolboxIconSize = false;
var gToolboxSheet = false;
function onLoad() function onLoad()
{ {
InitWithToolbox(window.arguments[0]); if ("arguments" in window && window.arguments[0]) {
repositionDialog(); InitWithToolbox(window.arguments[0]);
repositionDialog();
}
else if (window.frameElement &&
"toolbox" in window.frameElement) {
gToolboxSheet = true;
InitWithToolbox(window.frameElement.toolbox);
}
} }
function InitWithToolbox(aToolbox) function InitWithToolbox(aToolbox)
@ -68,6 +76,20 @@ function InitWithToolbox(aToolbox)
notifyParentInitialized(); notifyParentInitialized();
} }
function onClose()
{
if (!gToolboxSheet)
window.close();
else
finishToolbarCustomization();
}
function onUnload()
{
if (!gToolboxSheet)
finishToolbarCustomization();
}
function finishToolbarCustomization() function finishToolbarCustomization()
{ {
gToolbox.customizing = false; gToolbox.customizing = false;

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

@ -51,7 +51,7 @@
<window id="CustomizeToolbarWindow" <window id="CustomizeToolbarWindow"
title="&dialog.title;" title="&dialog.title;"
onload="onLoad();" onload="onLoad();"
onunload="finishToolbarCustomization();" onunload="onUnload();"
style="&dialog.style;" style="&dialog.style;"
persist="width height" persist="width height"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@ -61,10 +61,10 @@
<stringbundle id="stringBundle" src="chrome://global/locale/customizeToolbar.properties"/> <stringbundle id="stringBundle" src="chrome://global/locale/customizeToolbar.properties"/>
<keyset> <keyset id="CustomizeToolbarKeyset">
<key id="cmd_close_sheet" keycode="VK_ESCAPE" oncommand="window.close();"/> <key id="cmd_close1" keycode="VK_ESCAPE" oncommand="onClose();"/>
<key id="cmd_close_sheet" keycode="VK_RETURN" oncommand="window.close();"/> <key id="cmd_close2" keycode="VK_RETURN" oncommand="onClose();"/>
<key id="cmd_close_sheet" keycode="VK_ENTER" oncommand="window.close();"/> <key id="cmd_close3" keycode="VK_ENTER" oncommand="onClose();"/>
</keyset> </keyset>
<vbox id="main-box" flex="1"> <vbox id="main-box" flex="1">
@ -96,7 +96,7 @@
<separator class="groove"/> <separator class="groove"/>
<hbox align="center" pack="end"> <hbox align="center" pack="end">
<button id="donebutton" label="&saveChanges.label;" oncommand="window.close();" <button id="donebutton" label="&saveChanges.label;" oncommand="onClose();"
default="true" icon="close"/> default="true" icon="close"/>
</hbox> </hbox>
</vbox> </vbox>