From 291e0581f7df27f680fc1d86b4255102aa1b9668 Mon Sep 17 00:00:00 2001 From: "bugzilla%arlen.demon.co.uk" Date: Mon, 22 Aug 2005 00:30:54 +0000 Subject: [PATCH] Bug 303895 Threadpane drop-down list 'View->Customize..." opens Saved Search p=me r=neil.parkwaycc.co.uk sr=bienvenu --- .../resources/content/msgViewPickerOverlay.js | 34 +++++++------------ .../content/msgViewPickerOverlay.xul | 3 +- .../locale/en-US/msgViewPickerOverlay.dtd | 1 + 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js b/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js index 3699b045dbc9..fdfea974678d 100644 --- a/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js +++ b/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js @@ -38,8 +38,9 @@ * ***** END LICENSE BLOCK ***** */ const kLabelOffset = 1; // 1=2-1, from msgViewPickerOveraly.xul, -const kLastDefaultViewIndex = 9; // 9, because 8 + 1, -const kCustomItemValue = "8"; // from msgViewPickerOveraly.xul, +const kLastDefaultViewIndex = 9; // 9, because 8 + 1, +const kSaveItemValue = "7"; // from msgViewPickerOveraly.xul, +const kCustomItemValue = "8"; // from msgViewPickerOveraly.xul, var gMailViewList = null; var gCurrentViewValue = "0"; // initialize to the first view ("All") @@ -54,10 +55,14 @@ var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp; function viewChange(aMenuList, val) { - if (val == kCustomItemValue) { + if (val == kCustomItemValue || val == kSaveItemValue) + { // restore to the previous view value, in case they cancel aMenuList.value = gCurrentViewValue; - LaunchCustomizeDialog(); + if (val == kCustomItemValue) + LaunchCustomizeDialog(); + else + openNewVirtualFolderDialogWithArgs(gCurrentViewLabel, gSaveDefaultSVTerms); return; } @@ -65,7 +70,6 @@ function viewChange(aMenuList, val) if (val == gCurrentViewValue) return; viewDebug("viewChange to " + val + "\n"); - var oldViewValue = gCurrentViewValue; gCurrentViewValue = val; switch (val) { @@ -84,11 +88,6 @@ function viewChange(aMenuList, val) case "6": // label 5 ViewLabel(parseInt(val) - kLabelOffset); break; - case "7": // save view as virtual folder - val = oldViewValue; - aMenuList.value = val; - openNewVirtualFolderDialogWithArgs(gCurrentViewLabel, gSaveDefaultSVTerms); - break; default: LoadCustomMailView(parseInt(val) - kLastDefaultViewIndex); break; @@ -184,19 +183,12 @@ function refreshCustomMailViews(aDefaultSelectedIndex) // remove any existing entries... var menupopupNode = document.getElementById('viewPickerPopup'); - var numItemsInNode = menupopupNode.childNodes.length; - numItemsInNode -= 2; // subtract off the last 2 items since we want to leave those - var removeNodes = true; - - while (removeNodes && numItemsInNode) + for (var i = menupopupNode.childNodes.length - 1; i >= 0; --i) { - if (menupopupNode.childNodes[numItemsInNode-1].getAttribute('id') == 'lastDefaultView') - removeNodes = false; - else - menupopupNode.removeChild(menupopupNode.childNodes[numItemsInNode-1]); - numItemsInNode -= 1; + if (menupopupNode.childNodes[i].id.substr(0, 15) == "userdefinedview") + menupopupNode.removeChild(menupopupNode.childNodes[i]); } - + // now rebuild the list var numItems = gMailViewList.mailViewCount; diff --git a/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.xul b/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.xul index 170b94692568..235bf6ec0207 100644 --- a/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.xul +++ b/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.xul @@ -60,7 +60,8 @@ - + + diff --git a/mailnews/extensions/mailviews/resources/locale/en-US/msgViewPickerOverlay.dtd b/mailnews/extensions/mailviews/resources/locale/en-US/msgViewPickerOverlay.dtd index 55d34f51a936..5259d398789d 100644 --- a/mailnews/extensions/mailviews/resources/locale/en-US/msgViewPickerOverlay.dtd +++ b/mailnews/extensions/mailviews/resources/locale/en-US/msgViewPickerOverlay.dtd @@ -2,6 +2,7 @@ +