forked from pool/MozillaThunderbird
90 lines
3.4 KiB
Diff
90 lines
3.4 KiB
Diff
|
# HG changeset patch
|
||
|
# Parent 7aff84f58a8fd64d2bf34fe386e97f173f2562f3
|
||
|
|
||
|
diff --git a/mailnews/base/src/nsMessengerUnixIntegration.cpp b/mailnews/base/src/nsMessengerUnixIntegration.cpp
|
||
|
--- a/mailnews/base/src/nsMessengerUnixIntegration.cpp
|
||
|
+++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp
|
||
|
@@ -378,47 +378,46 @@ nsresult nsMessengerUnixIntegration::Sho
|
||
|
|
||
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||
|
bool showAlert = true;
|
||
|
prefBranch->GetBoolPref(SHOW_ALERT_PREF, &showAlert);
|
||
|
|
||
|
if (showAlert)
|
||
|
{
|
||
|
+ mAlertInProgress = true;
|
||
|
#ifdef MOZ_THUNDERBIRD
|
||
|
nsCOMPtr<nsIAlertsService> alertsService(do_GetService(NS_SYSTEMALERTSERVICE_CONTRACTID, &rv));
|
||
|
if (NS_SUCCEEDED(rv)) {
|
||
|
- mAlertInProgress = true;
|
||
|
rv = alertsService->ShowAlertNotification(NS_LITERAL_STRING(NEW_MAIL_ALERT_ICON),
|
||
|
aAlertTitle,
|
||
|
aAlertText,
|
||
|
false,
|
||
|
NS_ConvertASCIItoUTF16(aFolderURI),
|
||
|
this,
|
||
|
EmptyString());
|
||
|
if (NS_SUCCEEDED(rv))
|
||
|
return rv;
|
||
|
}
|
||
|
AlertFinished();
|
||
|
- ShowNewAlertNotification(false);
|
||
|
+ rv = ShowNewAlertNotification(false);
|
||
|
|
||
|
#else
|
||
|
nsCOMPtr<nsIAlertsService> alertsService (do_GetService(NS_ALERTSERVICE_CONTRACTID, &rv));
|
||
|
if (NS_SUCCEEDED(rv))
|
||
|
{
|
||
|
rv = alertsService->ShowAlertNotification(NS_LITERAL_STRING(NEW_MAIL_ALERT_ICON), aAlertTitle,
|
||
|
aAlertText, true,
|
||
|
NS_ConvertASCIItoUTF16(aFolderURI), this,
|
||
|
EmptyString());
|
||
|
- mAlertInProgress = true;
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
- if (!showAlert || NS_FAILED(rv)) // go straight to showing the system tray icon.
|
||
|
+ if (NS_FAILED(rv)) // go straight to showing the system tray icon.
|
||
|
AlertFinished();
|
||
|
|
||
|
return rv;
|
||
|
}
|
||
|
|
||
|
#ifdef MOZ_THUNDERBIRD
|
||
|
// Opening Thunderbird's new mail alert notification window for not supporting libnotify
|
||
|
// aUserInitiated --> true if we are opening the alert notification in response to a user action
|
||
|
@@ -463,28 +462,25 @@ nsresult nsMessengerUnixIntegration::Sho
|
||
|
nsCOMPtr<nsISupportsPRBool> scriptableUserInitiated (do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv));
|
||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||
|
scriptableUserInitiated->SetData(aUserInitiated);
|
||
|
argsArray->AppendElement(scriptableUserInitiated, false);
|
||
|
|
||
|
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||
|
nsCOMPtr<nsIDOMWindow> newWindow;
|
||
|
|
||
|
+ mAlertInProgress = true;
|
||
|
rv = wwatch->OpenWindow(0, ALERT_CHROME_URL, "_blank",
|
||
|
"chrome,dialog=yes,titlebar=no,popup=yes", argsArray,
|
||
|
getter_AddRefs(newWindow));
|
||
|
|
||
|
- mAlertInProgress = true;
|
||
|
+ if (NS_FAILED(rv))
|
||
|
+ AlertFinished();
|
||
|
}
|
||
|
|
||
|
- // if the user has turned off the mail alert, or openWindow generated an error,
|
||
|
- // then go straight to the system tray.
|
||
|
- if (!showAlert || NS_FAILED(rv))
|
||
|
- AlertFinished();
|
||
|
-
|
||
|
return rv;
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
nsresult nsMessengerUnixIntegration::AlertFinished()
|
||
|
{
|
||
|
mAlertInProgress = false;
|
||
|
return NS_OK;
|