mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
Fix bug 67073, remove form toolbar. r=jag, blake, jst, a=brendan
8:51 PM 2/2/2001
This commit is contained in:
parent
bcd3bcd8e5
commit
057c8f33a3
@ -281,8 +281,6 @@ nsXULBrowserWindow.prototype =
|
||||
stopMenu.setAttribute("disabled", true);
|
||||
stopContext.setAttribute("disabled", true);
|
||||
|
||||
// Set buttons in form menu
|
||||
setFormToolbar();
|
||||
}
|
||||
}
|
||||
else if (state & nsIWebProgressListener.STATE_TRANSFERRING) {
|
||||
@ -1290,111 +1288,3 @@ function checkForDefaultBrowser()
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function formCapture()
|
||||
{
|
||||
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
|
||||
walletService.WALLET_RequestToCapture(window._content);
|
||||
}
|
||||
|
||||
function formPrefill()
|
||||
{
|
||||
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
|
||||
walletService.WALLET_Prefill(false, window._content);
|
||||
|
||||
window.openDialog("chrome://communicator/content/wallet/WalletPreview.xul",
|
||||
"_blank", "chrome,modal=yes,dialog=yes,all, width=504, height=436");
|
||||
}
|
||||
|
||||
function formShow()
|
||||
{
|
||||
window.openDialog(
|
||||
"chrome://communicator/content/wallet/WalletViewer.xul",
|
||||
"WalletViewer",
|
||||
"chrome,titlebar,modal=yes,resizable=yes");
|
||||
// if a stored value changed, we might need to enable/disable the prefill-form button
|
||||
setFormToolbar(); // in case we need to change state of prefill-form button
|
||||
}
|
||||
|
||||
function setFormToolbar()
|
||||
{
|
||||
|
||||
var formToolbar = document.getElementById("FormToolbar");
|
||||
if (!formToolbar) {
|
||||
return;
|
||||
}
|
||||
|
||||
// keep form toolbar hidden if checkbox in view menu so indicates
|
||||
|
||||
var cmd_viewformToolbar = document.getElementById("cmd_viewformtoolbar");
|
||||
if (cmd_viewformToolbar) {
|
||||
var checkValue = cmd_viewformToolbar.getAttribute("checked");
|
||||
if (checkValue == "false") {
|
||||
formToolbar.setAttribute("hidden", "true");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// hide form toolbar if there is no form on the current page
|
||||
|
||||
if (!window._content.document) {
|
||||
formToolbar.setAttribute("hidden", "true");
|
||||
return;
|
||||
}
|
||||
var formsArray = window._content.document.forms;
|
||||
if (!formsArray || formsArray.length == 0) {
|
||||
formToolbar.setAttribute("hidden", "true");
|
||||
return;
|
||||
}
|
||||
formToolbar.removeAttribute("hidden");
|
||||
return; // skip disabling the prefill button for now -- it was causing leak and bloat
|
||||
|
||||
// enable prefill button if there is at least one saved value for the form
|
||||
|
||||
var formPrefill = document.getElementById("formPrefill");
|
||||
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
|
||||
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;
|
||||
if (type=="" || type=="text" || type=="select-one") {
|
||||
var value = walletService.WALLET_PrefillOneElement
|
||||
(window._content, elementsArray[element]);
|
||||
if (value != "") {
|
||||
// element has a saved value, thus prefill button is to appear in toolbar
|
||||
formPrefill.setAttribute("disabled", "false");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
formPrefill.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
// Can't use generic goToggleToolbar (see utilityOverlay.js) for form menu because
|
||||
// form toolbar could be hidden even when the checkbox in the view menu is checked
|
||||
function goToggleFormToolbar( id, elementID )
|
||||
{
|
||||
var toolbar = document.getElementById(id);
|
||||
var element = document.getElementById(elementID);
|
||||
if (element) {
|
||||
var checkValue = element.getAttribute("checked");
|
||||
if (checkValue == "false") {
|
||||
element.setAttribute("checked","true")
|
||||
if (toolbar) {
|
||||
setFormToolbar();
|
||||
}
|
||||
} else {
|
||||
element.setAttribute("checked","false")
|
||||
if (toolbar) {
|
||||
toolbar.setAttribute("hidden", true );
|
||||
}
|
||||
}
|
||||
document.persist(id, 'hidden');
|
||||
document.persist(elementID, 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -287,20 +287,6 @@ Contributor(s): ______________________________________. -->
|
||||
|
||||
</toolbar>
|
||||
|
||||
<!-- Form toolbar items -->
|
||||
<toolbar id="FormToolbar" class="chromeclass-directories"
|
||||
persist="collapsed" hidden="true">
|
||||
<button class="button-toolbar-3 top" id="formPrefill" crop="right"
|
||||
oncommand="formPrefill();"
|
||||
value="&formPrefill.label;" tooltip="aTooltip" tooltiptext="&formPrefill.tooltip;"/>
|
||||
<button class="button-toolbar-3 top" id="formCapture" crop="right"
|
||||
oncommand="formCapture();"
|
||||
value="&formCapture.label;" tooltip="aTooltip" tooltiptext="&formCapture.tooltip;"/>
|
||||
<button class="button-toolbar-3 top" id="formShow" crop="right"
|
||||
oncommand="formShow();"
|
||||
value="&formView.label;" tooltip="aTooltip" tooltiptext="&formView.tooltip;"/>
|
||||
</toolbar>
|
||||
|
||||
</toolbox>
|
||||
|
||||
<box flex="1" >
|
||||
|
@ -124,7 +124,6 @@
|
||||
<!-- View Menu -->
|
||||
<broadcaster id="cmd_viewnavbar" value="&navbarCmd.label;" accesskey="&navbarCmd.accesskey;" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar( 'nav-bar','cmd_viewnavbar');" checked="true"/>
|
||||
<broadcaster id="cmd_viewpersonaltoolbar" value="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
|
||||
<broadcaster id="cmd_viewformtoolbar" value="&formbarCmd.label;" accesskey="&formbarCmd.accesskey;" class="menuitem-iconic" type="checkbox" oncommand="goToggleFormToolbar('FormToolbar','cmd_viewformtoolbar');" checked="false"/>
|
||||
<broadcaster id="cmd_viewtaskbar" value="&taskbarCmd.label;" accesskey="&taskbarCmd.accesskey;" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
|
||||
|
||||
<broadcaster id="View:PageSource" oncommand="BrowserViewSource();"/>
|
||||
@ -203,7 +202,6 @@
|
||||
<menupopup id="view_toolbars_popup">
|
||||
<menuitem observes="cmd_viewnavbar" />
|
||||
<menuitem observes="cmd_viewpersonaltoolbar" />
|
||||
<menuitem observes="cmd_viewformtoolbar" />
|
||||
<menuitem observes="cmd_viewtaskbar" />
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
@ -46,8 +46,6 @@
|
||||
<!ENTITY navbarCmd.accesskey "n">
|
||||
<!ENTITY personalbarCmd.label "Personal Toolbar">
|
||||
<!ENTITY personalbarCmd.accesskey "p">
|
||||
<!ENTITY formbarCmd.label "Form Toolbar">
|
||||
<!ENTITY formbarCmd.accesskey "f">
|
||||
<!ENTITY taskbarCmd.label "Taskbar">
|
||||
<!ENTITY taskbarCmd.accesskey "t">
|
||||
|
||||
@ -272,14 +270,6 @@
|
||||
<!ENTITY bookmarksButton.tooltip "Bookmarks list">
|
||||
<!ENTITY homeButton.label "Home">
|
||||
|
||||
<!-- Wallet Toolbar items -->
|
||||
<!ENTITY formPrefill.label "Prefill Form">
|
||||
<!ENTITY formCapture.label "Save Form Data">
|
||||
<!ENTITY formView.label "View Saved Data">
|
||||
<!ENTITY formPrefill.tooltip "Prefill this form with previously-saved data">
|
||||
<!ENTITY formCapture.tooltip "Save data found on this form">
|
||||
<!ENTITY formView.tooltip "View previously-saved data for this form">
|
||||
|
||||
<!-- LOCALIZATION NOTE (bugzillaButton.label) : DONT_TRANSLATE -->
|
||||
<!ENTITY bugzillaButton.label "Bugzilla">
|
||||
<!-- LOCALIZATION NOTE (tinderboxButton.label) : DONT_TRANSLATE -->
|
||||
|
Loading…
Reference in New Issue
Block a user