bug 42438, add wallet functions to edit menu, r=dbragg

This commit is contained in:
morse%netscape.com 2000-08-13 23:38:08 +00:00
Родитель f40ede20ce
Коммит 98f503b9ee
4 изменённых файлов: 92 добавлений и 1 удалений

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

@ -55,6 +55,8 @@ Contributor(s): Blake Ross <BlakeR1234@aol.com>. -->
<key id="key_paste"/>
<key id="key_delete"/>
<key id="key_selectAll"/>
<key id="key_capture"/>
<key id="key_prefill"/>
<key id="key_preferences"/>
<key id="stop" keycode="VK_ESCAPE" onkeypress="BrowserStop();"/>
@ -101,6 +103,8 @@ Contributor(s): Blake Ross <BlakeR1234@aol.com>. -->
<broadcaster id="cmd_paste"/>
<broadcaster id="cmd_delete"/>
<broadcaster id="cmd_selectAll"/>
<broadcaster id="cmd_capture"/>
<broadcaster id="cmd_prefill"/>
<broadcaster id="cmd_preferences"/>
<!-- View Menu -->
@ -195,6 +199,9 @@ Contributor(s): Blake Ross <BlakeR1234@aol.com>. -->
<menuseparator/>
<menuitem id="menu_selectAll"/>
<menuseparator />
<menuitem id="menu_capture" oncommand="capture()"/>
<menuitem id="menu_prefill" oncommand="prefill()"/>
<menuseparator />
<menuitem id="menu_preferences" oncommand="goPreferences('navigator.xul', 'chrome://communicator/content/pref/pref-navigator.xul', 'navigator')"/>
</menupopup>
</menu>

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

@ -84,6 +84,65 @@ function goPreferences(id, paneURL, paneID)
var prefWindow = window.openDialog("chrome://communicator/content/pref/pref.xul","PrefWindow", "chrome,modal=" + modality+ ",resizable=yes", paneURL, paneID);
}
function okToCapture() {
var capture = document.getElementById("menu_capture");
if (!window._content.document) {
capture.setAttribute("disabled", "true");
return;
}
var formsArray = window._content.document.forms;
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if ((type=="" || type=="text") && value!="") {
capture.setAttribute("disabled", "false");
return;
}
}
}
capture.setAttribute("disabled", "true");
}
function okToPrefill() {
var prefill = document.getElementById("menu_prefill");
if (!window._content.document) {
prefill.setAttribute("disabled", "true");
return;
}
var formsArray = window._content.document.forms;
var form;
for (form=0; form<formsArray.length; form++) {
var elementsArray = formsArray[form].elements;
var element;
for (element=0; element<elementsArray.length; element++) {
var type = elementsArray[element].type;
var value = elementsArray[element].value;
if (type=="" || type=="text" || type=="select-one") {
prefill.setAttribute("disabled", "false");
return;
}
}
}
prefill.setAttribute("disabled", "true");
}
function capture()
{
if( appCore ) {
status = appCore.walletRequestToCapture(window._content);
}
}
function prefill()
{
if( appCore ) {
appCore.walletPreview(window, window._content);
}
}
function goToggleToolbar( id, elementID )
{
@ -209,6 +268,11 @@ function goUpdateGlobalEditMenuItems()
goUpdateCommand('cmd_delete');
}
function goUpdateFormsEditMenuItems() {
okToCapture();
okToPrefill();
}
// update menu items that rely on the current selection
function goUpdateSelectEditMenuItems()
{

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

@ -41,7 +41,7 @@
<key id="key_newNavigator" xulkey="true" shift="false" key="&newNavigatorCmd.key;" observes="cmd_newNavigator"/>
<!-- Edit Menu -->
<menu id="menu_Edit" value="&editMenu.label;" accesskey="&editMenu.accesskey;"/>
<menu id="menu_Edit" value="&editMenu.label;" accesskey="&editMenu.accesskey;" oncreate="goUpdateFormsEditMenuItems();"/>
<menuitem id="menu_undo" value="&undoCmd.label;" key="key_undo" accesskey="&undoCmd.accesskey;" observes="cmd_undo"/>
<menuitem id="menu_redo" value="&redoCmd.label;" key="key_redo" accesskey="&redoCmd.accesskey;" observes="cmd_redo"/>
<menuitem id="menu_cut" value="&cutCmd.label;" key="key_cut" accesskey="&cutCmd.accesskey;" observes="cmd_cut"/>
@ -49,6 +49,8 @@
<menuitem id="menu_paste" value="&pasteCmd.label;" key="key_paste" accesskey="&pasteCmd.accesskey;" observes="cmd_paste"/>
<menuitem id="menu_delete" value="&deleteCmd.label;" key="key_delete" accesskey="&deleteCmd.accesskey;" observes="cmd_delete"/>
<menuitem id="menu_selectAll" value="&selectAllCmd.label;" key="key_selectAll" accesskey="&selectAllCmd.accesskey;" observes="cmd_selectAll"/>
<menuitem id="menu_capture" value="&captureCmd.label;" key="key_capture" accesskey="&captureCmd.accesskey;" observes="cmd_capture"/>
<menuitem id="menu_prefill" value="&prefillCmd.label;" key="key_prefill" accesskey="&prefillCmd.accesskey;" observes="cmd_prefill"/>
<key id="key_undo" xulkey="true" key="&undoCmd.key;" shift="false" observes="cmd_undo"/>
<key id="key_redo" xulkey="true" key="&redoCmd.key;" shift="false" observes="cmd_redo"/>
@ -56,6 +58,10 @@
<key id="key_copy" xulkey="true" key="&copyCmd.key;" shift="false" observes="cmd_copy"/>
<key id="key_paste" xulkey="true" key="&pasteCmd.key;" shift="false" observes="cmd_paste"/>
<key id="key_selectAll" xulkey="true" key="&selectAllCmd.key;" shift="false" observes="cmd_selectAll"/>
<!--
<key id="key_capture" xulkey="true" key="&captureCmd.key;" shift="false" observes="cmd_capture"/>
<key id="key_prefill" xulkey="true" key="&prefillCmd.key;" shift="false" observes="cmd_prefill"/>
-->
<key id="key_preferences" observes="cmd_preferences"/>
<commandset id="globalEditMenuItems"
@ -100,6 +106,14 @@
<broadcaster id="cmd_selectAll"
oncommand="goDoCommand('cmd_selectAll')"
disabled="true"/>
<!--
<broadcaster id="cmd_capture"
oncommandupdate="okToCapture()"
disabled="true"/>
<broadcaster id="cmd_prefill"
oncommandupdate="okToPrefill()"
disabled="true"/>
-->
<!-- Not needed yet, window just needs a broadcaster with this id and oncommand= broadcaster id="cmd_preferences"/-->

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

@ -49,6 +49,12 @@
<!ENTITY preferencesCmd.label "Preferences...">
<!ENTITY preferencesCmd.key "E">
<!ENTITY preferencesCmd.accesskey "e">
<!ENTITY captureCmd.label "Save Form Data">
<!ENTITY captureCmd.key "S">
<!ENTITY captureCmd.accesskey "s">
<!ENTITY prefillCmd.label "Prefill Form">
<!ENTITY prefillCmd.key "F">
<!ENTITY prefillCmd.accesskey "f">
<!ENTITY viewMenu.label "View">
<!ENTITY viewMenu.accesskey "v">