Bug ##115962 --> convert the security panel to match the spec.

r=kai
sr=sspitzer
This commit is contained in:
mscott%netscape.com 2001-12-21 01:22:25 +00:00
Родитель 08c4e835c3
Коммит 6a306e27e2
6 изменённых файлов: 89 добавлений и 63 удалений

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

@ -23,8 +23,8 @@
var gIdentity;
var gPref = null;
var gEncryptionCertName = null;
var gEncryptIfPossible = null;
var gEncryptAlways = null;
var gHiddenEncryptionPolicy = null;
var gEncryptionChoices = null;
var gSignCertName = null;
var gSignMessages = null;
@ -32,21 +32,37 @@ function onInit()
{
// initialize all of our elements based on the current identity values....
gEncryptionCertName = document.getElementById("identity.encryption_cert_name");
gEncryptIfPossible = document.getElementById("identity.encrypt_mail_if_possible");
gEncryptAlways = document.getElementById("identity.encrypt_mail_always");
gHiddenEncryptionPolicy = document.getElementById("identity.encryptionpolicy");
gEncryptionChoices = document.getElementById("encryptionChoices");
gSignCertName = document.getElementById("identity.signing_cert_name");
gSignMessages = document.getElementById("identity.sign_mail");
gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name");
gEncryptIfPossible.checked = gIdentity.getBoolAttribute("encrypt_mail_if_possible");
gEncryptAlways.checked = gIdentity.getBoolAttribute("encrypt_mail_always");
var selectedItemId = null;
var encryptionPolicy = gIdentity.getIntAttribute("encryptionpolicy");
switch (encryptionPolicy)
{
case 1:
selectedItemId = 'encrypt_mail_if_possible';
break;
case 2:
selectedItemId = 'encrypt_mail_always';
break;
default:
selectedItemId = 'encrypt_mail_never';
break;
}
gEncryptionChoices.selectedItem = document.getElementById(selectedItemId);
if (!gEncryptionCertName.value)
{
gEncryptAlways.setAttribute("disabled", true);
}
// we currently don't support encrypt if possible so keep it disabled for now...
gEncryptIfPossible.setAttribute("disabled", true);
document.getElementById('encrypt_mail_if_possible').setAttribute("disabled", true);
gSignCertName.value = gIdentity.getUnicharAttribute("signing_cert_name");
gSignMessages.checked = gIdentity.getBoolAttribute("sign_mail");
@ -63,6 +79,9 @@ 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;
gHiddenEncryptionPolicy.setAttribute('value', newValue);
}
function onLockPreference()

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

@ -39,58 +39,61 @@ Contributors:
<dialogheader title="&securityTitle.label;" />
<groupbox orient="vertical" id="encryption.titlebox">
<caption label="&encryptionGroupTitle.label;"/>
<label hidden="true" wsm_persist="true" id="identity.encryptionpolicy" genericattr="true"
pref="true" preftype="int" prefattribute="value"
prefstring="mail.identity.%identitykey%.encryptionpolicy"/>
<label value="&encryptionCert.message;"/>
<separator class="thin"/>
<textbox id="identity.encryption_cert_name" iscontrolcontainer="true" wsm_persist="true" genericattr="true" flex="1"
pref="true" preftype="wstring" prefattribute="value"
prefstring="mail.identity.%identitykey%.encryption_cert_name" readonly="true" disabled="true"/>
<separator class="thin"/>
<hbox>
<spacer flex="1"/>
<button id="encryptionCertSelectButton"
label="&certificate.button;"
oncommand="smimeSelectCert('identity.encryption_cert_name')"/>
</hbox>
<checkbox id="identity.encrypt_mail_if_possible" iscontrolcontainer="true" wsm_persist="true" genericattr="true" pref="true"
preftype="bool" prefattribute="value"
prefstring="mail.identity.%identitykey%.encrypt_mail_if_possible"
label="&ifPossibleEncryptMessage.label;" />
<checkbox id="identity.encrypt_mail_always" iscontrolcontainer="true" wsm_persist="true" genericattr="true" pref="true"
preftype="bool" prefattribute="value"
prefstring="mail.identity.%identitykey%.encrypt_mail_always"
label="&alwaysEncryptMessage.label;" />
</groupbox>
<separator class="thin"/>
<groupbox orient="vertical" id="signing.titlebox">
<caption label="&signingGroupTitle.label;"/>
<label value="&signingCert.message;"/>
<separator class="thin"/>
<textbox id="identity.signing_cert_name" iscontrolcontainer="true" wsm_persist="true" genericattr="true" flex="1"
pref="true" preftype="wstring" prefattribute="value"
prefstring="mail.identity.%identitykey%.signing_cert_name" readonly="true" disabled="true"/>
<separator class="thin"/>
<hbox>
<spacer flex="1"/>
<button id="signingCertSelectButton"
label="&certificate.button;"
oncommand="smimeSelectCert('identity.signing_cert_name')"/>
</hbox>
<checkbox id="identity.sign_mail" iscontrolcontainer="true" wsm_persist="true" genericattr="true" pref="true"
preftype="bool" prefattribute="value"
prefstring="mail.identity.%identitykey%.sign_mail"
label="&signMessage.label;"/>
<separator class="thin"/>
<label value="&signingCert.message;"/>
<hbox>
<textbox id="identity.signing_cert_name" iscontrolcontainer="true" wsm_persist="true" genericattr="true" flex="1"
pref="true" preftype="wstring" prefattribute="value"
prefstring="mail.identity.%identitykey%.signing_cert_name" readonly="true" disabled="true"/>
<button id="signingCertSelectButton"
label="&certificate.button;"
oncommand="smimeSelectCert('identity.signing_cert_name')"/>
</hbox>
</groupbox>
<separator class="thin"/>
<groupbox orient="vertical" id="encryption.titlebox">
<caption label="&encryptionGroupTitle.label;"/>
<label value="&encryptionChoiceLabel.label;"/>
<radiogroup id="encryptionChoices">
<radio id="encrypt_mail_never" wsm_persist="true" value="0"
label="&neverEncrypt.label;" />
<radio id="encrypt_mail_if_possible" wsm_persist="true" value="1"
label="&ifPossibleEncryptMessage.label;" />
<radio id="encrypt_mail_always" wsm_persist="true" value="2"
label="&alwaysEncryptMessage.label;" />
</radiogroup>
<separator class="thin"/>
<label value="&encryptionCert.message;"/>
<hbox>
<textbox id="identity.encryption_cert_name" iscontrolcontainer="true" wsm_persist="true" genericattr="true" flex="1"
pref="true" preftype="wstring" prefattribute="value"
prefstring="mail.identity.%identitykey%.encryption_cert_name" readonly="true" disabled="true"/>
<button id="encryptionCertSelectButton"
label="&certificate.button;"
oncommand="smimeSelectCert('identity.encryption_cert_name')"/>
</hbox>
</groupbox>
</page>

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

@ -38,7 +38,10 @@ function GetSecurityInfo()
{
msgCompFields.securityInfo = smimeComposefields;
// set up the intial security state....
smimeComposefields.alwaysEncryptMessage = gCurrentIdentity.getBoolAttribute("encrypt_mail_always");
var encryptionPolicy = gCurrentIdentity.getIntAttribute("encryptionpolicy");
// 0 == never, 1 == if possible, 2 == always Encrypt.
smimeComposefields.alwaysEncryptMessage = encryptionPolicy == 2;
smimeComposefields.signMessage = gCurrentIdentity.getBoolAttribute("sign_mail");
}
}
@ -48,7 +51,7 @@ function GetSecurityInfo()
}
} // if we have message compose fields...
return smimeComposefields
return smimeComposefields;
}
function noEncryption()

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

@ -3,8 +3,7 @@
*/
pref("mail.identity.default.encryption_cert_name","");
pref("mail.identity.default.encrypt_mail_if_possible", false);
pref("mail.identity.default.encrypt_mail_always", false);
pref("mail.identity.default.encryptionpolicy", 0);
pref("mail.identity.default.signing_cert_name", "");
pref("mail.identity.default.sign_mail", false);

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

@ -1,11 +1,13 @@
<!ENTITY securityTitle.label "Security">
<!ENTITY encryptionGroupTitle.label "Encryption">
<!ENTITY ifPossibleEncryptMessage.label "Encrypt messages if possible">
<!ENTITY alwaysEncryptMessage.label "Always encrypt messages">
<!ENTITY encryptionCert.message "Personal certificate used for encryption:">
<!ENTITY encryptionChoiceLabel.label "Use encryption when sending messages:">
<!ENTITY neverEncrypt.label "Never">
<!ENTITY ifPossibleEncryptMessage.label "If possible (messages are sent without encryption if not all recipients have a certificate)">
<!ENTITY alwaysEncryptMessage.label "Always (disable send unless all recipients have a certificate">
<!ENTITY encryptionCert.message "Use the following personal certificate:">
<!ENTITY encryptionCert.notselected "No certificate set">
<!ENTITY certificate.button "Select Certificate">
<!ENTITY signingGroupTitle.label "Signing">
<!ENTITY certificate.button "Select...">
<!ENTITY signingGroupTitle.label "Digital Signing">
<!ENTITY signMessage.label "Digitally sign messages">
<!ENTITY signingCert.message "Personal certificate used for signing:">
<!ENTITY signingCert.message "Use the following personal certificate:">
<!ENTITY signingCert.notselected "No certificate set">

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

@ -9,6 +9,6 @@ MissingRecipientEncryptionCert=You requested to encrypt this message, but the ap
SignNoSenderEncryptionCert=You requested to sign this message, but the application failed to find an encryption cert to include in the signed message or the certificate has expired.
## Strings used for in the prefs.
prefPanel-smime=Secure Mail
prefPanel-smime=Security
smimeCertPrompt=Select the certificate that you want to use: