diff --git a/mailnews/base/public/nsIFolderListener.idl b/mailnews/base/public/nsIFolderListener.idl index ab23ae2d149..80fa541c3cf 100644 --- a/mailnews/base/public/nsIFolderListener.idl +++ b/mailnews/base/public/nsIFolderListener.idl @@ -40,44 +40,55 @@ interface nsIFolder; +typedef unsigned long folderListenerNotifyFlagValue; + [scriptable, uuid(d4ff86da-1dd1-11b2-a6f6-9fcd348bcc34)] interface nsIFolderListener : nsISupports { - - void OnItemAdded(in nsISupports parentItem, + const folderListenerNotifyFlagValue added = 0x1; + void OnItemAdded(in nsISupports parentItem, in nsISupports item, in string viewString); - void OnItemRemoved(in nsISupports parentItem, + const folderListenerNotifyFlagValue removed = 0x2; + void OnItemRemoved(in nsISupports parentItem, in nsISupports item, in string viewString); - void OnItemPropertyChanged(in nsISupports item, + const folderListenerNotifyFlagValue propertyChanged = 0x4; + void OnItemPropertyChanged(in nsISupports item, in nsIAtom property, in string oldValue, in string newValue); - void OnItemIntPropertyChanged(in nsISupports item, + const folderListenerNotifyFlagValue intPropertyChanged = 0x8; + void OnItemIntPropertyChanged(in nsISupports item, in nsIAtom property, in long oldValue, in long newValue); - void OnItemBoolPropertyChanged(in nsISupports item, + const folderListenerNotifyFlagValue boolPropertyChanged = 0x10; + void OnItemBoolPropertyChanged(in nsISupports item, in nsIAtom property, in boolean oldValue, in boolean newValue); + const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20; void OnItemUnicharPropertyChanged(in nsISupports item, in nsIAtom property, in wstring oldValue, in wstring newValue); - void OnItemPropertyFlagChanged(in nsISupports item, + const folderListenerNotifyFlagValue propertyFlagChanged = 0x40; + void OnItemPropertyFlagChanged(in nsISupports item, in nsIAtom property, in unsigned long oldFlag, in unsigned long newFlag); + const folderListenerNotifyFlagValue event = 0x80; void OnItemEvent(in nsIFolder item, in nsIAtom event); + const folderListenerNotifyFlagValue all = 0xFFFFFFFF; + // void OnFolderLoaded(in nsIFolder aFolder); // void OnDeleteOrMoveMessagesCompleted(in nsIFolder aFolder); }; diff --git a/mailnews/base/public/nsIMsgMailSession.idl b/mailnews/base/public/nsIMsgMailSession.idl index 8abdf5d4f04..e4bb2e1789c 100644 --- a/mailnews/base/public/nsIMsgMailSession.idl +++ b/mailnews/base/public/nsIMsgMailSession.idl @@ -56,10 +56,8 @@ interface nsIMsgWindow; [scriptable, uuid(D5124440-D59E-11d2-806A-006008128C4E)] interface nsIMsgMailSession : nsISupports { - - void Shutdown(); - void AddFolderListener(in nsIFolderListener listener); + void AddFolderListener(in nsIFolderListener listener, in folderListenerNotifyFlagValue notifyFlags); void RemoveFolderListener(in nsIFolderListener listener); readonly attribute nsIMsgWindow topmostMsgWindow; diff --git a/mailnews/base/resources/content/commandglue.js b/mailnews/base/resources/content/commandglue.js index a434b6dd7a6..93dcd01a6e1 100644 --- a/mailnews/base/resources/content/commandglue.js +++ b/mailnews/base/resources/content/commandglue.js @@ -189,10 +189,6 @@ function ChangeFolderByURI(uri, viewType, viewFlags, sortType, sortOrder) HideAccountCentral(); } - if (showPerformance) { - gBeforeFolderLoadTime = new Date(); - } - gCurrentLoadingFolderURI = uri; gNextMessageAfterDelete = null; // forget what message to select, if any diff --git a/mailnews/base/resources/content/messageWindow.js b/mailnews/base/resources/content/messageWindow.js index 9d98b8bd09f..adfaa9b103b 100644 --- a/mailnews/base/resources/content/messageWindow.js +++ b/mailnews/base/resources/content/messageWindow.js @@ -35,40 +35,34 @@ var gNextMessageViewIndexAfterDelete = -1; var folderListener = { OnItemAdded: function(parentItem, item, view) {}, - OnItemRemoved: function(parentItem, item, view) - { - var parentFolderResource = parentItem.QueryInterface(Components.interfaces.nsIRDFResource); - if(!parentFolderResource) - return; + OnItemRemoved: function(parentItem, item, view) { + var parentFolderResource = parentItem.QueryInterface(Components.interfaces.nsIRDFResource); + if(!parentFolderResource) + return; - var parentURI = parentFolderResource.Value; - if(parentURI != gCurrentFolderUri) - return; + var parentURI = parentFolderResource.Value; + if(parentURI != gCurrentFolderUri) + return; - var deletedMessageHdr = item.QueryInterface(Components.interfaces.nsIMsgDBHdr); + var deletedMessageHdr = item.QueryInterface(Components.interfaces.nsIMsgDBHdr); if (extractMsgKeyFromURI() == deletedMessageHdr.messageKey) - gCurrentMessageIsDeleted = true; - }, - - OnItemPropertyChanged: function(item, property, oldValue, newValue) {}, - - OnItemIntPropertyChanged: function(item, property, oldValue, newValue) - { - }, - - OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {}, + gCurrentMessageIsDeleted = true; + }, + OnItemPropertyChanged: function(item, property, oldValue, newValue) {}, + OnItemIntPropertyChanged: function(item, property, oldValue, newValue) { }, + OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {}, OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){}, - OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {}, + OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {}, OnItemEvent: function(folder, event) { - if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") { - HandleDeleteOrMoveMsgCompleted(folder); - } - else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") { - HandleDeleteOrMoveMsgFailed(folder); - } + if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") { + HandleDeleteOrMoveMsgCompleted(folder); + } + else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") { + HandleDeleteOrMoveMsgFailed(folder); } + } } function nsMsgDBViewCommandUpdater() @@ -157,9 +151,11 @@ function OnLoadMessageWindow() OnLoadMsgHeaderPane(); try { - mailSession.AddFolderListener(folderListener); - } catch (ex) { - dump("Error adding to session\n"); + var nsIFolderListener = Components.interfaces.nsIFolderListener; + var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event; + mailSession.AddFolderListener(folderListener, notifyFlags); + } catch (ex) { + dump("Error adding to session: " +ex + "\n"); } var originalView = null; diff --git a/mailnews/base/resources/content/msgMail3PaneWindow.js b/mailnews/base/resources/content/msgMail3PaneWindow.js index ebd61d97441..48c4410b2bb 100644 --- a/mailnews/base/resources/content/msgMail3PaneWindow.js +++ b/mailnews/base/resources/content/msgMail3PaneWindow.js @@ -24,8 +24,6 @@ /* This is where functions related to the 3 pane window are kept */ -var showPerformance = false; - var gFolderOutliner; var gMessagePane; var gMessagePaneFrame; @@ -60,49 +58,41 @@ var gDisplayStartupPage = false; // the folderListener object var folderListener = { - OnItemAdded: function(parentItem, item, view) {}, + OnItemAdded: function(parentItem, item, view) { }, - OnItemRemoved: function(parentItem, item, view){}, + OnItemRemoved: function(parentItem, item, view) { }, - OnItemPropertyChanged: function(item, property, oldValue, newValue) {}, + OnItemPropertyChanged: function(item, property, oldValue, newValue) { }, - OnItemIntPropertyChanged: function(item, property, oldValue, newValue) - { - var currentLoadedFolder = GetThreadPaneFolder(); - if (!currentLoadedFolder) return; + OnItemIntPropertyChanged: function(item, property, oldValue, newValue) { + var currentLoadedFolder = GetThreadPaneFolder(); + if (!currentLoadedFolder) return; + var currentURI = currentLoadedFolder.URI; - var currentURI = currentLoadedFolder.URI; + //if we don't have a folder loaded, don't bother. + if(currentURI) { + if(property.GetUnicode() == "TotalMessages" || property.GetUnicode() == "TotalUnreadMessages") { + var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder); + if(folder) { + var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource); + if(folderResource) { + var folderURI = folderResource.Value; + if(currentURI == folderURI) { + UpdateStatusMessageCounts(folder); + } + } + } + } + } + }, - //if we don't have a folder loaded, don't bother. - if(currentURI) - { - if(property.GetUnicode() == "TotalMessages" || property.GetUnicode() == "TotalUnreadMessages") - { - var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder); - if(folder) - { - var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource); - if(folderResource) - { - var folderURI = folderResource.Value; - if(currentURI == folderURI) - { - UpdateStatusMessageCounts(folder); - } - } - } - } - } - }, + OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) { }, - OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {}, - - OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){}, - OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {}, + OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) { }, + OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) { }, OnItemEvent: function(folder, event) { var eventType = event.GetUnicode(); - if (eventType == "FolderLoaded") { if (folder) { var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource); @@ -146,10 +136,6 @@ var folderListener = { if(uri == gCurrentLoadingFolderURI) { gCurrentLoadingFolderURI = ""; //Now let's select the first new message if there is one - var beforeScrollToNew; - if(showPerformance) { - beforeScrollToNew = new Date(); - } if (!scrolled) { // if we didn't just scroll, scroll to the first new message // don't select it though @@ -160,15 +146,6 @@ var folderListener = { EnsureRowInThreadOutlinerIsVisible(0); } } - if(showPerformance) { - var afterScrollToNew = new Date(); - var timeToScroll = (afterScrollToNew.getTime() - beforeScrollToNew.getTime())/1000; - - var afterFolderLoadTime = new Date(); - var timeToLoad = (afterFolderLoadTime.getTime() - gBeforeFolderLoadTime.getTime())/1000; - dump("Time to load " + uri + " is " + timeToLoad + " seconds\n"); - dump("of which scrolling to new is " + timeToScroll + " seconds\n"); - } SetBusyCursor(window, false); } } @@ -418,12 +395,6 @@ var gThreePaneIncomingServerListener = { /* Functions related to startup */ function OnLoadMessenger() { - showPerformance = pref.GetBoolPref('mail.showMessengerPerformance'); - var beforeLoadMessenger; - if(showPerformance) { - beforeLoadMessenger = new Date(); - } - AddMailOfflineObserver(); CreateMailWindowGlobals(); Create3PaneGlobals(); @@ -499,12 +470,6 @@ function OnLoadMessenger() //Set focus to the Thread Pane the first time the window is opened. SetFocusThreadPane(); - - if(showPerformance) { - var afterLoadMessenger = new Date(); - var timeToLoad = (afterLoadMessenger.getTime() - beforeLoadMessenger.getTime())/1000; - dump("Time in OnLoadMessger is " + timeToLoad + " seconds\n"); - } } function OnUnloadMessenger() @@ -651,7 +616,9 @@ function AddToSession() try { var mailSession = Components.classes[mailSessionContractID].getService(Components.interfaces.nsIMsgMailSession); - mailSession.AddFolderListener(folderListener); + var nsIFolderListener = Components.interfaces.nsIFolderListener; + var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event; + mailSession.AddFolderListener(folderListener, notifyFlags); } catch (ex) { dump("Error adding to session\n"); } diff --git a/mailnews/base/search/resources/content/SearchDialog.js b/mailnews/base/search/resources/content/SearchDialog.js index a0f4f4ffd8b..be90b362b07 100644 --- a/mailnews/base/search/resources/content/SearchDialog.js +++ b/mailnews/base/search/resources/content/SearchDialog.js @@ -471,7 +471,9 @@ function setupDatasource() { gSearchSessionFolderListener = gSearchSession.QueryInterface(Components.interfaces.nsIFolderListener); gMailSession = Components.classes[mailSessionContractID].getService(Components.interfaces.nsIMsgMailSession); - gMailSession.AddFolderListener(gSearchSessionFolderListener); + var nsIFolderListener = Components.interfaces.nsIFolderListener; + var notifyFlags = nsIFolderListener.event; + gMailSession.AddFolderListener(gSearchSessionFolderListener, notifyFlags); // the datasource is a listener on the search results gViewSearchListener = gSearchView.QueryInterface(Components.interfaces.nsIMsgSearchNotify); diff --git a/mailnews/base/src/nsMessengerWinIntegration.cpp b/mailnews/base/src/nsMessengerWinIntegration.cpp index 586aa2a1b71..c6932539a9d 100644 --- a/mailnews/base/src/nsMessengerWinIntegration.cpp +++ b/mailnews/base/src/nsMessengerWinIntegration.cpp @@ -189,7 +189,7 @@ nsMessengerWinIntegration::Init() NS_ENSURE_SUCCESS(rv,rv); // because we care if the unread total count changes - rv = mailSession->AddFolderListener(this); + rv = mailSession->AddFolderListener(this, nsIFolderListener::boolPropertyChanged | nsIFolderListener::intPropertyChanged); NS_ENSURE_SUCCESS(rv,rv); // get current profile name to fill in commandliner. diff --git a/mailnews/base/src/nsMsgFolderDataSource.cpp b/mailnews/base/src/nsMsgFolderDataSource.cpp index 0c351445ca3..ca22d3000cd 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -265,14 +265,21 @@ nsresult nsMsgFolderDataSource::Init() { nsresult rv; - rv = nsMsgRDFDataSource::Init(); + rv = nsMsgRDFDataSource::Init(); if (NS_FAILED(rv)) return rv; nsCOMPtr mailSession = - do_GetService(kMsgMailSessionCID, &rv); - if(NS_SUCCEEDED(rv)) - mailSession->AddFolderListener(this); + do_GetService(kMsgMailSessionCID, &rv); + + if(NS_SUCCEEDED(rv)) + mailSession->AddFolderListener(this, + nsIFolderListener::added | + nsIFolderListener::removed | + nsIFolderListener::intPropertyChanged | + nsIFolderListener::boolPropertyChanged | + nsIFolderListener::unicharPropertyChanged | + nsIFolderListener::propertyFlagChanged); return NS_OK; } diff --git a/mailnews/base/src/nsMsgMailSession.cpp b/mailnews/base/src/nsMsgMailSession.cpp index 047a9b36c85..dbe85031b7d 100644 --- a/mailnews/base/src/nsMsgMailSession.cpp +++ b/mailnews/base/src/nsMsgMailSession.cpp @@ -78,7 +78,6 @@ nsresult nsMsgMailSession::Init() rv = NS_NewISupportsArray(getter_AddRefs(mWindows)); return rv; - } nsresult nsMsgMailSession::Shutdown() @@ -87,12 +86,13 @@ nsresult nsMsgMailSession::Shutdown() } -NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener * listener) +NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener * listener, PRUint32 notifyFlags) { NS_ASSERTION(mListeners, "no listeners"); if (!mListeners) return NS_ERROR_FAILURE; mListeners->AppendElement(listener); + mListenerNotifyFlags.Add(notifyFlags); return NS_OK; } @@ -100,7 +100,13 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(nsIFolderListener * listene { NS_ASSERTION(mListeners, "no listeners"); if (!mListeners) return NS_ERROR_FAILURE; - + + PRInt32 index; + nsresult rv = mListeners->GetIndexOf(listener, &index); + NS_ENSURE_SUCCESS(rv,rv); + + mListenerNotifyFlags.RemoveAt(index); + mListeners->RemoveElement(listener); return NS_OK; @@ -124,10 +130,12 @@ nsMsgMailSession::OnItemPropertyChanged(nsISupports *item, for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::propertyChanged) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemPropertyChanged(item, property, oldValue, newValue); + } } return NS_OK; @@ -152,10 +160,12 @@ nsMsgMailSession::OnItemUnicharPropertyChanged(nsISupports *item, for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::unicharPropertyChanged) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemUnicharPropertyChanged(item, property, oldValue, newValue); + } } return NS_OK; @@ -180,10 +190,12 @@ nsMsgMailSession::OnItemIntPropertyChanged(nsISupports *item, for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::intPropertyChanged) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemIntPropertyChanged(item, property, oldValue, newValue); + } } return NS_OK; @@ -208,10 +220,12 @@ nsMsgMailSession::OnItemBoolPropertyChanged(nsISupports *item, for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::boolPropertyChanged) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemBoolPropertyChanged(item, property, oldValue, newValue); + } } return NS_OK; @@ -223,26 +237,26 @@ nsMsgMailSession::OnItemPropertyFlagChanged(nsISupports *item, PRUint32 oldValue, PRUint32 newValue) { - nsresult rv; - PRUint32 count; + nsresult rv; + PRUint32 count; - NS_ASSERTION(mListeners, "no listeners"); - if (!mListeners) return NS_ERROR_FAILURE; + NS_ASSERTION(mListeners, "no listeners"); + if (!mListeners) return NS_ERROR_FAILURE; - rv = mListeners->Count(&count); - if (NS_FAILED(rv)) return rv; + rv = mListeners->Count(&count); + if (NS_FAILED(rv)) return rv; - - for(PRUint32 i = 0; i < count; i++) - { - nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); - NS_ASSERTION(listener, "listener is null"); - if (!listener) return NS_ERROR_FAILURE; - listener->OnItemPropertyFlagChanged(item, property, oldValue, newValue); - } - - return NS_OK; + for(PRUint32 i = 0; i < count; i++) + { + if (mListenerNotifyFlags[i] & nsIFolderListener::propertyFlagChanged) { + nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); + NS_ASSERTION(listener, "listener is null"); + if (!listener) return NS_ERROR_FAILURE; + listener->OnItemPropertyFlagChanged(item, property, oldValue, newValue); + } + } + return NS_OK; } NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsISupports *parentItem, nsISupports *item, const char* viewString) @@ -259,10 +273,12 @@ NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsISupports *parentItem, nsISupports for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::added) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemAdded(parentItem, item, viewString); + } } return NS_OK; @@ -283,10 +299,12 @@ NS_IMETHODIMP nsMsgMailSession::OnItemRemoved(nsISupports *parentItem, nsISuppor for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::removed) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); NS_ASSERTION(listener, "listener is null"); if (!listener) return NS_ERROR_FAILURE; listener->OnItemRemoved(parentItem, item, viewString); + } } return NS_OK; @@ -307,9 +325,11 @@ NS_IMETHODIMP nsMsgMailSession::OnItemEvent(nsIFolder *aFolder, for(PRUint32 i = 0; i < count; i++) { + if (mListenerNotifyFlags[i] & nsIFolderListener::event) { nsCOMPtr listener = getter_AddRefs((nsIFolderListener*)mListeners->ElementAt(i)); if(listener) listener->OnItemEvent(aFolder, aEvent); + } } return NS_OK; } diff --git a/mailnews/base/src/nsMsgMailSession.h b/mailnews/base/src/nsMsgMailSession.h index 7119ee6ed99..f11a6c16ad6 100644 --- a/mailnews/base/src/nsMsgMailSession.h +++ b/mailnews/base/src/nsMsgMailSession.h @@ -68,10 +68,11 @@ public: nsresult Init(); protected: nsCOMPtr mListeners; + nsUInt32Array mListenerNotifyFlags; + nsCOMPtr mWindows; // stick this here temporarily nsCOMPtr m_temporaryMsgWindow; - }; diff --git a/mailnews/base/src/nsMsgNotificationManager.cpp b/mailnews/base/src/nsMsgNotificationManager.cpp index 84722ca7825..8ee6328a624 100644 --- a/mailnews/base/src/nsMsgNotificationManager.cpp +++ b/mailnews/base/src/nsMsgNotificationManager.cpp @@ -148,7 +148,7 @@ nsresult nsMsgNotificationManager::Init() nsCOMPtr mailSession = do_GetService(kMsgMailSessionCID, &rv); if(NS_SUCCEEDED(rv)) - rv = mailSession->AddFolderListener(this); + rv = mailSession->AddFolderListener(this, nsIFolderListener::propertyChanged | nsIFolderListener::propertyFlagChanged); if(NS_FAILED(rv)) return rv; diff --git a/mailnews/base/src/nsStatusBarBiffManager.cpp b/mailnews/base/src/nsStatusBarBiffManager.cpp index 0aaf5c3a4cf..05401e7016e 100644 --- a/mailnews/base/src/nsStatusBarBiffManager.cpp +++ b/mailnews/base/src/nsStatusBarBiffManager.cpp @@ -92,7 +92,7 @@ nsresult nsStatusBarBiffManager::Init() nsCOMPtr mailSession = do_GetService(kMsgMailSessionCID, &rv); if(NS_SUCCEEDED(rv)) - mailSession->AddFolderListener(this); + mailSession->AddFolderListener(this, nsIFolderListener::propertyFlagChanged); mInitialized = PR_TRUE; return NS_OK; @@ -121,7 +121,7 @@ nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag) if (NS_SUCCEEDED(rv) && playSoundOnBiff) { nsCOMPtr sound = do_CreateInstance("@mozilla.org/sound;1"); if (sound) { - rv = sound->PlaySystemSound("Mailbeep"); + rv = sound->PlaySystemSound("_moz_mailbeep"); } } } diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js index 265bf46f3a9..3242975f9b8 100644 --- a/mailnews/mailnews.js +++ b/mailnews/mailnews.js @@ -36,7 +36,6 @@ * ***** END LICENSE BLOCK ***** */ pref("mailnews.logComposePerformance", false); -pref("mail.showMessengerPerformance", false); pref("mail.wrap_long_lines", true); pref("news.wrap_long_lines", true); @@ -316,12 +315,7 @@ pref("mail.enable_autocomplete",true); pref("mailnews.html_domains",""); pref("mailnews.plaintext_domains",""); -// the ui will eventually use these three prefs: pref("mail.biff.play_sound",true); -pref("mail.biff.use_default_sound",true); -pref("mail.biff.sound_file",""); -// must be an URL. (provide this back door for mac users, until we have a UI -pref("mail.biff.default_sound_url",""); pref("mail.content_disposition_type", 0); diff --git a/modules/libpref/src/init/mailnews.js b/modules/libpref/src/init/mailnews.js index 265bf46f3a9..3242975f9b8 100644 --- a/modules/libpref/src/init/mailnews.js +++ b/modules/libpref/src/init/mailnews.js @@ -36,7 +36,6 @@ * ***** END LICENSE BLOCK ***** */ pref("mailnews.logComposePerformance", false); -pref("mail.showMessengerPerformance", false); pref("mail.wrap_long_lines", true); pref("news.wrap_long_lines", true); @@ -316,12 +315,7 @@ pref("mail.enable_autocomplete",true); pref("mailnews.html_domains",""); pref("mailnews.plaintext_domains",""); -// the ui will eventually use these three prefs: pref("mail.biff.play_sound",true); -pref("mail.biff.use_default_sound",true); -pref("mail.biff.sound_file",""); -// must be an URL. (provide this back door for mac users, until we have a UI -pref("mail.biff.default_sound_url",""); pref("mail.content_disposition_type", 0); diff --git a/widget/src/mac/nsSound.cpp b/widget/src/mac/nsSound.cpp index 60ac4b375ce..b854b43fad5 100644 --- a/widget/src/mac/nsSound.cpp +++ b/widget/src/mac/nsSound.cpp @@ -429,7 +429,7 @@ nsSound::GetSoundResourceName(const char* inSoundName, StringPtr outResourceName outResourceName[0] = 0; // if it's the special mail beep sound, get the real sound name from IC - if (nsCRT::strcmp("Mailbeep", inSoundName) == 0) + if (nsCRT::strcmp("_moz_mailbeep", inSoundName) == 0) { nsCOMPtr icService = do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) diff --git a/widget/src/windows/nsSound.cpp b/widget/src/windows/nsSound.cpp index 57a7baefb63..4e611cbc554 100644 --- a/widget/src/windows/nsSound.cpp +++ b/widget/src/windows/nsSound.cpp @@ -161,7 +161,12 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const char *aSoundAlias) { PurgeLastSound(); - ::PlaySound(aSoundAlias, nsnull, SND_ALIAS | SND_ASYNC); + if (nsCRT::strcmp("_moz_mailbeep", aSoundAlias) == 0) { + ::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC); + } + else { + ::PlaySound(aSoundAlias, nsnull, SND_ALIAS | SND_ASYNC); + } return NS_OK; }