Bug 814956 - AppMenu of standalone message window does not work. r=mkmelin,a=Standard8
authorRichard Marti <richard.marti@gmail.com>
Mon, 08 Apr 2013 22:53:28 +0200
changeset 13673 9926a6beae3962bbbc668e4ebf97707220bd3a37
parent 13672 39d8c27a94da8ebc82fd6069719749876cb15e58
child 13674 cec6ac1b39f6e7e7f0d8b3c6c215c2f509ce073e
push id56
push userbugzilla@standard8.plus.com
push dateWed, 19 Jun 2013 09:43:24 +0000
reviewersmkmelin, Standard8
bugs814956
Bug 814956 - AppMenu of standalone message window does not work. r=mkmelin,a=Standard8
mail/base/content/mailWindowOverlay.js
mail/base/content/mailWindowOverlay.xul
mail/base/content/messageWindow.js
mail/base/content/messageWindow.xul
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -105,43 +105,39 @@ function file_init()
 
 function InitEditMessagesMenu()
 {
   goSetMenuValue('cmd_delete', 'valueDefault');
   goSetAccessKey('cmd_delete', 'valueDefaultAccessKey');
   document.commandDispatcher.updateCommands('create-menu-edit');
 
   // initialize the favorite Folder checkbox in the edit menu
-  var favoriteFolderMenu = document.getElementById('menu_favoriteFolder');
-  if (!favoriteFolderMenu.disabled)
-  {
-    var folders = gFolderTreeView.getSelectedFolders();
-    if (folders.length == 1 && !folders[0].isServer)
-    {
+  let favoriteFolderMenu = document.getElementById('menu_favoriteFolder');
+  if (!favoriteFolderMenu.hasAttribute("disabled")) {
+    let folders = gFolderTreeView.getSelectedFolders();
+    if (folders.length == 1 && !folders[0].isServer) {
       const kFavoriteFlag = Components.interfaces.nsMsgFolderFlags.Favorite;
       // Adjust the checked state on the menu item.
       favoriteFolderMenu.setAttribute("checked", folders[0].getFlag(kFavoriteFlag));
       favoriteFolderMenu.hidden = false;
-    }
-    else
-    {
+    } else {
       favoriteFolderMenu.hidden = true;
     }
   }
 }
 
-function InitAppEditMessagesMenu()
+function InitAppFolderViewsMenu()
 {
   goSetMenuValue('cmd_delete', 'valueDefault');
   goSetAccessKey('cmd_delete', 'valueDefaultAccessKey');
   document.commandDispatcher.updateCommands('create-menu-edit');
 
   // initialize the favorite Folder checkbox in the appmenu menu
   let favoriteAppFolderMenu = document.getElementById('appmenu_favoriteFolder');
-  if (!favoriteAppFolderMenu.disabled) {
+  if (!favoriteAppFolderMenu.hasAttribute("disabled")) {
     let folders = gFolderTreeView.getSelectedFolders();
     if (folders.length == 1 && !folders[0].isServer) {
       const kFavoriteFlag = Components.interfaces.nsMsgFolderFlags.Favorite;
       // Adjust the checked state on the menu item.
       favoriteAppFolderMenu.setAttribute("checked", folders[0].getFlag(kFavoriteFlag));
       favoriteAppFolderMenu.hidden = false;
     } else {
       favoriteAppFolderMenu.hidden = true;
@@ -251,21 +247,19 @@ function InitViewLayoutStyleMenu(event)
     layoutStyleMenuitem.setAttribute("checked", "true");
 }
 
 /**
  * Initialize (check) appropriate folder mode under the View | Folder menu.
  */
 function InitViewFolderViewsMenu(event)
 {
-  for (let i = 0; i < event.target.childNodes.length; i++) {
-    if (event.target.childNodes[i].value == gFolderTreeView.mode) {
-      event.target.childNodes[i].setAttribute("checked", true);
-      break;
-    }
+  let selected = event.target.querySelector("[value=" + gFolderTreeView.mode + "]");
+  if (selected) {
+    selected.setAttribute("checked", "true");
   }
 }
 
 function setSortByMenuItemCheckState(id, value)
 {
   var menuitem = document.getElementById(id);
   if (menuitem)
     menuitem.setAttribute("checked", value);
@@ -3599,17 +3593,17 @@ let FeedMessageHandler = {
 
 function initAppMenuPopup(aMenuPopup, aEvent)
 {
   file_init();
   view_init();
   InitGoMessagesMenu();
   menu_new_init();
   CommandUpdate_UndoRedo();
-  InitAppEditMessagesMenu();
+  InitAppFolderViewsMenu();
   document.commandDispatcher.updateCommands('create-menu-tasks');
 
   // If the onpopupshowing event's target is on one of the splitmenu
   // menuitem popups, stash that popup in aMenuPopup (the menupopup one
   // level up) so that splitmenu knows which popup to close when it opens
   // up it's popupmenu.
   if (aEvent.target.parentNode.parentNode.parentNode.parentNode == aMenuPopup)
     aMenuPopup._currentPopup = aEvent.target;
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -1098,17 +1098,18 @@
             <menuitem id="appmenu_saveAsTemplate"
                       label="&saveAsTemplateCmd.label;"
                       command="cmd_saveAsTemplate"/>
           </menupopup>
         </menu>
         <menu id="appmenu_FolderViews"
               label="&folderView.label;">
           <menupopup id="appmenu_FolderViewsPopup"
-                     onpopupshowing="InitViewFolderViewsMenu(event)">
+                     onpopupshowing="InitAppFolderViewsMenu();
+                                     InitViewFolderViewsMenu(event);">
             <menuitem id="appmenu_allFolders"
                       value="all"
                       label="&allFolders.label;"
                       type="radio"
                       name="viewmessages"
                       oncommand="gFolderTreeView.mode = this.value;"/>
             <menuitem id="appmenu_smartFolders"
                       value="smart"
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -565,16 +565,20 @@ function HideMenus()
   var viewLayoutMenu = document.getElementById("menu_MessagePaneLayout");
   if (viewLayoutMenu)
     viewLayoutMenu.setAttribute("hidden", "true");
 
   viewLayoutMenu = document.getElementById("appmenu_MessagePaneLayout");
   if (viewLayoutMenu)
     viewLayoutMenu.setAttribute("hidden", "true");
 
+  let paneViewSeparator = document.getElementById("appmenu_paneViewSeparator");
+  if (paneViewSeparator)
+    paneViewSeparator.setAttribute("hidden", "true");
+
   var viewFolderMenu = document.getElementById("menu_FolderViews");
   if (viewFolderMenu)
     viewFolderMenu.setAttribute("hidden", "true");
 
   viewFolderMenu = document.getElementById("appmenu_FolderViews");
   if (viewFolderMenu)
     viewFolderMenu.setAttribute("hidden", "true");
 
@@ -609,17 +613,17 @@ function HideMenus()
   openMessageMenu = document.getElementById('appmenu_openMessageWindowMenuitem');
   if (openMessageMenu)
     openMessageMenu.setAttribute("hidden", "true");
 
   var viewSortMenuSeparator = document.getElementById('viewSortMenuSeparator');
   if (viewSortMenuSeparator)
     viewSortMenuSeparator.setAttribute("hidden", "true");
 
-  viewSortMenuSeparator = document.getElementById('appmenu_viewSortMenuSeparator');
+  viewSortMenuSeparator = document.getElementById('appmenu_viewAfterThreadsSeparator');
   if (viewSortMenuSeparator)
     viewSortMenuSeparator.setAttribute("hidden", "true");
 
   var viewSortMenu = document.getElementById('viewSortMenu');
   if (viewSortMenu)
     viewSortMenu.setAttribute("hidden", "true");
 
   viewSortMenu = document.getElementById('appmenu_viewSortMenu');
@@ -648,54 +652,74 @@ function HideMenus()
 
   menuProperties = document.getElementById('appmenu_properties');
   if (menuProperties)
     menuProperties.setAttribute("hidden", "true");
 
   var favoriteFolder = document.getElementById('menu_favoriteFolder');
   if (favoriteFolder)
   {
-    favoriteFolder.disabled = true;
+    favoriteFolder.setAttribute("disabled", "true");
     favoriteFolder.setAttribute("hidden", "true");
   }
 
   favoriteFolder = document.getElementById('appmenu_favoriteFolder');
   if (favoriteFolder) {
-    favoriteFolder.disabled = true;
+    favoriteFolder.setAttribute("disabled", "true");
     favoriteFolder.setAttribute("hidden", "true");
   }
 
   var compactFolderMenu = document.getElementById('menu_compactFolder');
   if (compactFolderMenu)
     compactFolderMenu.setAttribute("hidden", "true");
 
   compactFolderMenu = document.getElementById('appmenu_compactFolder');
   if (compactFolderMenu)
     compactFolderMenu.setAttribute("hidden", "true");
 
   var trashSeparator = document.getElementById('trashMenuSeparator');
   if (trashSeparator)
     trashSeparator.setAttribute("hidden", "true");
 
+  let fileMenuAfterRenameSeparator = document.getElementById('appmenu_fileMenuAfterRenameSeparator');
+  if (fileMenuAfterRenameSeparator)
+    fileMenuAfterRenameSeparator.setAttribute("hidden", "true");
+
+  let fileMenuAfterCompactSeparator = document.getElementById('appmenu_fileMenuAfterCompactSeparator');
+  if (fileMenuAfterCompactSeparator)
+    fileMenuAfterCompactSeparator.setAttribute("hidden", "true");
+
   var goStartPageSeparator = document.getElementById('goNextSeparator');
   if (goStartPageSeparator)
     goStartPageSeparator.hidden = true;
 
   goStartPageSeparator = document.getElementById('appmenu_goNextSeparator');
   if (goStartPageSeparator)
     goStartPageSeparator.hidden = true;
 
+  let goRecentlyClosedTabsSeparator = document.getElementById('goRecentlyClosedTabsSeparator');
+  if (goRecentlyClosedTabsSeparator)
+    goRecentlyClosedTabsSeparator.setAttribute("hidden", "true");
+
+  goRecentlyClosedTabsSeparator = document.getElementById('appmenu_goRecentlyClosedTabsSeparator');
+  if (goRecentlyClosedTabsSeparator)
+    goRecentlyClosedTabsSeparator.setAttribute("hidden", "true");
+
   var goStartPage = document.getElementById('goStartPage');
   if (goStartPage)
    goStartPage.hidden = true;
 
   goStartPage = document.getElementById('appmenu_goStartPage');
   if (goStartPage)
    goStartPage.hidden = true;
 
+  let quickFilterBar = document.getElementById('appmenu_quickFilterBar');
+  if (quickFilterBar)
+   quickFilterBar.hidden = true;
+
   var menuFileClose = document.getElementById('menu_close');
   var menuFileQuit = document.getElementById('menu_FileQuitItem');
   if (menuFileClose && menuFileQuit)
     menuFileQuit.parentNode.replaceChild(menuFileClose, menuFileQuit);
 }
 
 function OnUnloadMessageWindow()
 {
--- a/mail/base/content/messageWindow.xul
+++ b/mail/base/content/messageWindow.xul
@@ -84,17 +84,17 @@
     <command id="cmd_close" oncommand="window.close();"/>
   </commandset>
 
   <keyset id="mailKeys">
     <keyset id="tasksKeys"/>
     <key keycode="VK_ESCAPE" oncommand="window.close();"/>
   </keyset>
 
-  <popupset>
+  <popupset id="mainPopupSet">
     <panel id="editContactPanel"/>
     <menupopup id="emailAddressPopup" class="emailAddressPopup" position="after_start"
                onpopupshowing="setupEmailAddressPopup(findEmailNodeFromPopupNode(document.popupNode, 'emailAddressPopup')); goUpdateCommand('cmd_createFilterFromPopup')"
                onpopuphiding="hideEmailNewsPopup(findEmailNodeFromPopupNode(document.popupNode, 'emailAddressPopup'))">
       <menuitem id="emailAddressPlaceHolder" label=""
                 disabled="true"/>
       <menuseparator/>
       <menuitem id="addToAddressBookItem"