diff --git a/mozilla/mailnews/extensions/smime/jar.mn b/mozilla/mailnews/extensions/smime/jar.mn index 0a215c87868..8332864fbb8 100644 --- a/mozilla/mailnews/extensions/smime/jar.mn +++ b/mozilla/mailnews/extensions/smime/jar.mn @@ -4,8 +4,11 @@ messenger.jar: % overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://messenger-smime/content/msgCompSMIMEOverlay.xul % overlay chrome://messenger/content/msgHdrViewOverlay.xul chrome://messenger-smime/content/msgHdrViewSMIMEOverlay.xul % overlay chrome://messenger/content/mailWindowOverlay.xul chrome://messenger-smime/content/msgReadSMIMEOverlay.xul +% overlay chrome://messenger/content/am-identity-edit.xul chrome://messenger/content/am-smimeIdentityEditOverlay.xul content/messenger/am-smime.xul (resources/content/am-smime.xul) content/messenger/am-smime.js (resources/content/am-smime.js) + content/messenger/am-smimeIdentityEditOverlay.xul (resources/content/am-smimeIdentityEditOverlay.xul) + content/messenger/am-smimeOverlay.xul (resources/content/am-smimeOverlay.xul) content/messenger-smime/msgCompSMIMEOverlay.js (resources/content/msgCompSMIMEOverlay.js) content/messenger-smime/msgCompSMIMEOverlay.xul (resources/content/msgCompSMIMEOverlay.xul) content/messenger-smime/msgReadSMIMEOverlay.js (resources/content/msgReadSMIMEOverlay.js) diff --git a/mozilla/mailnews/extensions/smime/resources/content/am-smime.js b/mozilla/mailnews/extensions/smime/resources/content/am-smime.js index d9d9bc48efd..960c0b9609a 100644 --- a/mozilla/mailnews/extensions/smime/resources/content/am-smime.js +++ b/mozilla/mailnews/extensions/smime/resources/content/am-smime.js @@ -62,6 +62,11 @@ const kEncryptionCertPref = "identity.encryption_cert_name"; const kSigningCertPref = "identity.signing_cert_name"; function onInit() +{ + smimeInitializeFields(); +} + +function smimeInitializeFields() { // initialize all of our elements based on the current identity values.... gEncryptionCertName = document.getElementById(kEncryptionCertPref); @@ -77,27 +82,44 @@ function onInit() gEncryptionChoicesLocked = false; gSigningChoicesLocked = false; - gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name"); + if (!gIdentity) { + // The user is going to create a new identity. + // Set everything to default values. + // Do not take over the values from gAccount.defaultIdentity + // as the new identity is going to have a different mail address. + + gEncryptionCertName.value = ""; + gSignCertName.value = ""; - gEncryptionChoices.value = gIdentity.getIntAttribute("encryptionpolicy"); - - if (!gEncryptionCertName.value) - { gEncryptAlways.setAttribute("disabled", true); gNeverEncrypt.setAttribute("disabled", true); - } - else { - enableEncryptionControls(true); - } - - gSignCertName.value = gIdentity.getUnicharAttribute("signing_cert_name"); - gSignMessages.checked = gIdentity.getBoolAttribute("sign_mail"); - if (!gSignCertName.value) - { gSignMessages.setAttribute("disabled", true); + + gSignMessages.checked = false; + gEncryptionChoices.value = 0; } else { - enableSigningControls(true); + gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name"); + + gEncryptionChoices.value = gIdentity.getIntAttribute("encryptionpolicy"); + + if (!gEncryptionCertName.value) { + gEncryptAlways.setAttribute("disabled", true); + gNeverEncrypt.setAttribute("disabled", true); + } + else { + enableEncryptionControls(true); + } + + gSignCertName.value = gIdentity.getUnicharAttribute("signing_cert_name"); + gSignMessages.checked = gIdentity.getBoolAttribute("sign_mail"); + if (!gSignCertName.value) + { + gSignMessages.setAttribute("disabled", true); + } + else { + enableSigningControls(true); + } } // Always start with enabling signing and encryption cert select buttons. @@ -106,7 +128,8 @@ function onInit() enableCertSelectButtons(); // Disable all locked elements on the panel - onLockPreference(); + if (gIdentity) + onLockPreference(); } function onPreInit(account, accountValues) @@ -115,6 +138,11 @@ function onPreInit(account, accountValues) } function onSave() +{ + smimeSave(); +} + +function smimeSave() { // find out which radio for the encryption radio group is selected and set that on our hidden encryptionChoice pref.... var newValue = gEncryptionChoices.value; @@ -126,6 +154,19 @@ function onSave() gIdentity.setUnicharAttribute("signing_cert_name", gSignCertName.value); } +function smimeOnAcceptEditor() +{ + try { + if (!onOk()) + return false; + } + catch (ex) {} + + smimeSave(); + + return true; +} + function onLockPreference() { var initPrefString = "mail.identity"; @@ -409,3 +450,11 @@ function smimeClearCert(smime_cert) enableCertSelectButtons(); } +function smimeOnLoadEditor() +{ + smimeInitializeFields(); + + document.documentElement.setAttribute("ondialogaccept", + "return smimeOnAcceptEditor();"); +} + diff --git a/mozilla/mailnews/extensions/smime/resources/content/am-smime.xul b/mozilla/mailnews/extensions/smime/resources/content/am-smime.xul index 414db61fe49..90b1e6f527e 100644 --- a/mozilla/mailnews/extensions/smime/resources/content/am-smime.xul +++ b/mozilla/mailnews/extensions/smime/resources/content/am-smime.xul @@ -1,7 +1,5 @@ - + + + + + + + + + + + + diff --git a/mozilla/mailnews/extensions/smime/resources/content/am-smimeOverlay.xul b/mozilla/mailnews/extensions/smime/resources/content/am-smimeOverlay.xul new file mode 100644 index 00000000000..915db6b714b --- /dev/null +++ b/mozilla/mailnews/extensions/smime/resources/content/am-smimeOverlay.xul @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + +