bug 436540 - BookmarksMenu items from distribution.ini do not get added to Bookmarks Menu, p=me, r=gavin+thunder

This commit is contained in:
Rob Campbell 2008-07-18 11:00:41 -03:00
Родитель ae0059ceff
Коммит 48da4723b5
2 изменённых файлов: 42 добавлений и 22 удалений

Просмотреть файл

@ -226,7 +226,7 @@ DistributionCustomizer.prototype = {
if (!bmProcessed) {
if (sections["BookmarksMenu"])
this._parseBookmarksSection(this._bmSvc.bookmarksRoot,
this._parseBookmarksSection(this._bmSvc.bookmarksMenuFolder,
"BookmarksMenu");
if (sections["BookmarksToolbar"])
this._parseBookmarksSection(this._bmSvc.toolbarFolder,

Просмотреть файл

@ -70,6 +70,7 @@ BOOL gSomeMenuBarPainted = NO;
// these items are always strong ref'd by their owning menu bar (instance variable).
static nsIContent* sAboutItemContent = nsnull;
static nsIContent* sPrefItemContent = nsnull;
static nsIContent* sUpdateItemContent = nsnull;
static nsIContent* sQuitItemContent = nsnull;
// Special command IDs that we know Mac OS X does not use for anything else. We use
@ -79,7 +80,8 @@ enum {
eCommand_ID_About = 1,
eCommand_ID_Prefs = 2,
eCommand_ID_Quit = 3,
eCommand_ID_Last = 4
eCommand_ID_Update = 4,
eCommand_ID_Last = 5
};
@ -125,6 +127,8 @@ nsMenuBarX::~nsMenuBarX()
sQuitItemContent = nsnull;
if (sPrefItemContent == mPrefItemContent)
sPrefItemContent = nsnull;
if (sUpdateItemContent == mUpdateItemContent)
sUpdateItemContent = nsnull;
// make sure we unregister ourselves as a document observer
if (mDocument)
@ -413,19 +417,20 @@ nsresult nsMenuBarX::CreateApplicationMenu(nsMenuX* inMenu)
Menu Item DOM Node ID Notes
==================
=======================
= About This App = <- aboutName
==================
=======================
= Preferences... = <- menu_preferences
==================
= Check for updates...=
=======================
= Services > = <- menu_mac_services <- (do not define key equivalent)
==================
=======================
= Hide App = <- menu_mac_hide_app
= Hide Others = <- menu_mac_hide_others
= Show All = <- menu_mac_show_all
==================
=======================
= Quit = <- menu_FileQuitItem
==================
=======================
If any of them are ommitted from the application's DOM, we just don't add
them. We always add a "Quit" item, but if an app developer does not provide a
@ -465,8 +470,17 @@ nsresult nsMenuBarX::CreateApplicationMenu(nsMenuX* inMenu)
[sApplicationMenu addItem:itemBeingAdded];
[itemBeingAdded release];
itemBeingAdded = nil;
}
// Add separator after Preferences menu
// Add the Check for updates menu item
itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("checkForUpdates"), @selector(menuItemHit:),
eCommand_ID_Update, nsMenuBarX::sNativeEventTarget);
if (itemBeingAdded) {
[sApplicationMenu addItem:itemBeingAdded];
[itemBeingAdded release];
itemBeingAdded = nil;
// Add separator after Check for updates menu item
[sApplicationMenu addItem:[NSMenuItem separatorItem]];
}
@ -812,6 +826,12 @@ static BOOL gActOnSpecialCommands = YES;
mostSpecificContent = menuBar->mPrefItemContent;
nsMenuUtilsX::DispatchCommandTo(mostSpecificContent);
}
else if (tag == eCommand_ID_Update) {
nsIContent* mostSpecificContent = sPrefUpdateContent;
if (menuBar && menuBar->mUpdateItemContent)
mostSpecificContent = menuBar->mUpdateItemContent;
MenuHelpersX::DispatchCommandTo(mostSpecificContent);
}
else if (tag == eCommand_ID_Quit) {
nsIContent* mostSpecificContent = sQuitItemContent;
if (menuBar && menuBar->mQuitItemContent)