diff --git a/mozilla/mailnews/extensions/smime/resources/content/am-smime.js b/mozilla/mailnews/extensions/smime/resources/content/am-smime.js new file mode 100644 index 00000000000..745980a1adc --- /dev/null +++ b/mozilla/mailnews/extensions/smime/resources/content/am-smime.js @@ -0,0 +1,133 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998-2001 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributors: + * ddrinan@netscape.com + * Scott MacGregor + */ + +var gIdentity; +var gPref = null; +var gEncryptionCertName = null; +var gEncryptIfPossible = null; +var gEncryptAlways = null; +var gSignCertName = null; +var gSignMessages = null; + +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"); + 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"); + 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); + + gSignCertName.value = gIdentity.getUnicharAttribute("signing_cert_name"); + gSignMessages.checked = gIdentity.getBoolAttribute("sign_mail"); + if (!gSignCertName.value) + { + gSignMessages.setAttribute("disabled", true); + } +} + +function onPreInit(account, accountValues) +{ + gIdentity = account.defaultIdentity; +} + +function onSave() +{ +} + +function onLockPreference() +{ + dump("XXX on lock\n"); +} + + +// Does the work of disabling an element given the array which contains xul id/prefstring pairs. +// Also saves the id/locked state in an array so that other areas of the code can avoid +// stomping on the disabled state indiscriminately. +function disableIfLocked( prefstrArray ) +{ + if (!gLockedPref) + gLockedPref = new Array; + + for (i=0; i + + + + + + + + + + + +