# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla 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/MPL/ # # 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 Original Code is Mozilla Communicator client code, released # March 31, 1998. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998-1999 # the Initial Developer. All Rights Reserved. # # Contributor(s): # David Bienvenu # Olivier Parniere BT Global Services / Etat francais Ministere de la Defense # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** /** * interfaces */ const nsIMsgCompDeliverMode = Components.interfaces.nsIMsgCompDeliverMode; const nsIMsgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat; const nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible; const nsIMsgCompType = Components.interfaces.nsIMsgCompType; const nsIMsgCompFormat = Components.interfaces.nsIMsgCompFormat; const nsIAbPreferMailFormat = Components.interfaces.nsIAbPreferMailFormat; const nsIPlaintextEditorMail = Components.interfaces.nsIPlaintextEditor; const nsISupportsString = Components.interfaces.nsISupportsString; const mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine; var sDictCount = 0; /* Create message window object. This is use by mail-offline.js and therefore should not be renamed. We need to avoid doing this kind of cross file global stuff in the future and instead pass this object as parameter when needed by function in the other js file. */ var msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"] .createInstance(Components.interfaces.nsIMsgWindow); /** * Global variables, need to be re-initialized every time mostly because we need to release them when the window close */ var gHideMenus; var gMsgCompose; var gAccountManager; var gIOService; var gPromptService; var gWindowLocked; var gContentChanged; var gAutoSaving; var gCurrentIdentity; var defaultSaveOperation; var gSendOrSaveOperationInProgress; var gCloseWindowAfterSave; var gIsOffline; var gSessionAdded; var gCurrentAutocompleteDirectory; var gSetupLdapAutocomplete; var gLDAPSession; var gSavedSendNowKey; var gSendFormat; var gMsgIdentityElement; var gMsgAddressingWidgetTreeElement; var gMsgSubjectElement; var gMsgAttachmentElement; var gMsgHeadersToolbarElement; // i18n globals var gCurrentMailSendCharset; var gSendDefaultCharset; var gCharsetTitle; var gCharsetConvertManager; var gLastWindowToHaveFocus; var gReceiptOptionChanged; var gDSNOptionChanged; var gAttachVCardOptionChanged; var gMailSession; var gAutoSaveInterval; var gAutoSaveTimeout; var gAutoSaveKickedIn; var gEditingDraft; const kComposeAttachDirPrefName = "mail.compose.attach.dir"; function InitializeGlobalVariables() { gAccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager); gIOService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); gMsgCompose = null; gWindowLocked = false; gContentChanged = false; gCurrentIdentity = null; defaultSaveOperation = "draft"; gSendOrSaveOperationInProgress = false; gAutoSaving = false; gCloseWindowAfterSave = false; gIsOffline = gIOService.offline; gSessionAdded = false; gCurrentAutocompleteDirectory = null; gSetupLdapAutocomplete = false; gLDAPSession = null; gSavedSendNowKey = null; gSendFormat = nsIMsgCompSendFormat.AskUser; gCurrentMailSendCharset = null; gSendDefaultCharset = null; gCharsetTitle = null; gCharsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1'].getService(Components.interfaces.nsICharsetConverterManager); gMailSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService(Components.interfaces.nsIMsgMailSession); gHideMenus = false; gLastWindowToHaveFocus = null; gReceiptOptionChanged = false; gDSNOptionChanged = false; gAttachVCardOptionChanged = false; } InitializeGlobalVariables(); function ReleaseGlobalVariables() { gAccountManager = null; gIOService = null; gPromptService = null; gCurrentIdentity = null; gCurrentAutocompleteDirectory = null; gLDAPSession = null; gCharsetConvertManager = null; gMsgCompose = null; gMailSession = null; } function disableEditableFields() { gMsgCompose.editor.flags |= nsIPlaintextEditorMail.eEditorReadonlyMask; var disableElements = document.getElementsByAttribute("disableonsend", "true"); for (i=0;i