From 6cfc2815ae071cfbf4379f7d76bd512ea5245df4 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Wed, 27 Mar 2002 07:38:18 +0000 Subject: [PATCH] Bug #122626 --> biff icon isn't showing up in the system tray for win98. This is because win98 defines support for the unicode friendly shell notify routines even though it doesn't implement them. Fall back to the ascii version in this case. r=bhuvan sr=bienvenu a=dbaron --- .../base/src/nsMessengerWinIntegration.cpp | 28 ++++++++++++++++++- mailnews/base/src/nsMessengerWinIntegration.h | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mailnews/base/src/nsMessengerWinIntegration.cpp b/mailnews/base/src/nsMessengerWinIntegration.cpp index 3c82b5ccdd6..854acb8c488 100644 --- a/mailnews/base/src/nsMessengerWinIntegration.cpp +++ b/mailnews/base/src/nsMessengerWinIntegration.cpp @@ -722,11 +722,37 @@ void nsMessengerWinIntegration::SetToolTipStringOnIconData(const PRUnichar * aTo void nsMessengerWinIntegration::GenericShellNotify(DWORD aMessage) { if (mUseWideCharBiffIcon) - mShellNotifyWideChar( aMessage, &mWideBiffIconData ); + { + BOOL res = mShellNotifyWideChar( aMessage, &mWideBiffIconData ); + if (!res) + RevertToNonUnicodeShellAPI(); // oops we don't really implement the unicode shell apis...fall back. else + return; + } + ::Shell_NotifyIcon( aMessage, &mAsciiBiffIconData ); } +// some flavors of windows define ShellNotifyW but when you actually try to use it, +// they return an error. In this case, we'll have a routine which converts us over to the +// default ASCII version. +void nsMessengerWinIntegration::RevertToNonUnicodeShellAPI() +{ + mUseWideCharBiffIcon = PR_FALSE; + if (mWideBiffIconData.hIcon) // release any windows handles + DestroyIcon(mWideBiffIconData.hIcon); + + // now initialize the ascii shell notify struct + InitializeBiffStatusIcon(); + + // now we need to copy over any left over tool tip strings + if (mWideBiffIconData.szTip) + { + const PRUnichar * oldTooltipString = mWideBiffIconData.szTip; + SetToolTipStringOnIconData(oldTooltipString); + } +} + NS_IMETHODIMP nsMessengerWinIntegration::OnItemPropertyFlagChanged(nsISupports *item, nsIAtom *property, PRUint32 oldFlag, PRUint32 newFlag) { diff --git a/mailnews/base/src/nsMessengerWinIntegration.h b/mailnews/base/src/nsMessengerWinIntegration.h index 6d6900f4b49..f68fb2a7395 100644 --- a/mailnews/base/src/nsMessengerWinIntegration.h +++ b/mailnews/base/src/nsMessengerWinIntegration.h @@ -92,6 +92,8 @@ private: void GenericShellNotify(DWORD aMessage); void SetToolTipStringOnIconData(const PRUnichar * aToolTipString); void DestroyBiffIcon(); + void RevertToNonUnicodeShellAPI(); + PRUint32 GetToolTipSize(); // available space for the tooltip string nsresult ShowAlertMessage(const PRUnichar * aAlertText, const char * aFolderURI); nsresult GetFirstFolderWithNewMail(char ** aFolderURI);