/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Commands for the message composition window. */ // Ensure the activity modules are loaded for this window. Components.utils.import("resource:///modules/activity/activityModules.js"); Components.utils.import("resource:///modules/attachmentChecker.js"); Components.utils.import("resource:///modules/cloudFileAccounts.js"); Components.utils.import("resource:///modules/mimeParser.jsm"); Components.utils.import("resource:///modules/errUtils.js"); Components.utils.import("resource:///modules/folderUtils.jsm"); Components.utils.import("resource:///modules/iteratorUtils.jsm"); Components.utils.import("resource:///modules/mailServices.js"); Components.utils.import("resource:///modules/MailUtils.js"); Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); Components.utils.import("resource://gre/modules/PluralForm.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); /** * interfaces */ var nsIMsgCompDeliverMode = Components.interfaces.nsIMsgCompDeliverMode; var nsIMsgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat; var nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible; var nsIMsgCompType = Components.interfaces.nsIMsgCompType; var nsIMsgCompFormat = Components.interfaces.nsIMsgCompFormat; var nsIAbPreferMailFormat = Components.interfaces.nsIAbPreferMailFormat; var nsIPlaintextEditorMail = Components.interfaces.nsIPlaintextEditor; var nsISupportsString = Components.interfaces.nsISupportsString; var mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine; var sDictCount = 0; /** * Global message window object. This is used 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 * functions in the other js file. */ var msgWindow; var gMessenger; var gSpellChecker = new InlineSpellChecker(); /** * Global variables, need to be re-initialized every time mostly because * we need to release them when the window closes. */ var gMsgCompose; var gOriginalMsgURI; var gWindowLocked; var gSendLocked; var gContentChanged; var gSubjectChanged; var gAutoSaving; var gCurrentIdentity; var defaultSaveOperation; var gSendOperationInProgress; var gSaveOperationInProgress; var gCloseWindowAfterSave; var gSavedSendNowKey; var gSendFormat; var gMsgIdentityElement; var gMsgAddressingWidgetTreeElement; var gMsgSubjectElement; var gMsgAttachmentElement; var gMsgHeadersToolbarElement; // TODO: Maybe the following two variables can be combined. var gManualAttachmentReminder; var gDisableAttachmentReminder; var gComposeType; var gLanguageObserver; var gBodyFromArgs; // i18n globals var gCharsetConvertManager; var _gComposeBundle; function getComposeBundle() { // That one has to be lazy. Getting a reference to an element with a XBL // binding attached will cause the XBL constructors to fire if they haven't // already. If we get a reference to the compose bundle at script load-time, // this will cause the XBL constructor that's responsible for the personas to // fire up, thus executing the personas code while the DOM is not fully built. // Since this