diff --git a/mail/base/content/mail3PaneWindowCommands.js b/mail/base/content/mail3PaneWindowCommands.js
index 599d4402a89..319bf038ee2 100644
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -206,7 +206,6 @@ var DefaultController =
case "cmd_file":
case "cmd_emptyTrash":
case "cmd_compactFolder":
- case "cmd_sortByThread":
case "cmd_settingsOffline":
case "cmd_close":
case "cmd_selectAll":
@@ -369,7 +368,6 @@ var DefaultController =
case "cmd_previousFlaggedMsg":
return IsViewNavigationItemEnabled();
case "cmd_viewAllMsgs":
- case "cmd_sortByThread":
case "cmd_viewUnreadMsgs":
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
@@ -515,9 +513,6 @@ var DefaultController =
case "cmd_previousFlaggedMsg":
MsgPreviousFlaggedMessage();
break;
- case "cmd_sortByThread":
- MsgSortByThread();
- break;
case "cmd_viewAllMsgs":
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js
index 5eddd9ecdcb..82a0264ef30 100644
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -236,7 +236,6 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortBySizeMenuitem", (sortType == nsMsgViewSortType.bySize));
setSortByMenuItemCheckState("sortByStatusMenuitem", (sortType == nsMsgViewSortType.byStatus));
setSortByMenuItemCheckState("sortBySubjectMenuitem", (sortType == nsMsgViewSortType.bySubject));
- setSortByMenuItemCheckState("sortByThreadMenuitem", (sortType == nsMsgViewSortType.byThread));
setSortByMenuItemCheckState("sortByUnreadMenuitem", (sortType == nsMsgViewSortType.byUnread));
setSortByMenuItemCheckState("sortByLabelMenuitem", (sortType == nsMsgViewSortType.byLabel));
setSortByMenuItemCheckState("sortByJunkStatusMenuitem", (sortType == nsMsgViewSortType.byJunkStatus));
@@ -249,8 +248,15 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortAscending", (sortOrder == nsMsgViewSortOrder.ascending));
setSortByMenuItemCheckState("sortDescending", (sortOrder == nsMsgViewSortOrder.descending));
- var threadMenuItem = document.getElementById("sortByThreadMenuitem");
- threadMenuItem.setAttribute("disabled", !gDBView.supportsThreading);
+ var threaded = ((gDBView.viewFlags & nsMsgViewFlagsType.kThreadedDisplay) != 0);
+ var sortThreadedMenuItem = document.getElementById("sortThreaded");
+ var sortUnthreadedMenuItem = document.getElementById("sortUnthreaded");
+
+ sortThreadedMenuItem.setAttribute("checked", threaded);
+ sortUnthreadedMenuItem.setAttribute("checked", !threaded);
+
+ sortThreadedMenuItem.setAttribute("disabled", !gDBView.supportsThreading);
+ sortUnthreadedMenuItem.setAttribute("disabled", !gDBView.supportsThreading);
}
function InitViewMessagesMenu()
@@ -281,13 +287,7 @@ function InitViewMessagesMenu()
function InitViewMessageViewMenu()
{
- var viewFlags = (gDBView) ? gDBView.viewFlags : 0;
var viewType = (gDBView) ? gDBView.viewType : 0;
-
- var threadedMenuItem = document.getElementById("viewThreaded");
- if (threadedMenuItem)
- threadedMenuItem.setAttribute("checked", (viewFlags & nsMsgViewFlagsType.kThreadedDisplay) != 0);
-
var currentViewValue = document.getElementById("viewPicker").value;
var allMenuItem = document.getElementById("viewAll");
diff --git a/mail/base/content/mailWindowOverlay.xul b/mail/base/content/mailWindowOverlay.xul
index 1064a89a165..c8ffb152a35 100644
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -115,7 +115,6 @@