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
--- 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);"/>