Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Static Protected Attributes | Events | Private Member Functions | Private Attributes
nsStatusBarBiffManager Class Reference

#include <nsStatusBarBiffManager.h>

Inheritance diagram for nsStatusBarBiffManager:
Inheritance graph
[legend]
Collaboration diagram for nsStatusBarBiffManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIFOLDERLISTENER
NS_DECL_NSISTATUSBARBIFFMANAGER 
nsStatusBarBiffManager ()
virtual ~nsStatusBarBiffManager ()
nsresult Init ()
void OnItemAdded (in nsIRDFResource parentItem, in nsISupports item)
void OnItemRemoved (in nsIRDFResource parentItem, in nsISupports item)
void OnItemPropertyChanged (in nsIRDFResource item, in nsIAtom property, in string oldValue, in string newValue)
void OnItemIntPropertyChanged (in nsIRDFResource item, in nsIAtom property, in long oldValue, in long newValue)
void OnItemBoolPropertyChanged (in nsIRDFResource item, in nsIAtom property, in boolean oldValue, in boolean newValue)
void OnItemUnicharPropertyChanged (in nsIRDFResource item, in nsIAtom property, in wstring oldValue, in wstring newValue)
void OnItemPropertyFlagChanged (in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldFlag, in unsigned long newFlag)
void OnItemEvent (in nsIMsgFolder item, in nsIAtom event)

Public Attributes

readonly attribute nsMsgBiffState biffState
const folderListenerNotifyFlagValue added = 0x1
const folderListenerNotifyFlagValue removed = 0x2
const folderListenerNotifyFlagValue propertyChanged = 0x4
const folderListenerNotifyFlagValue intPropertyChanged = 0x8
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40

Static Protected Attributes

static nsIAtomkBiffStateAtom = nsnull

Events

const
folderListenerNotifyFlagValue=0 
x80
const folderListenerNotifyFlagValue all = 0xFFFFFFFF

Private Member Functions

nsresult PlayBiffSound ()

Private Attributes

PRBool mInitialized
PRInt32 mCurrentBiffState
nsCOMPtr< nsISoundmSound

Detailed Description

Definition at line 47 of file nsStatusBarBiffManager.h.


Constructor & Destructor Documentation

Definition at line 74 of file nsStatusBarBiffManager.cpp.


Member Function Documentation

Definition at line 86 of file nsStatusBarBiffManager.cpp.

Here is the call graph for this function:

void nsIFolderListener::OnItemAdded ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemBoolPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in boolean  oldValue,
in boolean  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemEvent ( in nsIMsgFolder  item,
in nsIAtom  event 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemIntPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in long  oldValue,
in long  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in string  oldValue,
in string  newValue 
) [inherited]
void nsIFolderListener::OnItemPropertyFlagChanged ( in nsIMsgDBHdr  item,
in nsIAtom  property,
in unsigned long  oldFlag,
in unsigned long  newFlag 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemRemoved ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]
void nsIFolderListener::OnItemUnicharPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in wstring  oldValue,
in wstring  newValue 
) [inherited]

Definition at line 104 of file nsStatusBarBiffManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  NS_ENSURE_SUCCESS(rv,rv);
  
  PRBool playSoundOnBiff = PR_FALSE;
  rv = pref->GetBoolPref(PREF_PLAY_SOUND_ON_NEW_MAIL, &playSoundOnBiff);
  NS_ENSURE_SUCCESS(rv,rv);
  
  if (!playSoundOnBiff)
    return NS_OK;

  // lazily create the sound instance
  if (!mSound)
    mSound = do_CreateInstance("@mozilla.org/sound;1");
      
  PRInt32 newMailSoundType = SYSTEM_SOUND_TYPE;
  rv = pref->GetIntPref(PREF_NEW_MAIL_SOUND_TYPE, &newMailSoundType);
  NS_ENSURE_SUCCESS(rv,rv);

  PRBool customSoundPlayed = PR_FALSE;

  if (newMailSoundType == CUSTOM_SOUND_TYPE) {
    nsXPIDLCString soundURLSpec;
    rv = pref->GetCharPref(PREF_NEW_MAIL_SOUND_URL, getter_Copies(soundURLSpec));
    if (NS_SUCCEEDED(rv) && !soundURLSpec.IsEmpty()) {
      if (!strncmp(soundURLSpec.get(), "file://", 7)) {
        nsCOMPtr<nsIURI> fileURI;
        rv = NS_NewURI(getter_AddRefs(fileURI), soundURLSpec);
        NS_ENSURE_SUCCESS(rv,rv);
        nsCOMPtr<nsIFileURL> soundURL = do_QueryInterface(fileURI,&rv);
        if (NS_SUCCEEDED(rv)) {
          nsCOMPtr<nsIFile> soundFile;
          rv = soundURL->GetFile(getter_AddRefs(soundFile));
          if (NS_SUCCEEDED(rv)) {
            PRBool soundFileExists = PR_FALSE;
            rv = soundFile->Exists(&soundFileExists);
            if (NS_SUCCEEDED(rv) && soundFileExists) {
              rv = mSound->Play(soundURL);
              if (NS_SUCCEEDED(rv))
                customSoundPlayed = PR_TRUE;
            }
          }
        }
      }
      else {
        // todo, see if we can create a nsIFile using the string as a native path.
        // if that fails, try playing a system sound
        rv = mSound->PlaySystemSound(soundURLSpec.get());
        if (NS_SUCCEEDED(rv))
          customSoundPlayed = PR_TRUE;
      }
    }
  }    
  
  // if nothing played, play the default system sound
  if (!customSoundPlayed) {
    rv = mSound->PlaySystemSound(DEFAULT_SYSTEM_SOUND);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  return rv;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 49 of file nsIFolderListener.idl.

Definition at line 43 of file nsIStatusBarBiffManager.idl.

Definition at line 69 of file nsIFolderListener.idl.

Definition at line 63 of file nsIFolderListener.idl.

Definition at line 65 of file nsStatusBarBiffManager.h.

Definition at line 60 of file nsStatusBarBiffManager.h.

Definition at line 59 of file nsStatusBarBiffManager.h.

Definition at line 61 of file nsStatusBarBiffManager.h.

Definition at line 57 of file nsIFolderListener.idl.

Definition at line 81 of file nsIFolderListener.idl.

Definition at line 53 of file nsIFolderListener.idl.

Definition at line 75 of file nsIFolderListener.idl.


Event Documentation

Definition at line 90 of file nsIFolderListener.idl.

Definition at line 87 of file nsIFolderListener.idl.


The documentation for this class was generated from the following files: