Bug 835002 - Add back Growl support for TB19/20/21 and SM 2.16/2.17/2.18. r=Standard8
This commit is contained in:
Родитель
0bb44bdd99
Коммит
e479fd35da
|
@ -475,6 +475,9 @@ mdnBarMessageNormal=%1$S has asked to be notified when you read this message.
|
|||
#LOCALIZATION NOTE(mdnBarMessageAddressDiffers) %1$S is the name of the sender, %2$S is the address(es) to send return receipt to
|
||||
mdnBarMessageAddressDiffers=%1$S has asked to be notified (on %2$S) when you read this message.
|
||||
|
||||
# Strings for growl notifications on Mac OS X
|
||||
growlNotification=New Mail
|
||||
|
||||
# mailCommands.js
|
||||
emptyJunkTitle=Confirm
|
||||
emptyJunkMessage=Are you sure you want to permanently delete all messages and subfolders in the Junk folder?
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsIAlertsService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsINotificationsList.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
|
@ -182,9 +183,11 @@ NS_INTERFACE_MAP_END
|
|||
nsresult
|
||||
nsMessengerOSXIntegration::Init()
|
||||
{
|
||||
// need to register a named Growl notification
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
observerService->AddObserver(this, "before-growl-registration", false);
|
||||
return observerService->AddObserver(this, "mail-startup-done", false);
|
||||
}
|
||||
|
||||
|
@ -250,6 +253,28 @@ nsMessengerOSXIntegration::Observe(nsISupports* aSubject, const char* aTopic, co
|
|||
return mailSession->AddFolderListener(this, nsIFolderListener::boolPropertyChanged | nsIFolderListener::intPropertyChanged);
|
||||
}
|
||||
|
||||
// register named Growl notification for new mail alerts.
|
||||
if (!strcmp(aTopic, "before-growl-registration"))
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
observerService->RemoveObserver(this, "before-growl-registration");
|
||||
|
||||
nsCOMPtr<nsINotificationsList> notifications = do_QueryInterface(aSubject, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
GetStringBundle(getter_AddRefs(bundle));
|
||||
if (bundle)
|
||||
{
|
||||
nsString growlNotification;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("growlNotification").get(), getter_Copies(growlNotification));
|
||||
notifications->AddNotification(growlNotification, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, kNewChatMessageTopic)) {
|
||||
// We don't have to bother about checking if the window is already focused
|
||||
// before attempting to bounce the dock icon, as BounceDockIcon is
|
||||
|
@ -382,14 +407,25 @@ nsMessengerOSXIntegration::ShowAlertMessage(const nsAString& aAlertTitle,
|
|||
|
||||
if (showAlert)
|
||||
{
|
||||
// Use growl if installed
|
||||
nsCOMPtr<nsIAlertsService> alertsService (do_GetService(NS_ALERTSERVICE_CONTRACTID, &rv));
|
||||
// If we have an nsIAlertsService implementation, use it:
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
alertsService->ShowAlertNotification(NS_LITERAL_STRING(kNewMailAlertIcon),
|
||||
aAlertTitle, aAlertText, true,
|
||||
NS_ConvertASCIItoUTF16(aFolderURI),
|
||||
this, EmptyString());
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
GetStringBundle(getter_AddRefs(bundle));
|
||||
if (bundle)
|
||||
{
|
||||
nsString growlNotification;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("growlNotification").get(),
|
||||
getter_Copies(growlNotification));
|
||||
rv = alertsService->ShowAlertNotification(NS_LITERAL_STRING(kNewMailAlertIcon),
|
||||
aAlertTitle,
|
||||
aAlertText,
|
||||
true,
|
||||
NS_ConvertASCIItoUTF16(aFolderURI),
|
||||
this,
|
||||
growlNotification);
|
||||
}
|
||||
}
|
||||
|
||||
BounceDockIcon();
|
||||
|
|
|
@ -396,6 +396,9 @@ mdnBarMessageNormal=%1$S has asked to be notified when you read this message.
|
|||
#LOCALIZATION NOTE(mdnBarMessageAddressDiffers) %1$S is the name of the sender, %2$S is the address(es) to send return receipt to
|
||||
mdnBarMessageAddressDiffers=%1$S has asked to be notified at %2$S when you read this message.
|
||||
|
||||
# Strings for growl notifications on Mac OS X
|
||||
growlNotification=New Mail
|
||||
|
||||
# mailCommands.js
|
||||
emptyJunkTitle=Confirm
|
||||
emptyJunkMessage=Are you sure you want to permanently delete all messages and subfolders in the Junk folder?
|
||||
|
|
Загрузка…
Ссылка в новой задаче