From 0bcaff232a3f1148ab8c201a9c11d173ea7cfa53 Mon Sep 17 00:00:00 2001 From: "Stefan.Borggraefe%gmx.de" Date: Fri, 12 Mar 2004 08:09:42 +0000 Subject: [PATCH] Fix for bug 219620: "Rationalize Thread Messages menu items" r=neil, sr=mscott, a=chofmann --- mail/base/content/mail3PaneWindowCommands.js | 5 ----- mail/base/content/mailWindowOverlay.js | 18 +++++++-------- mail/base/content/mailWindowOverlay.xul | 7 +++--- mail/base/locale/messenger.dtd | 8 +++---- .../content/mail3PaneWindowCommands.js | 5 ----- .../resources/content/mailWindowOverlay.js | 18 +++++++-------- .../resources/content/mailWindowOverlay.xul | 7 +++--- mailnews/base/resources/content/threadPane.js | 22 +++++++++++++++---- .../base/resources/locale/en-US/messenger.dtd | 8 +++---- 9 files changed, 50 insertions(+), 48 deletions(-) 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 @@ - @@ -1160,7 +1159,6 @@ - @@ -1168,13 +1166,14 @@ + + + - - diff --git a/mail/base/locale/messenger.dtd b/mail/base/locale/messenger.dtd index 30c7f380727..04e7382c67e 100644 --- a/mail/base/locale/messenger.dtd +++ b/mail/base/locale/messenger.dtd @@ -147,18 +147,18 @@ - - + + + + - - diff --git a/mailnews/base/resources/content/mail3PaneWindowCommands.js b/mailnews/base/resources/content/mail3PaneWindowCommands.js index db3bb22b537..e756de77d1d 100644 --- a/mailnews/base/resources/content/mail3PaneWindowCommands.js +++ b/mailnews/base/resources/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": @@ -514,9 +512,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/mailnews/base/resources/content/mailWindowOverlay.js b/mailnews/base/resources/content/mailWindowOverlay.js index 1f0b2a96e03..06daa7effa9 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mailnews/base/resources/content/mailWindowOverlay.js @@ -210,7 +210,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)); @@ -222,8 +221,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() @@ -254,12 +260,6 @@ function InitViewMessagesMenu() function InitViewMessageViewMenu() { - var viewFlags = gDBView ? gDBView.viewFlags : 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/mailnews/base/resources/content/mailWindowOverlay.xul b/mailnews/base/resources/content/mailWindowOverlay.xul index 2810b8e2bca..c1f4843a78c 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.xul +++ b/mailnews/base/resources/content/mailWindowOverlay.xul @@ -125,7 +125,6 @@ Rights Reserved. - @@ -1185,19 +1184,19 @@ Rights Reserved. - + + + - - diff --git a/mailnews/base/resources/content/threadPane.js b/mailnews/base/resources/content/threadPane.js index 44cc05e9346..a6f702b1763 100644 --- a/mailnews/base/resources/content/threadPane.js +++ b/mailnews/base/resources/content/threadPane.js @@ -282,10 +282,24 @@ function MsgReverseSortThreadPane() function MsgToggleThreaded() { - var dbview = GetDBView(); - dbview.viewFlags ^= nsMsgViewFlagsType.kThreadedDisplay; - dbview.sort(dbview.sortType, dbview.sortOrder); // resort - UpdateSortIndicators(dbview.sortType, dbview.sortOrder); + var dbview = GetDBView(); + dbview.viewFlags ^= nsMsgViewFlagsType.kThreadedDisplay; + dbview.sort(dbview.sortType, dbview.sortOrder); + UpdateSortIndicators(dbview.sortType, dbview.sortOrder); +} + +function MsgSortThreaded() +{ + // Toggle if not already threaded. + if ((GetDBView().viewFlags & nsMsgViewFlagsType.kThreadedDisplay) == 0) + MsgToggleThreaded(); +} + +function MsgSortUnthreaded() +{ + // Toggle if not already unthreaded. + if ((GetDBView().viewFlags & nsMsgViewFlagsType.kThreadedDisplay) != 0) + MsgToggleThreaded(); } function MsgSortAscending() diff --git a/mailnews/base/resources/locale/en-US/messenger.dtd b/mailnews/base/resources/locale/en-US/messenger.dtd index 38a5e442421..3faf80871ec 100644 --- a/mailnews/base/resources/locale/en-US/messenger.dtd +++ b/mailnews/base/resources/locale/en-US/messenger.dtd @@ -170,18 +170,18 @@ Rights Reserved. - - + + + + - -