releases-comm-central/mail/modules/MailViewManager.sys.mjs

169 строки
5.4 KiB
JavaScript
Исходник Обычный вид История

2012-05-30 20:48:24 +04:00
/* 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/. */
/**
* Put the MailViewConstants in an object so we can export them to
* msgViewPickerOverlay in one blob without contaminating everyone's address
* space who might want to import us.
*/
Bug 1824260 - esmify mail/. r=freaktechnik Differential Revision: https://phabricator.services.mozilla.com/D203760 --HG-- rename : mail/components/AppIdleManager.jsm => mail/components/AppIdleManager.sys.mjs rename : mail/components/about-support/AboutSupportMac.jsm => mail/components/about-support/AboutSupportMac.sys.mjs rename : mail/components/about-support/AboutSupportUnix.jsm => mail/components/about-support/AboutSupportUnix.sys.mjs rename : mail/components/about-support/AboutSupportWin32.jsm => mail/components/about-support/AboutSupportWin32.sys.mjs rename : mail/components/activity/modules/activityModules.jsm => mail/components/activity/modules/activityModules.sys.mjs rename : mail/components/activity/modules/alertHook.jsm => mail/components/activity/modules/alertHook.sys.mjs rename : mail/components/activity/modules/autosync.jsm => mail/components/activity/modules/autosync.sys.mjs rename : mail/components/activity/modules/glodaIndexer.jsm => mail/components/activity/modules/glodaIndexer.sys.mjs rename : mail/components/activity/modules/moveCopy.jsm => mail/components/activity/modules/moveCopy.sys.mjs rename : mail/components/activity/modules/pop3Download.jsm => mail/components/activity/modules/pop3Download.sys.mjs rename : mail/components/activity/modules/sendLater.jsm => mail/components/activity/modules/sendLater.sys.mjs rename : mail/components/cloudfile/cloudFileAccounts.jsm => mail/components/cloudfile/cloudFileAccounts.sys.mjs rename : mail/components/search/SearchIntegration.jsm => mail/components/search/SearchIntegration.sys.mjs rename : mail/extensions/openpgp/content/BondOpenPGP.jsm => mail/extensions/openpgp/content/BondOpenPGP.sys.mjs rename : mail/extensions/openpgp/content/modules/CollectedKeysDB.jsm => mail/extensions/openpgp/content/modules/CollectedKeysDB.sys.mjs rename : mail/extensions/openpgp/content/modules/GPGME.jsm => mail/extensions/openpgp/content/modules/GPGME.sys.mjs rename : mail/extensions/openpgp/content/modules/GPGMELib.jsm => mail/extensions/openpgp/content/modules/GPGMELib.sys.mjs rename : mail/extensions/openpgp/content/modules/OpenPGPAlias.jsm => mail/extensions/openpgp/content/modules/OpenPGPAlias.sys.mjs rename : mail/extensions/openpgp/content/modules/RNP.jsm => mail/extensions/openpgp/content/modules/RNP.sys.mjs rename : mail/extensions/openpgp/content/modules/RNPLib.jsm => mail/extensions/openpgp/content/modules/RNPLib.sys.mjs rename : mail/extensions/openpgp/content/modules/armor.jsm => mail/extensions/openpgp/content/modules/armor.sys.mjs rename : mail/extensions/openpgp/content/modules/constants.jsm => mail/extensions/openpgp/content/modules/constants.sys.mjs rename : mail/extensions/openpgp/content/modules/core.jsm => mail/extensions/openpgp/content/modules/core.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI/GnuPGCryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI/GnuPGCryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI/RNPCryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI/RNPCryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/data.jsm => mail/extensions/openpgp/content/modules/data.sys.mjs rename : mail/extensions/openpgp/content/modules/decryption.jsm => mail/extensions/openpgp/content/modules/decryption.sys.mjs rename : mail/extensions/openpgp/content/modules/dialog.jsm => mail/extensions/openpgp/content/modules/dialog.sys.mjs rename : mail/extensions/openpgp/content/modules/encryption.jsm => mail/extensions/openpgp/content/modules/encryption.sys.mjs rename : mail/extensions/openpgp/content/modules/filters.jsm => mail/extensions/openpgp/content/modules/filters.sys.mjs rename : mail/extensions/openpgp/content/modules/filtersWrapper.jsm => mail/extensions/openpgp/content/modules/filtersWrapper.sys.mjs rename : mail/extensions/openpgp/content/modules/fixExchangeMsg.jsm => mail/extensions/openpgp/content/modules/fixExchangeMsg.sys.mjs rename : mail/extensions/openpgp/content/modules/funcs.jsm => mail/extensions/openpgp/content/modules/funcs.sys.mjs rename : mail/extensions/openpgp/content/modules/key.jsm => mail/extensions/openpgp/content/modules/key.sys.mjs rename : mail/extensions/openpgp/content/modules/keyLookupHelper.jsm => mail/extensions/openpgp/content/modules/keyLookupHelper.sys.mjs rename : mail/extensions/openpgp/content/modules/keyObj.jsm => mail/extensions/openpgp/content/modules/keyObj.sys.mjs rename : mail/extensions/openpgp/content/modules/keyRing.jsm => mail/extensions/openpgp/content/modules/keyRing.sys.mjs rename : mail/extensions/openpgp/content/modules/keyserver.jsm => mail/extensions/openpgp/content/modules/keyserver.sys.mjs rename : mail/extensions/openpgp/content/modules/keyserverUris.jsm => mail/extensions/openpgp/content/modules/keyserverUris.sys.mjs rename : mail/extensions/openpgp/content/modules/log.jsm => mail/extensions/openpgp/content/modules/log.sys.mjs rename : mail/extensions/openpgp/content/modules/masterpass.jsm => mail/extensions/openpgp/content/modules/masterpass.sys.mjs rename : mail/extensions/openpgp/content/modules/mime.jsm => mail/extensions/openpgp/content/modules/mime.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeDecrypt.jsm => mail/extensions/openpgp/content/modules/mimeDecrypt.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeEncrypt.jsm => mail/extensions/openpgp/content/modules/mimeEncrypt.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeVerify.jsm => mail/extensions/openpgp/content/modules/mimeVerify.sys.mjs rename : mail/extensions/openpgp/content/modules/msgRead.jsm => mail/extensions/openpgp/content/modules/msgRead.sys.mjs rename : mail/extensions/openpgp/content/modules/persistentCrypto.jsm => mail/extensions/openpgp/content/modules/persistentCrypto.sys.mjs rename : mail/extensions/openpgp/content/modules/singletons.jsm => mail/extensions/openpgp/content/modules/singletons.sys.mjs rename : mail/extensions/openpgp/content/modules/sqliteDb.jsm => mail/extensions/openpgp/content/modules/sqliteDb.sys.mjs rename : mail/extensions/openpgp/content/modules/streams.jsm => mail/extensions/openpgp/content/modules/streams.sys.mjs rename : mail/extensions/openpgp/content/modules/trust.jsm => mail/extensions/openpgp/content/modules/trust.sys.mjs rename : mail/extensions/openpgp/content/modules/uris.jsm => mail/extensions/openpgp/content/modules/uris.sys.mjs rename : mail/extensions/openpgp/content/modules/windows.jsm => mail/extensions/openpgp/content/modules/windows.sys.mjs rename : mail/extensions/openpgp/content/modules/wkdLookup.jsm => mail/extensions/openpgp/content/modules/wkdLookup.sys.mjs rename : mail/extensions/openpgp/content/modules/zbase32.jsm => mail/extensions/openpgp/content/modules/zbase32.sys.mjs rename : mail/modules/ConversationOpener.jsm => mail/modules/ConversationOpener.sys.mjs rename : mail/modules/DBViewWrapper.jsm => mail/modules/DBViewWrapper.sys.mjs rename : mail/modules/DisplayNameUtils.jsm => mail/modules/DisplayNameUtils.sys.mjs rename : mail/modules/GlobalPopupNotifications.jsm => mail/modules/GlobalPopupNotifications.sys.mjs rename : mail/modules/MailE10SUtils.jsm => mail/modules/MailE10SUtils.sys.mjs rename : mail/modules/MailMigrator.jsm => mail/modules/MailMigrator.sys.mjs rename : mail/modules/MailUsageTelemetry.jsm => mail/modules/MailUsageTelemetry.sys.mjs rename : mail/modules/MailUtils.jsm => mail/modules/MailUtils.sys.mjs rename : mail/modules/MailViewManager.jsm => mail/modules/MailViewManager.sys.mjs rename : mail/modules/MessageArchiver.jsm => mail/modules/MessageArchiver.sys.mjs rename : mail/modules/MsgHdrSyntheticView.jsm => mail/modules/MsgHdrSyntheticView.sys.mjs rename : mail/modules/PhishingDetector.jsm => mail/modules/PhishingDetector.sys.mjs rename : mail/modules/QuickFilterManager.jsm => mail/modules/QuickFilterManager.sys.mjs rename : mail/modules/SearchSpec.jsm => mail/modules/SearchSpec.sys.mjs rename : mail/modules/SessionStore.jsm => mail/modules/SessionStore.sys.mjs rename : mail/modules/SessionStoreManager.jsm => mail/modules/SessionStoreManager.sys.mjs rename : mail/modules/ShortcutsManager.jsm => mail/modules/ShortcutsManager.sys.mjs rename : mail/modules/SummaryFrameManager.jsm => mail/modules/SummaryFrameManager.sys.mjs rename : mail/modules/TBDistCustomizer.jsm => mail/modules/TBDistCustomizer.sys.mjs rename : mail/modules/TabStateFlusher.jsm => mail/modules/TabStateFlusher.sys.mjs rename : mail/modules/TagUtils.jsm => mail/modules/TagUtils.sys.mjs rename : mail/modules/WindowsJumpLists.jsm => mail/modules/WindowsJumpLists.sys.mjs rename : mail/test/browser/shared-modules/AccountManagerHelpers.jsm => mail/test/browser/shared-modules/AccountManagerHelpers.sys.mjs rename : mail/test/browser/shared-modules/AddressBookHelpers.jsm => mail/test/browser/shared-modules/AddressBookHelpers.sys.mjs rename : mail/test/browser/shared-modules/AttachmentHelpers.jsm => mail/test/browser/shared-modules/AttachmentHelpers.sys.mjs rename : mail/test/browser/shared-modules/CloudfileHelpers.jsm => mail/test/browser/shared-modules/CloudfileHelpers.sys.mjs rename : mail/test/browser/shared-modules/ComposeHelpers.jsm => mail/test/browser/shared-modules/ComposeHelpers.sys.mjs rename : mail/test/browser/shared-modules/ContentTabHelpers.jsm => mail/test/browser/shared-modules/ContentTabHelpers.sys.mjs rename : mail/test/browser/shared-modules/DOMHelpers.jsm => mail/test/browser/shared-modules/DOMHelpers.sys.mjs rename : mail/test/browser/shared-modules/EventUtils.jsm => mail/test/browser/shared-modules/EventUtils.sys.mjs rename : mail/test/browser/shared-modules/FolderDisplayHelpers.jsm => mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs rename : mail/test/browser/shared-modules/JunkHelpers.jsm => mail/test/browser/shared-modules/JunkHelpers.sys.mjs rename : mail/test/browser/shared-modules/KeyboardHelpers.jsm => mail/test/browser/shared-modules/KeyboardHelpers.sys.mjs rename : mail/test/browser/shared-modules/MouseEventHelpers.jsm => mail/test/browser/shared-modules/MouseEventHelpers.sys.mjs rename : mail/test/browser/shared-modules/NNTPHelpers.jsm => mail/test/browser/shared-modules/NNTPHelpers.sys.mjs rename : mail/test/browser/shared-modules/NewMailAccountHelpers.jsm => mail/test/browser/shared-modules/NewMailAccountHelpers.sys.mjs rename : mail/test/browser/shared-modules/NotificationBoxHelpers.jsm => mail/test/browser/shared-modules/NotificationBoxHelpers.sys.mjs rename : mail/test/browser/shared-modules/OpenPGPTestUtils.jsm => mail/test/browser/shared-modules/OpenPGPTestUtils.sys.mjs rename : mail/test/browser/shared-modules/PrefTabHelpers.jsm => mail/test/browser/shared-modules/PrefTabHelpers.sys.mjs rename : mail/test/browser/shared-modules/PromptHelpers.jsm => mail/test/browser/shared-modules/PromptHelpers.sys.mjs rename : mail/test/browser/shared-modules/QuickFilterBarHelpers.jsm => mail/test/browser/shared-modules/QuickFilterBarHelpers.sys.mjs rename : mail/test/browser/shared-modules/SearchWindowHelpers.jsm => mail/test/browser/shared-modules/SearchWindowHelpers.sys.mjs rename : mail/test/browser/shared-modules/SubscribeWindowHelpers.jsm => mail/test/browser/shared-modules/SubscribeWindowHelpers.sys.mjs rename : mail/test/browser/shared-modules/ViewHelpers.jsm => mail/test/browser/shared-modules/ViewHelpers.sys.mjs rename : mail/test/browser/shared-modules/WindowHelpers.jsm => mail/test/browser/shared-modules/WindowHelpers.sys.mjs extra : rebase_source : 029a50bec27e1a8f8baf7ba3c2d8aefb87fad6a0 extra : amend_source : cbd0d8007716867d0acdb8c325e197f8e03bf7a7
2024-03-09 16:15:16 +03:00
export var MailViewConstants = {
// tag views have kViewTagMarker + their key as value
kViewItemAll: 0,
kViewItemUnread: 1,
kViewItemTags: 2, // former labels used values 2-6
kViewItemNotDeleted: 3,
// not a real view! a sentinel value to pop up a dialog
kViewItemVirtual: 7,
// not a real view! a sentinel value to pop up a dialog
kViewItemCustomize: 8,
kViewItemFirstCustom: 9,
kViewCurrent: "current-view",
kViewCurrentTag: "current-view-tag",
kViewTagMarker: ":",
};
/**
* MailViews are view 'filters' implemented using search terms. DBViewWrapper
* uses the SearchSpec class to combine the search terms of the mailview with
* those of the virtual folder (if applicable) and the quicksearch (if
* applicable).
*/
Bug 1824260 - esmify mail/. r=freaktechnik Differential Revision: https://phabricator.services.mozilla.com/D203760 --HG-- rename : mail/components/AppIdleManager.jsm => mail/components/AppIdleManager.sys.mjs rename : mail/components/about-support/AboutSupportMac.jsm => mail/components/about-support/AboutSupportMac.sys.mjs rename : mail/components/about-support/AboutSupportUnix.jsm => mail/components/about-support/AboutSupportUnix.sys.mjs rename : mail/components/about-support/AboutSupportWin32.jsm => mail/components/about-support/AboutSupportWin32.sys.mjs rename : mail/components/activity/modules/activityModules.jsm => mail/components/activity/modules/activityModules.sys.mjs rename : mail/components/activity/modules/alertHook.jsm => mail/components/activity/modules/alertHook.sys.mjs rename : mail/components/activity/modules/autosync.jsm => mail/components/activity/modules/autosync.sys.mjs rename : mail/components/activity/modules/glodaIndexer.jsm => mail/components/activity/modules/glodaIndexer.sys.mjs rename : mail/components/activity/modules/moveCopy.jsm => mail/components/activity/modules/moveCopy.sys.mjs rename : mail/components/activity/modules/pop3Download.jsm => mail/components/activity/modules/pop3Download.sys.mjs rename : mail/components/activity/modules/sendLater.jsm => mail/components/activity/modules/sendLater.sys.mjs rename : mail/components/cloudfile/cloudFileAccounts.jsm => mail/components/cloudfile/cloudFileAccounts.sys.mjs rename : mail/components/search/SearchIntegration.jsm => mail/components/search/SearchIntegration.sys.mjs rename : mail/extensions/openpgp/content/BondOpenPGP.jsm => mail/extensions/openpgp/content/BondOpenPGP.sys.mjs rename : mail/extensions/openpgp/content/modules/CollectedKeysDB.jsm => mail/extensions/openpgp/content/modules/CollectedKeysDB.sys.mjs rename : mail/extensions/openpgp/content/modules/GPGME.jsm => mail/extensions/openpgp/content/modules/GPGME.sys.mjs rename : mail/extensions/openpgp/content/modules/GPGMELib.jsm => mail/extensions/openpgp/content/modules/GPGMELib.sys.mjs rename : mail/extensions/openpgp/content/modules/OpenPGPAlias.jsm => mail/extensions/openpgp/content/modules/OpenPGPAlias.sys.mjs rename : mail/extensions/openpgp/content/modules/RNP.jsm => mail/extensions/openpgp/content/modules/RNP.sys.mjs rename : mail/extensions/openpgp/content/modules/RNPLib.jsm => mail/extensions/openpgp/content/modules/RNPLib.sys.mjs rename : mail/extensions/openpgp/content/modules/armor.jsm => mail/extensions/openpgp/content/modules/armor.sys.mjs rename : mail/extensions/openpgp/content/modules/constants.jsm => mail/extensions/openpgp/content/modules/constants.sys.mjs rename : mail/extensions/openpgp/content/modules/core.jsm => mail/extensions/openpgp/content/modules/core.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI/GnuPGCryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI/GnuPGCryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/cryptoAPI/RNPCryptoAPI.jsm => mail/extensions/openpgp/content/modules/cryptoAPI/RNPCryptoAPI.sys.mjs rename : mail/extensions/openpgp/content/modules/data.jsm => mail/extensions/openpgp/content/modules/data.sys.mjs rename : mail/extensions/openpgp/content/modules/decryption.jsm => mail/extensions/openpgp/content/modules/decryption.sys.mjs rename : mail/extensions/openpgp/content/modules/dialog.jsm => mail/extensions/openpgp/content/modules/dialog.sys.mjs rename : mail/extensions/openpgp/content/modules/encryption.jsm => mail/extensions/openpgp/content/modules/encryption.sys.mjs rename : mail/extensions/openpgp/content/modules/filters.jsm => mail/extensions/openpgp/content/modules/filters.sys.mjs rename : mail/extensions/openpgp/content/modules/filtersWrapper.jsm => mail/extensions/openpgp/content/modules/filtersWrapper.sys.mjs rename : mail/extensions/openpgp/content/modules/fixExchangeMsg.jsm => mail/extensions/openpgp/content/modules/fixExchangeMsg.sys.mjs rename : mail/extensions/openpgp/content/modules/funcs.jsm => mail/extensions/openpgp/content/modules/funcs.sys.mjs rename : mail/extensions/openpgp/content/modules/key.jsm => mail/extensions/openpgp/content/modules/key.sys.mjs rename : mail/extensions/openpgp/content/modules/keyLookupHelper.jsm => mail/extensions/openpgp/content/modules/keyLookupHelper.sys.mjs rename : mail/extensions/openpgp/content/modules/keyObj.jsm => mail/extensions/openpgp/content/modules/keyObj.sys.mjs rename : mail/extensions/openpgp/content/modules/keyRing.jsm => mail/extensions/openpgp/content/modules/keyRing.sys.mjs rename : mail/extensions/openpgp/content/modules/keyserver.jsm => mail/extensions/openpgp/content/modules/keyserver.sys.mjs rename : mail/extensions/openpgp/content/modules/keyserverUris.jsm => mail/extensions/openpgp/content/modules/keyserverUris.sys.mjs rename : mail/extensions/openpgp/content/modules/log.jsm => mail/extensions/openpgp/content/modules/log.sys.mjs rename : mail/extensions/openpgp/content/modules/masterpass.jsm => mail/extensions/openpgp/content/modules/masterpass.sys.mjs rename : mail/extensions/openpgp/content/modules/mime.jsm => mail/extensions/openpgp/content/modules/mime.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeDecrypt.jsm => mail/extensions/openpgp/content/modules/mimeDecrypt.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeEncrypt.jsm => mail/extensions/openpgp/content/modules/mimeEncrypt.sys.mjs rename : mail/extensions/openpgp/content/modules/mimeVerify.jsm => mail/extensions/openpgp/content/modules/mimeVerify.sys.mjs rename : mail/extensions/openpgp/content/modules/msgRead.jsm => mail/extensions/openpgp/content/modules/msgRead.sys.mjs rename : mail/extensions/openpgp/content/modules/persistentCrypto.jsm => mail/extensions/openpgp/content/modules/persistentCrypto.sys.mjs rename : mail/extensions/openpgp/content/modules/singletons.jsm => mail/extensions/openpgp/content/modules/singletons.sys.mjs rename : mail/extensions/openpgp/content/modules/sqliteDb.jsm => mail/extensions/openpgp/content/modules/sqliteDb.sys.mjs rename : mail/extensions/openpgp/content/modules/streams.jsm => mail/extensions/openpgp/content/modules/streams.sys.mjs rename : mail/extensions/openpgp/content/modules/trust.jsm => mail/extensions/openpgp/content/modules/trust.sys.mjs rename : mail/extensions/openpgp/content/modules/uris.jsm => mail/extensions/openpgp/content/modules/uris.sys.mjs rename : mail/extensions/openpgp/content/modules/windows.jsm => mail/extensions/openpgp/content/modules/windows.sys.mjs rename : mail/extensions/openpgp/content/modules/wkdLookup.jsm => mail/extensions/openpgp/content/modules/wkdLookup.sys.mjs rename : mail/extensions/openpgp/content/modules/zbase32.jsm => mail/extensions/openpgp/content/modules/zbase32.sys.mjs rename : mail/modules/ConversationOpener.jsm => mail/modules/ConversationOpener.sys.mjs rename : mail/modules/DBViewWrapper.jsm => mail/modules/DBViewWrapper.sys.mjs rename : mail/modules/DisplayNameUtils.jsm => mail/modules/DisplayNameUtils.sys.mjs rename : mail/modules/GlobalPopupNotifications.jsm => mail/modules/GlobalPopupNotifications.sys.mjs rename : mail/modules/MailE10SUtils.jsm => mail/modules/MailE10SUtils.sys.mjs rename : mail/modules/MailMigrator.jsm => mail/modules/MailMigrator.sys.mjs rename : mail/modules/MailUsageTelemetry.jsm => mail/modules/MailUsageTelemetry.sys.mjs rename : mail/modules/MailUtils.jsm => mail/modules/MailUtils.sys.mjs rename : mail/modules/MailViewManager.jsm => mail/modules/MailViewManager.sys.mjs rename : mail/modules/MessageArchiver.jsm => mail/modules/MessageArchiver.sys.mjs rename : mail/modules/MsgHdrSyntheticView.jsm => mail/modules/MsgHdrSyntheticView.sys.mjs rename : mail/modules/PhishingDetector.jsm => mail/modules/PhishingDetector.sys.mjs rename : mail/modules/QuickFilterManager.jsm => mail/modules/QuickFilterManager.sys.mjs rename : mail/modules/SearchSpec.jsm => mail/modules/SearchSpec.sys.mjs rename : mail/modules/SessionStore.jsm => mail/modules/SessionStore.sys.mjs rename : mail/modules/SessionStoreManager.jsm => mail/modules/SessionStoreManager.sys.mjs rename : mail/modules/ShortcutsManager.jsm => mail/modules/ShortcutsManager.sys.mjs rename : mail/modules/SummaryFrameManager.jsm => mail/modules/SummaryFrameManager.sys.mjs rename : mail/modules/TBDistCustomizer.jsm => mail/modules/TBDistCustomizer.sys.mjs rename : mail/modules/TabStateFlusher.jsm => mail/modules/TabStateFlusher.sys.mjs rename : mail/modules/TagUtils.jsm => mail/modules/TagUtils.sys.mjs rename : mail/modules/WindowsJumpLists.jsm => mail/modules/WindowsJumpLists.sys.mjs rename : mail/test/browser/shared-modules/AccountManagerHelpers.jsm => mail/test/browser/shared-modules/AccountManagerHelpers.sys.mjs rename : mail/test/browser/shared-modules/AddressBookHelpers.jsm => mail/test/browser/shared-modules/AddressBookHelpers.sys.mjs rename : mail/test/browser/shared-modules/AttachmentHelpers.jsm => mail/test/browser/shared-modules/AttachmentHelpers.sys.mjs rename : mail/test/browser/shared-modules/CloudfileHelpers.jsm => mail/test/browser/shared-modules/CloudfileHelpers.sys.mjs rename : mail/test/browser/shared-modules/ComposeHelpers.jsm => mail/test/browser/shared-modules/ComposeHelpers.sys.mjs rename : mail/test/browser/shared-modules/ContentTabHelpers.jsm => mail/test/browser/shared-modules/ContentTabHelpers.sys.mjs rename : mail/test/browser/shared-modules/DOMHelpers.jsm => mail/test/browser/shared-modules/DOMHelpers.sys.mjs rename : mail/test/browser/shared-modules/EventUtils.jsm => mail/test/browser/shared-modules/EventUtils.sys.mjs rename : mail/test/browser/shared-modules/FolderDisplayHelpers.jsm => mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs rename : mail/test/browser/shared-modules/JunkHelpers.jsm => mail/test/browser/shared-modules/JunkHelpers.sys.mjs rename : mail/test/browser/shared-modules/KeyboardHelpers.jsm => mail/test/browser/shared-modules/KeyboardHelpers.sys.mjs rename : mail/test/browser/shared-modules/MouseEventHelpers.jsm => mail/test/browser/shared-modules/MouseEventHelpers.sys.mjs rename : mail/test/browser/shared-modules/NNTPHelpers.jsm => mail/test/browser/shared-modules/NNTPHelpers.sys.mjs rename : mail/test/browser/shared-modules/NewMailAccountHelpers.jsm => mail/test/browser/shared-modules/NewMailAccountHelpers.sys.mjs rename : mail/test/browser/shared-modules/NotificationBoxHelpers.jsm => mail/test/browser/shared-modules/NotificationBoxHelpers.sys.mjs rename : mail/test/browser/shared-modules/OpenPGPTestUtils.jsm => mail/test/browser/shared-modules/OpenPGPTestUtils.sys.mjs rename : mail/test/browser/shared-modules/PrefTabHelpers.jsm => mail/test/browser/shared-modules/PrefTabHelpers.sys.mjs rename : mail/test/browser/shared-modules/PromptHelpers.jsm => mail/test/browser/shared-modules/PromptHelpers.sys.mjs rename : mail/test/browser/shared-modules/QuickFilterBarHelpers.jsm => mail/test/browser/shared-modules/QuickFilterBarHelpers.sys.mjs rename : mail/test/browser/shared-modules/SearchWindowHelpers.jsm => mail/test/browser/shared-modules/SearchWindowHelpers.sys.mjs rename : mail/test/browser/shared-modules/SubscribeWindowHelpers.jsm => mail/test/browser/shared-modules/SubscribeWindowHelpers.sys.mjs rename : mail/test/browser/shared-modules/ViewHelpers.jsm => mail/test/browser/shared-modules/ViewHelpers.sys.mjs rename : mail/test/browser/shared-modules/WindowHelpers.jsm => mail/test/browser/shared-modules/WindowHelpers.sys.mjs extra : rebase_source : 029a50bec27e1a8f8baf7ba3c2d8aefb87fad6a0 extra : amend_source : cbd0d8007716867d0acdb8c325e197f8e03bf7a7
2024-03-09 16:15:16 +03:00
export var MailViewManager = {
_views: {},
_customMailViews: Cc["@mozilla.org/messenger/mailviewlist;1"].getService(
Ci.nsIMsgMailViewList
),
/**
* Define one of the built-in mail-views. If you want to define your own
* view, you need to define a custom view using nsIMsgMailViewList.
*
* We define our own little view definition abstraction because some day this
* functionality may want to be generalized to be usable by gloda as well.
*
* @param {object} aViewDef - The view definition.
* @param {string} aViewDef.name - Name for the view, for debugging
* purposes only. This should not be localized!
* @param {integer} aViewDef.index - The index to assign to the view.
* @param {Function} aViewDef.makeTerms - A function to invoke that returns
* a list of search terms.
*/
defineView(aViewDef) {
this._views[aViewDef.index] = aViewDef;
},
/**
* Wrap a custom view into our cute little view abstraction. We do not cache
* these because views should not change often enough for it to matter from
* a performance perspective, but they will change enough to make stale
* caches a potential issue.
*/
_wrapCustomView(aCustomViewIndex) {
const mailView = this._customMailViews.getMailViewAt(aCustomViewIndex);
return {
name: mailView.prettyName, // since the user created it it's localized
index: aCustomViewIndex,
makeTerms() {
return mailView.searchTerms;
},
};
},
_findCustomViewByName(aName) {
const count = this._customMailViews.mailViewCount;
for (let i = 0; i < count; i++) {
const mailView = this._customMailViews.getMailViewAt(i);
if (mailView.mailViewName == aName) {
return this._wrapCustomView(i);
}
}
throw new Error("No custom view with name: " + aName);
},
/**
* Return the view definition associated with the given view index.
*
* @param {integer|string} aViewIndex - If the value is an integer it
* references the built-in view with the view index from MailViewConstants,
* or if the index is >= MailViewConstants.kViewItemFirstCustom, it is a
* reference to a custom view definition. If the value is a string, it is
* the name of a custom view.
* The string case is mainly intended for testing purposes.
*/
getMailViewByIndex(aViewIndex) {
if (typeof aViewIndex == "string") {
return this._findCustomViewByName(aViewIndex);
}
if (aViewIndex < MailViewConstants.kViewItemFirstCustom) {
return this._views[aViewIndex];
}
return this._wrapCustomView(
aViewIndex - MailViewConstants.kViewItemFirstCustom
);
},
};
MailViewManager.defineView({
name: "all mail", // debugging assistance only! not localized!
index: MailViewConstants.kViewItemAll,
makeTerms() {
return null;
},
});
MailViewManager.defineView({
name: "new mail / unread", // debugging assistance only! not localized!
index: MailViewConstants.kViewItemUnread,
makeTerms(aSession) {
const term = aSession.createTerm();
const value = term.value;
value.status = Ci.nsMsgMessageFlags.Read;
value.attrib = Ci.nsMsgSearchAttrib.MsgStatus;
term.value = value;
term.attrib = Ci.nsMsgSearchAttrib.MsgStatus;
term.op = Ci.nsMsgSearchOp.Isnt;
term.booleanAnd = true;
return [term];
},
});
MailViewManager.defineView({
name: "tags", // debugging assistance only! not localized!
index: MailViewConstants.kViewItemTags,
makeTerms(aSession, aKeyword) {
const term = aSession.createTerm();
const value = term.value;
value.str = aKeyword;
value.attrib = Ci.nsMsgSearchAttrib.Keywords;
term.value = value;
term.attrib = Ci.nsMsgSearchAttrib.Keywords;
term.op = Ci.nsMsgSearchOp.Contains;
term.booleanAnd = true;
return [term];
},
});
MailViewManager.defineView({
name: "not deleted", // debugging assistance only! not localized!
index: MailViewConstants.kViewItemNotDeleted,
makeTerms(aSession) {
const term = aSession.createTerm();
const value = term.value;
value.status = Ci.nsMsgMessageFlags.IMAPDeleted;
value.attrib = Ci.nsMsgSearchAttrib.MsgStatus;
term.value = value;
term.attrib = Ci.nsMsgSearchAttrib.MsgStatus;
term.op = Ci.nsMsgSearchOp.Isnt;
term.booleanAnd = true;
return [term];
},
});