зеркало из https://github.com/mozilla/gecko-dev.git
Bug 489196 - [10.6] Help menu does not include Apple search in non-English builds. r=josh
This commit is contained in:
Родитель
cc109826f3
Коммит
b8e73f0c2d
|
@ -113,6 +113,11 @@ private:
|
|||
// versions of OS X from (at least) 10.2.8 through 10.5.
|
||||
- (void)_modalSession:(NSModalSession)aSession sendEvent:(NSEvent *)theEvent;
|
||||
|
||||
// Present (and documented) on OS X 10.6 and above. Not present before 10.6.
|
||||
// This declaration needed to avoid compiler warnings when compiling on 10.5
|
||||
// and below (or using the 10.5 SDK and below).
|
||||
- (void)setHelpMenu:(NSMenu *)helpMenu;
|
||||
|
||||
@end
|
||||
|
||||
class nsCocoaUtils
|
||||
|
|
|
@ -98,6 +98,8 @@ public:
|
|||
void SetRebuild(PRBool aMenuEvent);
|
||||
NSMenuItem* NativeMenuItem();
|
||||
|
||||
static PRBool IsXULHelpMenu(nsIContent* aMenuContent);
|
||||
|
||||
protected:
|
||||
void MenuConstruct();
|
||||
nsresult RemoveAll();
|
||||
|
|
|
@ -472,6 +472,13 @@ GeckoNSMenu* nsMenuX::CreateMenuWithGeckoString(nsString& menuTitle)
|
|||
// overrides our decisions and things get incorrectly enabled/disabled.
|
||||
[myMenu setAutoenablesItems:NO];
|
||||
|
||||
// On SnowLeopard and later we must tell the OS which is our Help menu.
|
||||
// Otherwise it will only add Spotlight for Help (the Search item) to our
|
||||
// Help menu if its label/title is "Help" -- i.e. if the menu is in English.
|
||||
// This resolves bug 489196.
|
||||
if (nsToolkit::OnSnowLeopardOrLater() && nsMenuX::IsXULHelpMenu(mContent))
|
||||
[NSApp setHelpMenu:myMenu];
|
||||
|
||||
// we used to install Carbon event handlers here, but since NSMenu* doesn't
|
||||
// create its underlying MenuRef until just before display, we delay until
|
||||
// that happens. Now we install the event handlers when Cocoa notifies
|
||||
|
@ -685,6 +692,18 @@ NSMenuItem* nsMenuX::NativeMenuItem()
|
|||
return mNativeMenuItem;
|
||||
}
|
||||
|
||||
PRBool nsMenuX::IsXULHelpMenu(nsIContent* aMenuContent)
|
||||
{
|
||||
PRBool retval = PR_FALSE;
|
||||
if (aMenuContent) {
|
||||
nsAutoString id;
|
||||
aMenuContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::id, id);
|
||||
if (id.Equals(NS_LITERAL_STRING("helpMenu")))
|
||||
retval = PR_TRUE;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
//
|
||||
// nsChangeObserver
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче