зеркало из https://github.com/mozilla/gecko-dev.git
70750 - new dialog xbl bindings, r=ben, sr=hyatt
This commit is contained in:
Родитель
9dcfafdfd4
Коммит
ccceaa31cf
|
@ -0,0 +1,59 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Joe Hewitt (hewitt@netscape.com)
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* ===== dialog.css =====================================================
|
||||
== Styles used by the XUL dialog element.
|
||||
======================================================================= */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: dialog ::::: */
|
||||
|
||||
dialog {
|
||||
padding: 7px 5px 5px 5px;
|
||||
}
|
||||
|
||||
/* ::::: dialog buttons ::::: */
|
||||
|
||||
.dialog-button-box {
|
||||
padding-top: 1.5em;
|
||||
}
|
||||
|
||||
.dialog-button {
|
||||
font: menu;
|
||||
}
|
|
@ -100,37 +100,27 @@ button.plain {
|
|||
/**
|
||||
* XUL <window> element
|
||||
**/
|
||||
window
|
||||
window,
|
||||
page,
|
||||
dialog,
|
||||
window
|
||||
{
|
||||
background-color : #DDDDDD;
|
||||
padding : 0px;
|
||||
font : message-box;
|
||||
}
|
||||
|
||||
window[wait-cursor]
|
||||
[wait-cursor]
|
||||
{
|
||||
cursor : wait !important;
|
||||
}
|
||||
|
||||
/* deprecated */
|
||||
window.dialog
|
||||
{
|
||||
background-color : #DDDDDD;
|
||||
padding : 7px 5px 5px 5px;
|
||||
}
|
||||
|
||||
window.non-resizable-dialog
|
||||
{
|
||||
border-left : 1px solid #FFFFFF;
|
||||
border-top : 1px solid #FFFFFF;
|
||||
border-right : 1px solid #DDDDDD;
|
||||
border-bottom : 1px solid #DDDDDD;
|
||||
}
|
||||
|
||||
window.non-resizable-dialog.modal
|
||||
{
|
||||
border : none;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL <box> debugging
|
||||
**/
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Joe Hewitt (hewitt@netscape.com)
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* ===== dialog.css =====================================================
|
||||
== Styles used by the XUL dialog element.
|
||||
======================================================================= */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: dialog ::::: */
|
||||
|
||||
dialog {
|
||||
padding: 8px 10px 10px 8px;
|
||||
}
|
||||
|
||||
/* ::::: dialog buttons ::::: */
|
||||
|
||||
.dialog-button-box {
|
||||
padding-top: 1.5em;
|
||||
}
|
||||
|
||||
.dialog-button {
|
||||
font: menu;
|
||||
}
|
|
@ -110,20 +110,22 @@ button[type="menu-button"] {
|
|||
/**
|
||||
* XUL <window> element
|
||||
**/
|
||||
window
|
||||
window,
|
||||
page,
|
||||
dialog,
|
||||
wizard
|
||||
{
|
||||
background-color : -moz-Dialog;
|
||||
color : -moz-DialogText;
|
||||
padding : 0px;
|
||||
font : message-box;
|
||||
-moz-user-focus : ignore;
|
||||
}
|
||||
|
||||
window[wait-cursor]
|
||||
[wait-cursor]
|
||||
{
|
||||
cursor : wait !important;
|
||||
}
|
||||
|
||||
/* deprecated */
|
||||
window.dialog
|
||||
{
|
||||
background-color : -moz-Dialog;
|
||||
|
|
|
@ -5,9 +5,9 @@ classic.jar:
|
|||
skin/classic/global/browser.css
|
||||
skin/classic/global/button.css
|
||||
skin/classic/global/checkbox.css
|
||||
skin/classic/global/commonDialog.css
|
||||
skin/classic/global/console.css
|
||||
skin/classic/global/colorpicker.css
|
||||
skin/classic/global/dialog.css
|
||||
skin/classic/global/filepicker.css
|
||||
skin/classic/global/formatting.css
|
||||
skin/classic/global/global.css
|
||||
|
@ -38,7 +38,6 @@ classic.jar:
|
|||
skin/classic/global/message-icon.gif
|
||||
skin/classic/global/question-icon.gif
|
||||
skin/classic/global/alert-icon.gif
|
||||
skin/classic/global/dialogOverlay.css
|
||||
skin/classic/global/linkTree.css
|
||||
skin/classic/global/twisty-open.gif
|
||||
skin/classic/global/twisty-closed.gif
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Joe Hewitt (hewitt@netscape.com)
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* ===== dialog.css =====================================================
|
||||
== Styles used by the XUL dialog element.
|
||||
======================================================================= */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: dialog ::::: */
|
||||
|
||||
dialog {
|
||||
padding: 7px 5px 5px 5px;
|
||||
}
|
||||
|
||||
/* ::::: dialog buttons ::::: */
|
||||
|
||||
.dialog-button-box {
|
||||
padding-top: 1.5em;
|
||||
}
|
||||
|
||||
.dialog-button {
|
||||
font: menu;
|
||||
}
|
|
@ -112,19 +112,22 @@ splitter {
|
|||
color: white;
|
||||
}
|
||||
|
||||
/* ::::: window ::::: */
|
||||
/* ::::: root elements ::::: */
|
||||
|
||||
window {
|
||||
padding: 0px;
|
||||
window,
|
||||
page,
|
||||
dialog,
|
||||
wizard {
|
||||
background-color: #C7D0D9;
|
||||
color: #000000;
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
window[wait-cursor] {
|
||||
[wait-cursor] {
|
||||
cursor: wait !important;
|
||||
}
|
||||
|
||||
|
||||
/* deprecated */
|
||||
window.dialog {
|
||||
padding: 7px 5px 5px 5px;
|
||||
}
|
||||
|
|
|
@ -301,6 +301,7 @@ modern.jar:
|
|||
skin/modern/global/colorpicker.css (global/colorpicker.css)
|
||||
skin/modern/global/console.css (global/console.css)
|
||||
skin/modern/global/contents.rdf (global/contents.rdf)
|
||||
skin/modern/global/dialog.css (global/dialog.css)
|
||||
skin/modern/global/filepicker.css (global/filepicker.css)
|
||||
skin/modern/global/formatting.css (global/formatting.css)
|
||||
skin/modern/global/global.css (global/global.css)
|
||||
|
|
|
@ -100,7 +100,6 @@ var gCreateInFolder = "NC:NewBookmarkFolder";
|
|||
|
||||
function Startup()
|
||||
{
|
||||
doSetOKCancel(onOK);
|
||||
gFld_Name = document.getElementById("name");
|
||||
gFld_URL = document.getElementById("url");
|
||||
gFolderTree = document.getElementById("folders");
|
||||
|
@ -120,8 +119,8 @@ function Startup()
|
|||
document.getElementById("createinseparator").setAttribute("hidden", "true");
|
||||
document.getElementById("nameseparator").setAttribute("hidden", "true");
|
||||
sizeToContent();
|
||||
var windowNode = document.getElementById("newBookmarkWindow");
|
||||
windowNode.setAttribute("title", windowNode.getAttribute("title-selectFolder"));
|
||||
var dialogNode = document.getElementById("newBookmarkDialog");
|
||||
dialogNode.setAttribute("title", windowNode.getAttribute("title-selectFolder"));
|
||||
shouldSetOKButton = false;
|
||||
folderItem = document.getElementById(window.arguments[2]);
|
||||
if (folderItem)
|
||||
|
@ -170,7 +169,7 @@ function setupFields()
|
|||
|
||||
function onLocationInput ()
|
||||
{
|
||||
var ok = document.getElementById("ok");
|
||||
var ok = document.getElementById("newBookmarkDialog").getButton("accept");
|
||||
ok.disabled = gFld_URL.value == "";
|
||||
}
|
||||
|
||||
|
@ -217,7 +216,6 @@ function onOK()
|
|||
|
||||
kBMS.AddBookmarkToFolder(url, rFolder, gFld_Name.value, gBookmarkCharset);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
function onTreeSelect ()
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
<?xml-stylesheet href="chrome://communicator/skin/"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
|
@ -37,10 +35,10 @@
|
|||
%addBookmarkDTD;
|
||||
]>
|
||||
|
||||
<window id="newBookmarkWindow" style="width: 36em;"
|
||||
<dialog id="newBookmarkDialog" style="width: 36em;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel" ondialogaccept="return onOK(event)"
|
||||
title="&newBookmark.title;" title-selectFolder="&selectFolder.label;"
|
||||
orient="vertical" class="dialog"
|
||||
onload="Startup();"
|
||||
persist="screenX screenY width height"
|
||||
screenX="24" screenY="24">
|
||||
|
@ -53,9 +51,6 @@
|
|||
<stringbundle id="bookmarksbundle"
|
||||
src="chrome://communicator/locale/bookmarks/bookmark.properties"/>
|
||||
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<separator id="nameseparator" class="thin"/>
|
||||
|
||||
<grid id="bookmarknamegrid">
|
||||
|
@ -125,10 +120,6 @@
|
|||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<separator/>
|
||||
</vbox>
|
||||
|
||||
<!-- XXX - need to use an "Add Bookmark" string here -->
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
||||
</window>
|
||||
</dialog>
|
||||
|
|
|
@ -37,7 +37,7 @@ function initDialogObject()
|
|||
dialog.caseSensitive = document.getElementById("dialog.caseSensitive");
|
||||
dialog.wrap = document.getElementById("dialog.wrap");
|
||||
dialog.searchBackwards = document.getElementById("dialog.searchBackwards");
|
||||
dialog.find = document.getElementById("ok");
|
||||
dialog.find = document.getElementById("findDialog").getButton("accept");
|
||||
dialog.bundle = null;
|
||||
|
||||
// Move dialog to center, if it not been shown before
|
||||
|
@ -83,9 +83,6 @@ function onLoad()
|
|||
// Change "OK" to "Find".
|
||||
dialog.find.label = document.getElementById("fBLT").getAttribute("label");
|
||||
|
||||
// Setup the dialogOverlay.xul button handlers.
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// get the find instance
|
||||
var finder = window.arguments[0];
|
||||
// If the dialog was opened from window.find(), findInst will be an
|
||||
|
@ -105,7 +102,7 @@ function onUnload()
|
|||
window.opener.findDialog = 0;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
function onAccept()
|
||||
{
|
||||
// Transfer dialog contents to the find service.
|
||||
saveFindData();
|
||||
|
@ -129,12 +126,6 @@ function onOK()
|
|||
}
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
// Close the window.
|
||||
return true;
|
||||
}
|
||||
|
||||
function doEnabling()
|
||||
{
|
||||
dialog.find.disabled = !dialog.findKey.value;
|
||||
|
|
|
@ -30,20 +30,18 @@ Contributor(s):
|
|||
|
||||
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://global/locale/finddialog.dtd">
|
||||
|
||||
<window id="findDialog"
|
||||
<dialog id="findDialog"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel" buttonpack="center"
|
||||
ondialogaccept="return onAccept(event);"
|
||||
windowtype="findInPage"
|
||||
onload="onLoad();"
|
||||
onunload="onUnload();"
|
||||
style="width: 30em;"
|
||||
title="&findDialog.title;"
|
||||
class="dialog"
|
||||
orient="vertical"
|
||||
persist="screenX screenY">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/finddialog.js"/>
|
||||
|
@ -77,10 +75,4 @@ Contributor(s):
|
|||
<!-- used to store the find text -->
|
||||
<foo style="display:none;" id="fBLT" label="&findButton.label;"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<!-- Places to overlay common dialog buttons and keyset -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
</window>
|
||||
</dialog>
|
||||
|
|
|
@ -60,7 +60,6 @@ nsPrefWindow.prototype =
|
|||
onload:
|
||||
function ()
|
||||
{
|
||||
doSetOKCancel( this.onOK, this.onCancel );
|
||||
try
|
||||
{
|
||||
this.pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
|
@ -99,7 +98,6 @@ nsPrefWindow.prototype =
|
|||
}
|
||||
hPrefWindow.wsm.savePageData( tag );
|
||||
hPrefWindow.savePrefs();
|
||||
close();
|
||||
},
|
||||
|
||||
onCancel:
|
||||
|
@ -109,7 +107,6 @@ nsPrefWindow.prototype =
|
|||
{
|
||||
hPrefWindow.cancelHandlers[i]();
|
||||
}
|
||||
close();
|
||||
},
|
||||
|
||||
registerOKCallbackFunc:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/pref/preftree.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref.dtd" >
|
||||
|
@ -10,15 +9,18 @@
|
|||
<!-- This dialog has a fixed size and is not resizable.
|
||||
You MAY NOT increase the size of this dialog.
|
||||
Questions, Comments -> ben@netscape.com -->
|
||||
<window id="prefDialog"
|
||||
<dialog id="prefDialog"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&prefWindow.title;"
|
||||
orient="vertical" class="dialog"
|
||||
style="&prefWindow.size;"
|
||||
windowtype="mozilla:preferences"
|
||||
buttons="accept,cancel,help"
|
||||
onload="Startup();"
|
||||
ondialogaccept="return hPrefWindow.onOK(event);"
|
||||
ondialogcancel="return hPrefWindow.onCancel(event);"
|
||||
ondialoghelp="return doHelpButton(event)"
|
||||
persist="screenX screenY">
|
||||
|
||||
<script>
|
||||
|
@ -52,8 +54,6 @@
|
|||
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-help.js"/>
|
||||
<script type="application/x-javascript" src="chrome://help/content/help.js"/>
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<vbox flex="19">
|
||||
<text class="label" value="&categoryHeader;"/>
|
||||
|
@ -65,10 +65,6 @@
|
|||
|
||||
</hbox>
|
||||
|
||||
<separator/>
|
||||
|
||||
<hbox id="okCancelHelpButtonsRight" />
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
if(window.arguments && window.arguments[0]) {
|
||||
|
@ -82,4 +78,4 @@
|
|||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
||||
</dialog>
|
||||
|
|
|
@ -46,6 +46,7 @@ toolkit.jar:
|
|||
content/global/bindings/button.xml (resources/content/bindings/button.xml)
|
||||
content/global/bindings/checkbox.xml (resources/content/bindings/checkbox.xml)
|
||||
content/global/bindings/colorpicker.xml (resources/content/bindings/colorpicker.xml)
|
||||
content/global/bindings/dialog.xml (resources/content/bindings/dialog.xml)
|
||||
content/global/bindings/general.xml (resources/content/bindings/general.xml)
|
||||
content/global/bindings/groupbox.xml (resources/content/bindings/groupbox.xml)
|
||||
content/global/bindings/menu.xml (resources/content/bindings/menu.xml)
|
||||
|
@ -94,6 +95,7 @@ en-US.jar:
|
|||
locale/en-US/global/commonDialogs.properties (resources/locale/en-US/commonDialogs.properties)
|
||||
locale/en-US/global/plugins.properties (resources/locale/en-US/plugins.properties)
|
||||
locale/en-US/global/nsOutlinerSorting.properties (resources/locale/en-US/nsOutlinerSorting.properties)
|
||||
locale/en-US/global/dialog.properties (resources/locale/en-US/dialog.properties)
|
||||
|
||||
US.jar:
|
||||
locale/US/global-region/contents.rdf (resources/locale/en-US/contents-region.rdf)
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="dialogBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="dialog-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/dialog.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="dialog" extends="chrome://global/content/bindings/dialog.xml#dialog-base">
|
||||
<content>
|
||||
<xul:vbox class="box-inherit dialog-content-box" flex="1">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox class="dialog-button-box" pack="end"
|
||||
inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
|
||||
<xul:button dlgtype="accept" class="dialog-button" default="true"/>
|
||||
<xul:button dlgtype="cancel" class="dialog-button"/>
|
||||
<xul:button dlgtype="help" class="dialog-button"/>
|
||||
<xul:button dlgtype="disclosure" class="dialog-button"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="buttons"
|
||||
onget="return this.getAttribute('buttons');"
|
||||
onset="this._configureButtons(val); return val;"/>
|
||||
|
||||
<method name="acceptDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._doButtonCommand("accept");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="cancelDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._doButtonCommand("cancel");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var btns = this.getElementsByAttribute("dlgtype", aDlgType);
|
||||
return btns.length > 0 ? btns[0] : document.getAnonymousElementByAttribute(this, "dlgtype", aDlgType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._initDialogButton("accept");
|
||||
this._initDialogButton("cancel");
|
||||
this._initDialogButton("help");
|
||||
this._initDialogButton("disclosure");
|
||||
|
||||
// hide/show the appropriate buttons
|
||||
this._configureButtons(this.getAttribute("buttons"));
|
||||
|
||||
// give focus to the first focusable element in the dialog
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(this);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<property name="mStrBundle">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._mStrBundle) {
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global/locale/dialog.properties";
|
||||
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
|
||||
}
|
||||
return this._mStrBundle;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="_initDialogButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body><![CDATA[
|
||||
var btns = this.getElementsByAttribute("dlgtype", aDlgType);
|
||||
var btn = btns.length > 0 ? btns[0] : document.getAnonymousElementByAttribute(this, "dlgtype", aDlgType);
|
||||
if (btn) {
|
||||
btn.addEventListener("command", this._handleButtonCommand, true);
|
||||
// don't set pre-defined labels on explicit buttons
|
||||
if (btns.length == 0)
|
||||
btn.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+aDlgType));
|
||||
btn._dialog = this;
|
||||
}
|
||||
return btn;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_configureButtons">
|
||||
<parameter name="aButtons"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// expect a comma or space delimitd list of dlgtype values to be shown
|
||||
var list = aButtons.split(",");
|
||||
if (list.length == 1)
|
||||
list = aButtons.split(" ");
|
||||
|
||||
// mark shown dlgtypes as true
|
||||
var shown = { accept: false, cancel: false, help: false, disclosure: false};
|
||||
for (var i = 0; i < list.length; ++i)
|
||||
shown[list[i].replace(/ /g, "")] = true;
|
||||
|
||||
// hide or show the buttons
|
||||
for (var dlgtype in shown) {
|
||||
var button = document.getAnonymousElementByAttribute(this, "dlgtype", dlgtype);
|
||||
if (button) {
|
||||
if (shown[dlgtype])
|
||||
button.removeAttribute("hidden");
|
||||
else
|
||||
button.setAttribute("hidden", "true");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_handleButtonCommand">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var dialog = aEvent.target._dialog;
|
||||
dialog._doButtonCommand(aEvent.target.getAttribute("dlgtype"));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_doButtonCommand">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var button = this.getButton("accept");
|
||||
if (!button.disabled) {
|
||||
var noCancel = this._fireButtonEvent(aDlgType);
|
||||
|
||||
if (noCancel) {
|
||||
if (aDlgType == "accept" || aDlgType == "cancel") {
|
||||
// calling window.close() while an oncommand event
|
||||
// call is on the stack fails to close the window,
|
||||
// so we need to do this ugly setTimeout hack
|
||||
window.setTimeout(function() {window.close();}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireButtonEvent">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("dialog"+aDlgType, false, true);
|
||||
|
||||
// handle dom event handlers
|
||||
var noCancel = this.dispatchEvent(event);
|
||||
|
||||
// handle any xml attribute event handlers
|
||||
var handler = this.getAttribute("ondialog"+aDlgType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
var returned = fn(event);
|
||||
if (returned == false)
|
||||
noCancel = false;
|
||||
}
|
||||
|
||||
return noCancel;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// only accept dialog if accept button is the default
|
||||
var btn = this.getButton("accept");
|
||||
if (btn && btn.getAttribute("default") == "true")
|
||||
this.acceptDialog();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" phase="capturing" action="this._hitEnter();"/>
|
||||
<handler event="keypress" keycode="VK_RETURN" phase="capturing" action="this._hitEnter();"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" phase="capturing" action="this.cancelDialog();"/>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -2,4 +2,5 @@ toolkit.jar:
|
|||
content/global/platformGlobalOverlay.xul
|
||||
content/global/platformDialogOverlay.xul
|
||||
content/global/platformXUL.css
|
||||
content/global/platformDialog.xml
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="platformDialogBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="dialog" extends="chrome://global/content/bindings/dialog.xml#dialog">
|
||||
<content>
|
||||
<xul:vbox class="box-inherit dialog-content-box" flex="1">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox class="dialog-button-box"
|
||||
inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
|
||||
<xul:button dlgtype="help" class="dialog-button"/>
|
||||
<xul:button dlgtype="disclosure" class="dialog-button"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button dlgtype="cancel" class="dialog-button"/>
|
||||
<xul:button dlgtype="accept" class="dialog-button" default="true"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,6 +1,11 @@
|
|||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
dialog {
|
||||
-moz-binding: url("chrome://global/content/platformDialog.xml#dialog") !important;
|
||||
}
|
||||
|
||||
statusbar {
|
||||
padding-right: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -647,10 +647,18 @@ stringbundle {
|
|||
}
|
||||
|
||||
/********** resourcebundle **********/
|
||||
|
||||
resourcebundle {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
/********** dialog **********/
|
||||
|
||||
dialog {
|
||||
-moz-binding: url("chrome://global/content/bindings/dialog.xml#dialog");
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
|
||||
/********** wizard **********/
|
||||
|
||||
wizard {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
button-accept=Ok
|
||||
button-cancel=Cancel
|
||||
button-help=Help
|
||||
button-disclosure=More Info
|
Загрузка…
Ссылка в новой задаче