Bug 70625: complex locked pref FE disabling

r=blake, sr=ben
This commit is contained in:
eddyk%netscape.com 2001-04-12 02:42:08 +00:00
Родитель ca335d3315
Коммит e00bb3c12b
21 изменённых файлов: 145 добавлений и 46 удалений

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

@ -156,9 +156,13 @@
<text class="label" value="&backgroundImage.label;" accesskey="&backgroundImage.accesskey;"/>
<box valign="middle" autostretch="never">
<textbox id="BackgroundImageInput" oninput="ChangeBackgroundImage();" style="min-width : 16em"/>
<textbox id="BackgroundImageInput" oninput="ChangeBackgroundImage();" style="min-width : 16em">
<observes element="backgroundImageData" attribute="disabled"/>
</textbox>
<button class="dialog" label="&chooseFile.label;" accesskey="&chooseFile.accesskey;"
oncommand="ChooseImageFile()"/>
oncommand="ChooseImageFile()">
<observes element="backgroundImageData" attribute="disabled"/>
</button>
<data id="backgroundImageData" pref="true" preftype="string" prefstring="editor.default_background_image" prefattribute="value"/>
</box>

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

@ -50,7 +50,10 @@
function setWarnAboutCookiesEnabled(aEnabled)
{
document.getElementById("networkWarnAboutCookies").disabled = !aEnabled;
var warnCheckbox = document.getElementById("networkWarnAboutCookies");
warnCheckbox.disabled = !aEnabled;
if (parent.hPrefWindow.getPrefIsLocked(warnCheckbox.getAttribute("prefstring")) )
warnCheckbox.disabled = true;
}
]]>
@ -85,8 +88,12 @@
<separator/>
<box autostretch="never" halign="right">
<button class="dialog" label="&viewCookies.label;" accesskey="&viewCookies.accesskey;" oncommand="viewCookies();"/>
<button class="dialog" label="&viewTutorial.label;" accesskey="&viewTutorial.accesskey;" oncommand="viewTutorial();"/>
<button class="dialog" label="&viewCookies.label;" accesskey="&viewCookies.accesskey;" oncommand="viewCookies();"
id="viewCookieButton" pref="true" preftype="bool"
prefstring="pref.advanced.cookies.disable_button.view_cookies" prefattribute="disabled"/>
<button class="dialog" label="&viewTutorial.label;" accesskey="&viewTutorial.accesskey;" oncommand="viewTutorial();"
id="moreInformation" pref="true" preftype="bool"
prefstring="pref.advanced.cookies.disable_button.more_info" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -64,7 +64,10 @@
function setWarnAboutImagesEnabled(aEnabled)
{
document.getElementById("networkImageWarnAboutImages").disabled = !aEnabled;
var warnCheckbox = document.getElementById("networkImageWarnAboutImages");
warnCheckbox.disabled = !aEnabled;
if (parent.hPrefWindow.getPrefIsLocked(warnCheckbox.getAttribute("prefstring")) )
warnCheckbox.disabled = true;
}
]]>
@ -108,7 +111,9 @@
<box autostretch="never" halign="right">
<button class="dialog" id="viewImages" label="&viewImages.label;"
accesskey="&viewImages.accesskey;" oncommand="viewImages();"
observes="haveImageBlocking"/>
observes="haveImageBlocking"
pref="true" preftype="bool"
prefstring="pref.advanced.images.disable_button.view_image" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -78,7 +78,9 @@
</box>
<box autostretch="never" halign="right">
<button class="dialog" label="&viewSignons.label;" accesskey="&viewSignons.accesskey;"
oncommand="viewSignons();"/>
oncommand="viewSignons();"
id="viewStoredPassword" pref="true" preftype="bool"
prefstring="pref.advanced.password.disable_button.view_stored_password" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -86,11 +86,15 @@
<button class="dialog"
label="&viewWallet.label;"
accesskey="&viewWallet.accesskey;"
oncommand="formShow();"/>
oncommand="formShow();"
id="viewFormButton" pref="true" preftype="bool"
prefstring="pref.advanced.form.disable_button.view_form" prefattribute="disabled"/>
<button class="dialog"
label="&viewWalletSites.label;"
accesskey="&viewWalletSites.accesskey;"
oncommand="viewWalletSites();"/>
oncommand="viewWalletSites();"
id="viewSiteButton" pref="true" preftype="bool"
prefstring="pref.advanced.form.disable_button.view_sites" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -16,7 +16,6 @@
"emailCollectionOutgoing", "emailCollectionNewsgroup",
"addressingAutocomplete", "enableCABsizeLimit",
"CABsizeLimit"];
]]>
function Startup(){
doEnabling();
@ -33,7 +32,7 @@
var CABsizeLimit = document.getElementById("CABsizeLimit");
var useCABSizelimitPart2 = document.getElementById("useCABSizelimitPart2");
if( emailCollection.checked ){
if( emailCollection.checked && !emailCollection.disabled ){
emailCollectionIncoming.removeAttribute("disabled");
emailCollectionOutgoing.removeAttribute("disabled");
emailCollectionNewsgroup.removeAttribute("disabled");
@ -52,6 +51,7 @@
}
}
]]>
</script>
<box class="box-smallheader" title="&pane.title;"/>

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

@ -88,7 +88,10 @@ Contributor(s):
<box autostretch="never" halign="right">
<button class="dialog" label="&useDefault.label;" accesskey="&useDefault.accesskey;"
oncommand="setHomePageToDefaultPage('mailnewsStartPageUrl');" />
id="resetHomePageButton"
oncommand="setHomePageToDefaultPage('mailnewsStartPageUrl');">
<observes element="mailnewsStartPageUrl" attribute="disabled"/>
</button>
</box>
</titledbox>

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

@ -27,7 +27,7 @@
{
var quotebox = document.getElementById("thenBox");
var quotecheck = document.getElementById("autoQuote");
if( quotecheck.checked ) {
if( quotecheck.checked && !quotecheck.disabled ) {
quotebox.firstChild.removeAttribute("disabled");
quotebox.lastChild.removeAttribute("disabled");
}

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

@ -72,8 +72,12 @@
</tree>
<box orient="horizontal">
<spring flex="1"/>
<button class="dialog" label="&AddButton.label;" oncommand="AddDomain(htmlobj);"/>
<button class="dialog" label="&DeleteButton.label;" oncommand="RemoveDomains(htmlobj);"/>
<button class="dialog" label="&AddButton.label;" oncommand="AddDomain(htmlobj);">
<observes element="mailhtmldomain" attribute="disabled"/>
</button>
<button class="dialog" label="&DeleteButton.label;" oncommand="RemoveDomains(htmlobj);">
<observes element="mailhtmldomain" attribute="disabled"/>
</button>
<spring flex="1"/>
</box>
</titledbox>
@ -89,8 +93,12 @@
</tree>
<box orient="horizontal">
<spring flex="1"/>
<button class="dialog" label="&AddButton.label;" oncommand="AddDomain(plainobj);"/>
<button class="dialog" label="&DeleteButton.label;" oncommand="RemoveDomains(plainobj);"/>
<button class="dialog" label="&AddButton.label;" oncommand="AddDomain(plainobj);">
<observes element="mailplaintextdomain" attribute="disabled"/>
</button>
<button class="dialog" label="&DeleteButton.label;" oncommand="RemoveDomains(plainobj);">
<observes element="mailplaintextdomain" attribute="disabled"/>
</button>
<spring flex="1"/>
</box>
</titledbox>

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

@ -99,7 +99,9 @@
<box autostretch="never">
<textbox readonly="true" id="defaultFolder" crop="right" flex="1"/>
<button label="&chooseDefaultFolder.label;" accesskey="&chooseDefaultFolder.accesskey;"
oncommand="chooseDefaultFolder();"/>
oncommand="chooseDefaultFolder();"
id="browser.bookmarks.choosefolder" pref="true" preftype="bool"
prefstring="pref.browser.homepage.disable_button.choose_folder" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -8,6 +8,7 @@ var gPrefApplicationsBundle = null;
var gExtensionField = null;
var gMIMETypeField = null;
var gHandlerField = null;
var gNewTypeButton = null;
var gEditButton = null;
var gRemoveButton = null;
@ -56,12 +57,14 @@ function Startup()
gExtensionField = document.getElementById("extension");
gMIMETypeField = document.getElementById("mimeType");
gHandlerField = document.getElementById("handler");
gNewTypeButton = document.getElementById("newTypeButton");
gEditButton = document.getElementById("editButton");
gRemoveButton = document.getElementById("removeButton");
// Disable the Edit & Remove buttons until we click on something
gEditButton.disabled=true;
gRemoveButton.disabled=true;
updateLockedButtonState();
const mimeTypes = "UMimTyp";
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"].getService();
@ -108,5 +111,15 @@ function selectApplication()
}
delete handlerOverride;
updateLockedButtonState();
}
}
// disable locked buttons
function updateLockedButtonState()
{
gNewTypeButton.disabled = parent.hPrefWindow.getPrefIsLocked(gNewTypeButton.getAttribute("prefstring") );
gEditButton.disabled = parent.hPrefWindow.getPrefIsLocked(gEditButton.getAttribute("prefstring"));
gRemoveButton.disabled = parent.hPrefWindow.getPrefIsLocked(gRemoveButton.getAttribute("prefstring"));
}

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

@ -84,13 +84,19 @@
<box orient="vertical">
<button id="newTypeButton"
label="&newTypeButton.label;" accesskey="&newTypeButton.accesskey;"
oncommand="newType();"/>
oncommand="newType();"
pref="true" preftype="bool"
prefstring="pref.application.disable_button.new_type" prefattribute="disabled"/>
<button id="editButton"
label="&editButton.label;" accesskey="&editButton.accesskey;"
oncommand="editType();"/>
oncommand="editType();"
pref="true" preftype="bool"
prefstring="pref.application.disable_button.edit" prefattribute="disabled"/>
<button id="removeButton"
label="&removeButton.label;" accesskey="&removeButton.accesskey;"
oncommand="removeType();"/>
oncommand="removeType();"
pref="true" preftype="bool"
prefstring="pref.application.disable_button.remove" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -65,7 +65,9 @@
<text class="label" value="&kbyes;"/>
</box>
<button class="dialog" label="&clearMemCache.label;" accesskey="&clearMemCache.accesskey;"
oncommand="prefClearMemCache();"/>
oncommand="prefClearMemCache();"
id="clearMemCache" pref="true" preftype="bool"
prefstring="pref.advanced.cache.disable_button.clear_memory" prefattribute="disabled"/>
</row>
<row>
<text class="label" value="&diskCache.label;" accesskey="&diskCache.accesskey;" for="browserCacheDiskCache"/>
@ -75,7 +77,9 @@
<text class="label" value="&kbyes;"/>
</box>
<button class="dialog" label="&clearDiskCache.label;" accesskey="&clearDiskCache.accesskey;"
oncommand="prefClearDiskCache();"/>
oncommand="prefClearDiskCache();"
id="clearDiskCache" pref="true" preftype="bool"
prefstring="pref.advanced.cache.disable_button.clear_disk" prefattribute="disabled"/>
</row>
</rows>
</grid>

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

@ -46,7 +46,8 @@
try {
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
.getService(Components.interfaces.nsIUrlbarHistory);
button.disabled = urlBarHist.count == 0;
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(button.getAttribute("prefstring"));
button.disabled = ( urlBarHist.count == 0 ) || isBtnLocked ;
}
catch(ex) {
}
@ -112,7 +113,9 @@
<text class="label" value="&days.label;"/>
<spring flex="1"/>
<button class="dialog" label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
oncommand="prefClearGlobalHistory();"/>
oncommand="prefClearGlobalHistory();"
id="browserClearHistory" pref="true" preftype="bool"
prefstring="pref.browser.history.disable_button.clear_hist" prefattribute="disabled"/>
</box>
</titledbox>
@ -123,7 +126,9 @@
<html flex="1">&clearLocationBar.label;</html>
<box autostretch="never" halign="right">
<button class="dialog" id="ClearUrlBarHistoryButton" label="&clearLocationBarButton.label;" accesskey="&clearLocationBarButton.accesskey;"
oncommand="prefClearUrlbarHistory();"/>
oncommand="prefClearUrlbarHistory();"
pref="true" preftype="bool"
prefstring="pref.browser.history.disable_button.clear_urlbar" prefattribute="disabled"/>
</box>
</box>
</titledbox>

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

@ -116,6 +116,7 @@ function Init()
LoadAvailableLanguages();
}
SelectLanguage();
}
@ -581,7 +582,6 @@ function MoveDown() {
function SelectLanguage() {
if (active_languages.selectedItems.length) {
document.getElementById("remove").disabled = false;
var selected = active_languages.selectedItems[0];
@ -594,4 +594,13 @@ function SelectLanguage() {
document.getElementById("down").disabled = true;
document.getElementById("up").disabled = true;
}
if (parent.hPrefWindow.getPrefIsLocked(document.getElementById("up").getAttribute("prefstring")))
document.getElementById("up").disabled = true;
if (parent.hPrefWindow.getPrefIsLocked(document.getElementById("down").getAttribute("prefstring")))
document.getElementById("down").disabled = true;
if (parent.hPrefWindow.getPrefIsLocked(document.getElementById("add").getAttribute("prefstring")))
document.getElementById("add").disabled = true;
if (parent.hPrefWindow.getPrefIsLocked(document.getElementById("remove").getAttribute("prefstring")))
document.getElementById("remove").disabled = true;
} // SelectLanguage

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

@ -66,17 +66,25 @@
<box orient="vertical">
<button oncommand="MoveUp();" id="up" class="up" disabled="true"
label="&languages.customize.moveUp.label;"
accesskey="&languages.customize.moveUp.accesskey;"/>
accesskey="&languages.customize.moveUp.accesskey;"
pref="true" preftype="bool"
prefstring="pref.browser.language.disable_button.up" prefattribute="disabled"/>
<button oncommand="MoveDown();" id="down" class="down" disabled="true"
label="&languages.customize.moveDown.label;"
accesskey="&languages.customize.moveDown.accesskey;"/>
accesskey="&languages.customize.moveDown.accesskey;"
pref="true" preftype="bool"
prefstring="pref.browser.language.disable_button.down" prefattribute="disabled"/>
<spring flex="1"/>
<button class="dialog" id="add"
label="&languages.customize.addButton.label;"
oncommand="AddLanguage();"/>
oncommand="AddLanguage();"
pref="true" preftype="bool"
prefstring="pref.browser.language.disable_button.add" prefattribute="disabled"/>
<button class="dialog" id="remove" disabled="true"
label="&languages.customize.deleteButton.label;"
oncommand="RemoveActiveLanguage();"/>
oncommand="RemoveActiveLanguage();"
pref="true" preftype="bool"
prefstring="pref.browser.language.disable_button.remove" prefattribute="disabled"/>
</box>
</box>
</titledbox>

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

@ -101,7 +101,8 @@
<titledbox orient="vertical">
<label>
<box>
<menulist id="mouseWheelMode" oncommand="switchPage(this);">
<menulist id="mouseWheelMode" oncommand="switchPage(this);"
pref="true" preftype="bool" prefstring="pref.mousewheel.disable_button.modifier" prefattribute="disabled">
<menupopup>
<menuitem value="0" label="&usingJustTheWheel.label;"/>
<menuitem value="1" label="&usingWheelAndAlt.label;"/>

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

@ -73,9 +73,13 @@
</box>
<box autostretch="never" halign="right">
<button class="dialog" label="&useCurrent.label;" accesskey="&useCurrent.accesskey;"
oncommand="setHomePageToCurrentPage();"/>
oncommand="setHomePageToCurrentPage();"
id="browserUseCurrent" pref="true" preftype="bool"
prefstring="pref.browser.homepage.disable_button.current_page" prefattribute="disabled"/>
<button class="dialog" label="&browseFile.label;" accesskey="&browseFile.accesskey;"
oncommand="selectFile();"/>
oncommand="selectFile();"
id="browserChooseFile" pref="true" preftype="bool"
prefstring="pref.browser.homepage.disable_button.select_file" prefattribute="disabled"/>
</box>
</titledbox>

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

@ -52,6 +52,7 @@ function DoEnabling()
case "1":
for (i = 0; i < auto.length; i++)
auto[i].setAttribute( "disabled", "true" );
if (!radiogroup.disabled)
for (i = 0; i < manual.length; i++)
manual[i].removeAttribute( "disabled" );
break;
@ -59,6 +60,7 @@ function DoEnabling()
default:
for (i = 0; i < manual.length; i++)
manual[i].setAttribute( "disabled", "true" );
if (!radiogroup.disabled)
for (i = 0; i < auto.length; i++)
auto[i].removeAttribute( "disabled" );
break;

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

@ -138,7 +138,9 @@
<textbox id="networkProxyAutoconfigURL" flex="1"
pref="true" preftype="string" prefstring="network.proxy.autoconfig_url"
prefattribute="value"/>
<button id="autoReload" class="dialog" label="&reload.label;" accesskey="&reload.accesskey;"/>
<button id="autoReload" class="dialog" label="&reload.label;" accesskey="&reload.accesskey;"
pref="true" preftype="bool"
prefstring="pref.advanced.proxies.disable_button.reload" prefattribute="disabled"/>
</box>
</radiogroup>

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

@ -141,11 +141,16 @@
function doButtonEnabling()
{
var addDomain = document.getElementById("addDomain");
var addDomainButton = document.getElementById("addDomainButton");
var prefstring = document.getElementById("browserRelatedDisabledForDomains").getAttribute("value");
if( addDomain.value == "" || prefstring.indexOf( addDomain.value + "," ) != -1 )
document.getElementById("addDomainButton").setAttribute("disabled","true");
addDomainButton.disabled = true;
else
document.getElementById("addDomainButton").removeAttribute("disabled");
addDomainButton.removeAttribute("disabled");
if (parent.hPrefWindow.getPrefIsLocked(addDomainButton.getAttribute("prefstring")))
addDomainButton.disabled = true;
if (parent.hPrefWindow.getPrefIsLocked(addDomain.getAttribute("prefstring")))
addDomain.disabled = true;
}
function moreInfo()
@ -199,16 +204,19 @@
</tree>
<box autostretch="never" valign="top">
<button class="dialog" id="removeDomain" label="&removeDomain.label;" accesskey="&removeDomain.accesskey;"
oncommand="removeDomain();"/>
oncommand="removeDomain();" pref="true" preftype="bool"
prefstring="pref.browser.smartbrowsing.disable_button.remove" prefattribute="disabled"/>
</box>
</row>
<row>
<box autostretch="never">
<text class="label" id="domainText" value="&domain.label;" accesskey="&domain.accesskey;" for="addDomain"/>
<textbox id="addDomain" flex="1" oninput="doButtonEnabling();"/>
<textbox id="addDomain" flex="1" oninput="doButtonEnabling();"
prefstring="pref.browser.smartbrowsing.disable_textbox.add" prefattribute="disabled"/>
</box>
<button disabled="true" class="dialog" id="addDomainButton" label="&addDomain.label;" accesskey="&addDomain.accesskey;"
oncommand="addDomain();"/>
oncommand="addDomain();" pref="true" preftype="bool"
prefstring="pref.browser.smartbrowsing.disable_button.add" prefattribute="disabled"/>
</row>
</rows>
</grid>
@ -228,7 +236,9 @@
pref="true" preftype="bool" prefstring="keyword.enabled"
prefattribute="checked"/>
<spring flex="1"/>
<button class="dialog" label="&moreInformation.label;" accesskey="&moreInformation.accesskey;" oncommand="moreInfo();"/>
<button class="dialog" label="&moreInformation.label;" accesskey="&moreInformation.accesskey;" oncommand="moreInfo();"
id="moreInformationButton" pref="true" preftype="bool"
prefstring="pref.browser.smartbrowsing.disable_button.more_info" prefattribute="disabled"/>
</box>
</titledbox>