зеркало из https://github.com/mozilla/gecko-dev.git
control the default url for sound to play on new mail with a pref,
instead of hard coding it. (really, this is a back door for mac users, until we have a UI for this.) #64462 sr=bienvenu
This commit is contained in:
Родитель
777a319b9d
Коммит
ea05793dea
|
@ -61,6 +61,11 @@ nsStatusBarBiffManager::~nsStatusBarBiffManager()
|
|||
NS_RELEASE(kBiffStateAtom);
|
||||
}
|
||||
|
||||
#define PREF_PLAY_SOUND_ON_NEW_MAIL "mail.biff.play_sound"
|
||||
#define PREF_PLAY_DEFAULT_SOUND "mail.biff.use_default_sound"
|
||||
#define PREF_USER_SPECIFIED_SOUND_FILE "mail.biff.sound_file"
|
||||
#define DEFAULT_NEW_MAIL_SOUND_URL_PREF "mail.biff.default_sound_url"
|
||||
|
||||
nsresult nsStatusBarBiffManager::Init()
|
||||
{
|
||||
if (mInitialized)
|
||||
|
@ -74,6 +79,12 @@ nsresult nsStatusBarBiffManager::Init()
|
|||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->AddFolderListener(this);
|
||||
|
||||
nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID);
|
||||
nsXPIDLCString url;
|
||||
rv = pref->CopyCharPref(DEFAULT_NEW_MAIL_SOUND_URL_PREF, getter_Copies(url));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
mDefaultSoundURL = url;
|
||||
mInitialized = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -83,10 +94,6 @@ nsresult nsStatusBarBiffManager::Shutdown()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#define PREF_PLAY_SOUND_ON_NEW_MAIL "mail.biff.play_sound"
|
||||
#define PREF_PLAY_DEFAULT_SOUND "mail.biff.use_default_sound"
|
||||
#define PREF_USER_SPECIFIED_SOUND_FILE "mail.biff.sound_file"
|
||||
#define DEFAULT_NEW_MAIL_SOUND "chrome://messenger/content/newmail.wav"
|
||||
|
||||
nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag)
|
||||
{
|
||||
|
@ -123,7 +130,7 @@ nsresult nsStatusBarBiffManager::PerformStatusBarBiff(PRUint32 newBiffFlag)
|
|||
}
|
||||
|
||||
if (NS_FAILED(rv) || playDefaultSound) {
|
||||
rv = soundURL->SetSpec(DEFAULT_NEW_MAIL_SOUND);
|
||||
rv = soundURL->SetSpec(mDefaultSoundURL.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
private:
|
||||
PRBool mInitialized;
|
||||
PRUint32 mCurrentBiffState;
|
||||
nsCString mDefaultSoundURL;
|
||||
|
||||
protected:
|
||||
static nsIAtom* kBiffStateAtom;
|
||||
|
|
|
@ -302,8 +302,11 @@ pref("news.cancel.alert_on_success",true);
|
|||
pref("mail.SpellCheckBeforeSend",false);
|
||||
pref("mail.enable_autocomplete",true);
|
||||
|
||||
// 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","chrome://messenger/content/newmail.wav");
|
||||
|
||||
pref("mail.content_disposition_type", 0);
|
||||
|
|
|
@ -302,8 +302,11 @@ pref("news.cancel.alert_on_success",true);
|
|||
pref("mail.SpellCheckBeforeSend",false);
|
||||
pref("mail.enable_autocomplete",true);
|
||||
|
||||
// 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","chrome://messenger/content/newmail.wav");
|
||||
|
||||
pref("mail.content_disposition_type", 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче