more fixes for allowing user to specify the default mail sound.

allow the pref to be set to a system sound, or to a file url.
r/sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2002-09-16 03:27:57 +00:00
Родитель 22a0eeedd4
Коммит dde805172f
3 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -122,11 +122,14 @@ nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag)
if (!mSound)
mSound = do_CreateInstance("@mozilla.org/sound;1");
nsXPIDLCString soundURLspec;
rv = pref->GetCharPref(PREF_NEW_MAIL_URL, getter_Copies(soundURLspec));
if (NS_SUCCEEDED(rv) && !soundURLspec.IsEmpty()) {
nsXPIDLCString soundURLSpec;
rv = pref->GetCharPref(PREF_NEW_MAIL_URL, getter_Copies(soundURLSpec));
// if this is a file url, try to play it.
// otherwise, treat it as a system sound.
if (NS_SUCCEEDED(rv) && !strncmp(soundURLSpec.get(), "file://", 7)) {
nsCOMPtr<nsIFileURL> soundURL = do_CreateInstance("@mozilla.org/network/standard-url;1");
rv = soundURL->SetSpec(soundURLspec);
rv = soundURL->SetSpec(soundURLSpec);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIFile> soundFile;
@ -141,7 +144,13 @@ nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag)
customSoundPlayed = PR_TRUE;
}
}
else if (!soundURLSpec.IsEmpty()) {
rv = mSound->PlaySystemSound(soundURLSpec.get());
if (NS_SUCCEEDED(rv))
customSoundPlayed = PR_TRUE;
}
// if nothing played, play the default
if (!customSoundPlayed) {
rv = mSound->PlaySystemSound("_moz_mailbeep");
NS_ENSURE_SUCCESS(rv,rv);

Просмотреть файл

@ -390,7 +390,9 @@ pref("mailnews.append_preconfig_accounts.version",1);
pref("mail.append_preconfig_smtpservers.version",1);
pref("mail.biff.play_sound",true);
pref("mail.biff.play_sound.url","");
// _moz_mailbeep is a magic key, for the default sound.
// otherwise, this needs to be a file url
pref("mail.biff.play_sound.url","_moz_mailbeep");
pref("mail.biff.show_alert", true);
pref("mail.content_disposition_type", 0);

Просмотреть файл

@ -390,7 +390,9 @@ pref("mailnews.append_preconfig_accounts.version",1);
pref("mail.append_preconfig_smtpservers.version",1);
pref("mail.biff.play_sound",true);
pref("mail.biff.play_sound.url","");
// _moz_mailbeep is a magic key, for the default sound.
// otherwise, this needs to be a file url
pref("mail.biff.play_sound.url","_moz_mailbeep");
pref("mail.biff.show_alert", true);
pref("mail.content_disposition_type", 0);