Bug 260364 Fixup radiogroups to use new .value functionality of radio.xml - mail patch

p=me r=mscott
This commit is contained in:
bugzilla%arlen.demon.co.uk 2004-10-24 17:41:57 +00:00
Родитель 76635c5c4f
Коммит a0b5babac8
2 изменённых файлов: 3 добавлений и 141 удалений

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

@ -1,126 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE dialog [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % masterPassDTD SYSTEM "chrome://messenger/locale/pref-masterpass.dtd" >
%masterPassDTD;
]>
<dialog id="masterPassword"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&dialog.title;"
onload="onLoad();"
style="width: 40em;"
ondialogaccept="return onAccept();">
<script type="application/x-javascript" src="chrome://pippki/content/pref-masterpass.js"/>
<script>
<![CDATA[
var gPrefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
function onLoad()
{
var el = document.getElementById('encryptEnabled');
el.checked = gPrefService.getBoolPref(el.getAttribute("prefstring"));
var el = document.getElementById('passwordTimeout');
el.setAttribute("value", gPrefService.getIntPref(el.getAttribute("prefstring")) );
el = document.getElementById('passwordAskTimes');
el.selectedItem = el.getElementsByAttribute('value', gPrefService.getIntPref(el.getAttribute("prefstring")))[0];
onMasterPasswordLoad();
}
function onAccept()
{
var el = document.getElementById('encryptEnabled');
gPrefService.setBoolPref(el.getAttribute("prefstring"), el.checked);
var el = document.getElementById('passwordAskTimes');
gPrefService.setIntPref(el.getAttribute("prefstring"), parseInt(el.value));
var el = document.getElementById('passwordTimeout');
gPrefService.setIntPref(el.getAttribute("prefstring"), parseInt(el.value) );
}
function initReencryptCallback()
{
var wallet = Components.classes['@mozilla.org/wallet/wallet-service;1'];
wallet = wallet.getService();
wallet = wallet.QueryInterface(Components.interfaces.nsIWalletService);
wallet.WALLET_InitReencryptCallback(window);
}
]]>
</script>
<groupbox>
<caption label="&encryptHeader.label;"/>
<description width="1">&encryptDescription.label;</description>
<vbox align="start">
<checkbox id="encryptEnabled" label="&encryptEnabled.label;" accesskey="&encryptEnabled.accesskey;"
prefstring="wallet.crypto"
oncommand="initReencryptCallback();"/>
</vbox>
</groupbox>
<!-- Change Password -->
<groupbox>
<caption label="&changepassword.label;"/>
<description width="1">&changepassword.text;</description>
<hbox align="center">
<button label="&changepassword.button;"
oncommand="ChangePW();"
id="changePasswordButton"
accesskey="&changepassword.accesskey;"
prefstring="security.disable_button.changePassword"/>
</hbox>
</groupbox>
<!-- Password Prefs -->
<groupbox>
<checkbox id="askEveryTimeHidden" value="false" checked="false" hidden="true"/>
<caption label="&managepassword.label;"/>
<description width="1">&managepassword.text;</description>
<hbox align="center">
<radiogroup id="passwordAskTimes"
prefstring="security.ask_for_password"
flex="1">
<!-- note that these values are different than what NSS uses, which
are (0, -1, 1) respectively -->
<radio value="0" label="&managepassword.askfirsttime;" id="askFirstTime"
style="margin: 0px;" oncommand="changePasswordSettings(false);"/>
<radio value="1" label="&managepassword.askeverytime;" id="askEveryTime"
style="margin: 0px;" oncommand="changePasswordSettings(false);"/>
<hbox align="center">
<radio value="2" label="&managepassword.asktimeout;" id="askTimeout"
style="margin: 0px;" oncommand="changePasswordSettings(true);"/>
<textbox id="passwordTimeout" size="4"
preftype="int"
prefstring="security.password_lifetime"
oninput="changePasswordSettings(false);"/>
<label value="&managepassword.timeout.unit;" style="margin: 4px;"/>
</hbox>
</radiogroup>
</hbox>
</groupbox>
<!-- Reset Password -->
<groupbox>
<caption label="&resetpassword.label;"/>
<description width="1">&resetpassword.text;</description>
<hbox align="center">
<button label="&resetpassword.button;"
oncommand="ResetPW();"
id="resetPasswordButton"
accesskey="&resetpassword.accesskey;"
prefstring="security.disable_button.resetPassword"/>
</hbox>
</groupbox>
</dialog>

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

@ -62,19 +62,7 @@ function onInit()
gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name");
var selectedItemId = null;
var encryptionPolicy = gIdentity.getIntAttribute("encryptionpolicy");
switch (encryptionPolicy)
{
case 2:
selectedItemId = 'encrypt_mail_always';
break;
default:
selectedItemId = 'encrypt_mail_never';
break;
}
gEncryptionChoices.selectedItem = document.getElementById(selectedItemId);
gEncryptionChoices.value = gIdentity.getIntAttribute("encryptionpolicy");
if (!gEncryptionCertName.value)
{
@ -112,7 +100,7 @@ function onPreInit(account, accountValues)
function onSave()
{
// find out which radio for the encryption radio group is selected and set that on our hidden encryptionChoice pref....
var newValue = gEncryptionChoices.selectedItem.value;
var newValue = gEncryptionChoices.value;
gHiddenEncryptionPolicy.setAttribute('value', newValue);
gIdentity.setIntAttribute("encryptionpolicy", newValue);
gIdentity.setUnicharAttribute("encryption_cert_name", gEncryptionCertName.value);
@ -343,7 +331,7 @@ function enableEncryptionControls(do_enable)
else {
gEncryptAlways.setAttribute("disabled", "true");
gNeverEncrypt.setAttribute("disabled", "true");
gEncryptionChoices.selectedItem = document.getElementById('encrypt_mail_never');
gEncryptionChoices.value = 0;
}
}