зеркало из https://github.com/mozilla/pjs.git
Bug #264128 --> toolbar customization window should be more like a dialog
for Thunderbird.
This commit is contained in:
Родитель
6461b3d446
Коммит
ac997b7ac7
|
@ -26,6 +26,7 @@ const kWindowWidth = 600;
|
|||
const kWindowHeight = 400;
|
||||
const kAnimateIncrement = 50;
|
||||
const kAnimateSteps = kWindowHeight / kAnimateIncrement - 1;
|
||||
const kVSizeSlop = 5;
|
||||
|
||||
var gToolboxDocument = null;
|
||||
var gToolbox = null;
|
||||
|
@ -41,13 +42,9 @@ function onLoad()
|
|||
gToolbox.addEventListener("dragover", onToolbarDragOver, false);
|
||||
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
|
||||
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
|
||||
|
||||
document.documentElement.setAttribute("hidechrome", "true");
|
||||
|
||||
repositionDialog();
|
||||
window.outerWidth = kWindowWidth;
|
||||
window.outerHeight = 50;
|
||||
slideOpen(0);
|
||||
|
||||
initDialog();
|
||||
}
|
||||
|
||||
function onUnload(aEvent)
|
||||
|
@ -57,6 +54,8 @@ function onUnload(aEvent)
|
|||
persistCurrentSets();
|
||||
|
||||
notifyParentComplete();
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
|
@ -93,7 +92,7 @@ function onCancel()
|
|||
function onAccept(aEvent)
|
||||
{
|
||||
document.getElementById("main-box").collapsed = true;
|
||||
slideClosed(0);
|
||||
window.close();
|
||||
}
|
||||
|
||||
function initDialog()
|
||||
|
@ -116,31 +115,20 @@ function initDialog()
|
|||
wrapToolbarItems();
|
||||
}
|
||||
|
||||
function slideOpen(aStep)
|
||||
{
|
||||
if (aStep < kAnimateSteps) {
|
||||
window.outerHeight += kAnimateIncrement;
|
||||
setTimeout(slideOpen, 20, ++aStep);
|
||||
} else {
|
||||
initDialog();
|
||||
}
|
||||
}
|
||||
|
||||
function slideClosed(aStep)
|
||||
{
|
||||
if (aStep < kAnimateSteps) {
|
||||
window.outerHeight -= kAnimateIncrement;
|
||||
setTimeout(slideClosed, 10, ++aStep);
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function repositionDialog()
|
||||
{
|
||||
// Position the dialog touching the bottom of the toolbox and centered with it
|
||||
// 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 = kWindowHeight;
|
||||
if (newHeight >= screen.availHeight - screenY - kVSizeSlop) {
|
||||
newHeight = screen.availHeight - screenY - kVSizeSlop;
|
||||
}
|
||||
|
||||
window.resizeTo(kWindowWidth, newHeight);
|
||||
window.moveTo(screenX, screenY);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
|
||||
<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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче