mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug #225413 --> Make the windows animated biff alert dialog use the account name instead of the user name.
r=jst sr=bienvenu
This commit is contained in:
parent
6e374aa4e1
commit
8eb9e56674
@ -263,9 +263,8 @@ recipientSearchCriteria=Subject or Recipient contains:
|
||||
senderSearchCriteria=Subject or Sender contains:
|
||||
|
||||
# LOCALIZATION NOTES(biffNotification): %1$S is a user name %2$S is the number of new messages
|
||||
biffNotification_message=%1$S has %2$S new message
|
||||
biffNotification_messages=%1$S has %2$S new messages
|
||||
newMail_Alert_Title=New Messages
|
||||
biffNotification_message=has %1$S new message
|
||||
biffNotification_messages=has %1$S new messages
|
||||
|
||||
# For the Quota tab in the mail folder properties dialog
|
||||
quotaUsedFree=%S of %S KB used
|
||||
|
@ -497,7 +497,7 @@ nsresult nsMessengerWinIntegration::GetStringBundle(nsIStringBundle **aBundle)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMessengerWinIntegration::ShowAlertMessage(const PRUnichar * aAlertText, const char * aFolderURI)
|
||||
nsresult nsMessengerWinIntegration::ShowAlertMessage(const PRUnichar * aAlertTitle, const PRUnichar * aAlertText, const char * aFolderURI)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -517,21 +517,10 @@ nsresult nsMessengerWinIntegration::ShowAlertMessage(const PRUnichar * aAlertTex
|
||||
nsCOMPtr<nsIAlertsService> alertsService (do_GetService(NS_ALERTSERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIAlertListener> alertListener (do_QueryInterface(NS_STATIC_CAST(nsIMessengerOSIntegration*, this)));
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
GetStringBundle(getter_AddRefs(bundle));
|
||||
if (bundle)
|
||||
{
|
||||
nsXPIDLString alertTitle;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("newMail_Alert_Title").get(), getter_Copies(alertTitle));
|
||||
rv = alertsService->ShowAlertNotification(NEW_MAIL_ALERT_ICON, alertTitle, aAlertText, PR_TRUE,
|
||||
NS_ConvertASCIItoUCS2(aFolderURI).get(), alertListener);
|
||||
|
||||
mAlertInProgress = PR_TRUE;
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIAlertListener> alertListener (do_QueryInterface(NS_STATIC_CAST(nsIMessengerOSIntegration*, this)));
|
||||
rv = alertsService->ShowAlertNotification(NEW_MAIL_ALERT_ICON, aAlertTitle, aAlertText, PR_TRUE,
|
||||
NS_ConvertASCIItoUCS2(aFolderURI).get(), alertListener);
|
||||
mAlertInProgress = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,7 +560,7 @@ NS_IMETHODIMP nsMessengerWinIntegration::OnAlertClickCallback(const PRUnichar *
|
||||
void nsMessengerWinIntegration::FillToolTipInfo()
|
||||
{
|
||||
// iterate over all the folders in mFoldersWithNewMail
|
||||
nsXPIDLCString userName;
|
||||
nsXPIDLString accountName;
|
||||
nsXPIDLCString hostName;
|
||||
nsAutoString toolTipText;
|
||||
nsAutoString animatedAlertText;
|
||||
@ -591,30 +580,27 @@ void nsMessengerWinIntegration::FillToolTipInfo()
|
||||
folder = do_QueryReferent(weakReference);
|
||||
if (folder)
|
||||
{
|
||||
folder->GetUsername(getter_Copies(userName));
|
||||
folder->GetPrettiestName(getter_Copies(accountName));
|
||||
|
||||
numNewMessages = 0;
|
||||
folder->GetNumNewMessages(PR_TRUE, &numNewMessages);
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
GetStringBundle(getter_AddRefs(bundle));
|
||||
if (bundle)
|
||||
{
|
||||
nsAutoString numNewMsgsText;
|
||||
nsAutoString uniUsername;
|
||||
|
||||
uniUsername.AssignWithConversion(userName);
|
||||
nsAutoString numNewMsgsText;
|
||||
numNewMsgsText.AppendInt(numNewMessages);
|
||||
|
||||
const PRUnichar *formatStrings[] =
|
||||
{
|
||||
uniUsername.get(),
|
||||
numNewMsgsText.get(),
|
||||
};
|
||||
|
||||
nsXPIDLString finalText;
|
||||
if (numNewMessages == 1)
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("biffNotification_message").get(), formatStrings, 2, getter_Copies(finalText));
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("biffNotification_message").get(), formatStrings, 1, getter_Copies(finalText));
|
||||
else
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("biffNotification_messages").get(), formatStrings, 2, getter_Copies(finalText));
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("biffNotification_messages").get(), formatStrings, 1, getter_Copies(finalText));
|
||||
|
||||
// the alert message is special...we actually only want to show the first account with
|
||||
// new mail in the alert.
|
||||
@ -622,10 +608,12 @@ void nsMessengerWinIntegration::FillToolTipInfo()
|
||||
animatedAlertText = finalText;
|
||||
|
||||
// only add this new string if it will fit without truncation....
|
||||
if (maxTooltipSize >= toolTipText.Length() + finalText.Length() + 2)
|
||||
if (maxTooltipSize >= toolTipText.Length() + accountName.Length() + finalText.Length() + 2)
|
||||
{
|
||||
if (index > 0)
|
||||
toolTipText.Append(NS_LITERAL_STRING("\n").get());
|
||||
toolTipText.Append(NS_LITERAL_STRING("\n").get());
|
||||
toolTipText.Append(accountName);
|
||||
toolTipText.Append(NS_LITERAL_STRING(" "));
|
||||
toolTipText.Append(finalText);
|
||||
}
|
||||
} // if we got a bundle
|
||||
@ -636,7 +624,7 @@ void nsMessengerWinIntegration::FillToolTipInfo()
|
||||
|
||||
if (!mBiffIconVisible)
|
||||
{
|
||||
ShowAlertMessage(animatedAlertText.get(), "");
|
||||
ShowAlertMessage(accountName, animatedAlertText.get(), "");
|
||||
}
|
||||
else
|
||||
GenericShellNotify( NIM_MODIFY);
|
||||
|
@ -98,7 +98,7 @@ private:
|
||||
void RevertToNonUnicodeShellAPI();
|
||||
|
||||
PRUint32 GetToolTipSize(); // available space for the tooltip string
|
||||
nsresult ShowAlertMessage(const PRUnichar * aAlertText, const char * aFolderURI);
|
||||
nsresult ShowAlertMessage(const PRUnichar * aAlertTitle, const PRUnichar * aAlertText, const char * aFolderURI);
|
||||
nsresult GetFirstFolderWithNewMail(char ** aFolderURI);
|
||||
|
||||
nsresult GetStringBundle(nsIStringBundle **aBundle);
|
||||
|
Loading…
Reference in New Issue
Block a user