Bug 537378 - "search messages" (Ctrl+Shift+F) should be enabled in the 3pane - doesn't open if no folder or account selected/focused in folder pane. r=asuth
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 03 Apr 2012 22:01:33 +0300
changeset 9816 6e3a62f70261305d187ee8fe31b51d6738ae82f2
parent 9815 c3ad1d23cdfe2cc746a5b65ae05a0409e7f8310c
child 9817 bc7c9ecd129298ce2a351728aa7d3071f4233266
push id7484
push usermkmelin@iki.fi
push dateTue, 03 Apr 2012 19:04:05 +0000
treeherdercomm-central@6e3a62f70261 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs537378
Bug 537378 - "search messages" (Ctrl+Shift+F) should be enabled in the 3pane - doesn't open if no folder or account selected/focused in folder pane. r=asuth
mail/base/content/mail3PaneWindowCommands.js
mail/base/content/mailWindowOverlay.xul
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -33,16 +33,23 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+/**
+ * Functionality for the main application window (aka the 3pane) usually
+ * consisting of folder pane, thread pane and message pane.
+ */
+
+Components.utils.import("resource:///modules/mailServices.js");
+
 // Controller object for folder pane
 var FolderPaneController =
 {
   supportsCommand: function(command)
   {
     switch ( command )
     {
       case "cmd_delete":
@@ -469,20 +476,20 @@ var DefaultController =
         // always allow searching in the message
         if (document.getElementById("tabmail").selectedTab.mode.name == "message")
           return true;
 
         // Otherwise, only allow searching if we're showing the message pane
         // and have more than one message selected.
         return (!IsMessagePaneCollapsed() && (GetNumSelectedMessages() == 1));
       case "cmd_search":
-        return IsCanSearchMessagesEnabled();
+        return (MailServices.accounts.accounts.Count() > 0);
       case "cmd_selectAll":
       case "cmd_selectFlagged":
-        return gDBView != null;
+        return !!gDBView;
       // these are enabled on when we are in threaded mode
       case "cmd_selectThread":
         if (GetNumSelectedMessages() <= 0) return false;
       case "cmd_expandAllThreads":
       case "cmd_collapseAllThreads":
         return gFolderDisplay.view.showThreaded;
       case "cmd_nextFlaggedMsg":
       case "cmd_previousFlaggedMsg":
@@ -1060,23 +1067,16 @@ function IsSendUnsentMsgsEnabled(unsentM
   if (!identity)
     identity = Components.classes["@mozilla.org/messenger/account-manager;1"]
                          .getService(Components.interfaces.nsIMsgAccountManager)
                          .defaultAccount.defaultIdentity;
 
   return msgSendlater.hasUnsentMessages(identity);
 }
 
-function IsCanSearchMessagesEnabled()
-{
-  var folder = GetSelectedMsgFolders()[0];
-  if (!folder)
-    return false;
-  return folder.server.canSearchMessages;
-}
 function IsFolderCharsetEnabled()
 {
   return IsFolderSelected();
 }
 
 function IsPropertiesEnabled(command)
 {
   var folders = GetSelectedMsgFolders();
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -216,17 +216,19 @@
   <command id="cmd_selectThread" oncommand="goDoCommand('cmd_selectThread')"/>
   <command id="cmd_selectFlagged" oncommand="goDoCommand('cmd_selectFlagged')"/>
   <command id="cmd_properties" oncommand="goDoCommand('cmd_properties')"
          valueNewsgroup="&folderPropsNewsgroupCmd.label;"
          valueFolder="&folderPropsFolderCmd.label;"
          valueGeneric="&folderPropsCmd.label;"/>
   <command id="cmd_find" oncommand="goDoCommand('cmd_find')" disabled="true"/>
   <command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
-  <command id="cmd_findPrevious"  oncommand="goDoCommand('cmd_findPrevious')"  disabled="true"/>
+  <command id="cmd_findPrevious" oncommand="goDoCommand('cmd_findPrevious')"
+           disabled="true"/>
+  <command id="cmd_search" oncommand="goDoCommand('cmd_search')"/>
   <!-- Stop/abort current network activities. -->
   <command id="cmd_stop" oncommand="goDoCommand('cmd_stop')"/>
   <command id="cmd_reload" oncommand="goDoCommand('cmd_reload')"/>
 </commandset>
 
 <commandset id="mailEditContextMenuItems">
   <command id="cmd_copyLink"/>
   <command id="cmd_copyImage"/>
@@ -340,17 +342,16 @@
            oncommand="goDoCommand('cmd_applyFiltersToSelection');"
            disabled="true"
            valueSelection="&filtersApplyToSelection.label;"
            valueSelectionAccessKey="&filtersApplyToSelection.accesskey;"
            valueMessage="&filtersApplyToMessage.label;"
            valueMessageAccessKey="&filtersApplyToMessage.accesskey;"/>
   <command id="cmd_runJunkControls" oncommand="goDoCommand('cmd_runJunkControls');" disabled="true"/>
   <command id="cmd_deleteJunk" oncommand="goDoCommand('cmd_deleteJunk');" disabled="true"/>
-  <command id="cmd_search" oncommand="goDoCommand('cmd_search')"/>
 </commandset>
 
 #ifdef XP_MACOSX
 <commandset id="macWindowMenuItems">
   <!-- Mac Window menu -->
   <command id="minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();"/>
   <command id="zoomWindow" label="&zoomWindow.label;" oncommand="zoomWindow();"/>
   <command id="Tasks:Mail" oncommand="focusOnMail(1);"/>