From 88b23a4843738882722ed040ace502fb13c15adb Mon Sep 17 00:00:00 2001 From: "bugzilla%arlen.demon.co.uk" Date: Tue, 7 Jun 2005 23:26:57 +0000 Subject: [PATCH] Bug 295542 Add New -> Saved Search in mail window file menu p=me r=mnyromyr sr=bienvenu a=asa --- mail/base/jar.mn | 2 -- .../chrome/messenger/renameFolderDialog.dtd | 5 +---- mail/locales/jar.mn | 1 - .../base/resources/content/commandglue.js | 15 --------------- .../resources/content/mailWindowOverlay.js | 11 +++-------- .../resources/content/mailWindowOverlay.xul | 3 +++ .../resources/content/msgMail3PaneWindow.js | 5 +---- mailnews/base/resources/content/searchBar.js | 19 +++++++++++-------- .../resources/content/virtualFolderName.js | 0 .../resources/content/virtualFolderName.xul | 0 .../base/resources/locale/en-US/messenger.dtd | 3 ++- .../locale/en-US/messenger.properties | 2 ++ .../locale/en-US/renameFolderDialog.dtd | 6 ------ .../locale/en-US/virtualFolderName.dtd | 0 .../locale/en-US/virtualFolderProperties.dtd | 2 +- mailnews/jar.mn | 3 --- 16 files changed, 24 insertions(+), 53 deletions(-) delete mode 100755 mailnews/base/resources/content/virtualFolderName.js delete mode 100755 mailnews/base/resources/content/virtualFolderName.xul delete mode 100644 mailnews/base/resources/locale/en-US/virtualFolderName.dtd diff --git a/mail/base/jar.mn b/mail/base/jar.mn index 7c4fb278634..acba5d74d35 100644 --- a/mail/base/jar.mn +++ b/mail/base/jar.mn @@ -63,8 +63,6 @@ messenger.jar: content/messenger/msgFolderPickerOverlay.xul (/mailnews/base/resources/content/msgFolderPickerOverlay.xul) content/messenger/renameFolderDialog.xul (/mailnews/base/resources/content/renameFolderDialog.xul) content/messenger/renameFolderDialog.js (/mailnews/base/resources/content/renameFolderDialog.js) - content/messenger/virtualFolderName.xul (/mailnews/base/resources/content/virtualFolderName.xul) - content/messenger/virtualFolderName.js (/mailnews/base/resources/content/virtualFolderName.js) content/messenger/virtualFolderProperties.xul (/mailnews/base/resources/content/virtualFolderProperties.xul) content/messenger/virtualFolderProperties.js (/mailnews/base/resources/content/virtualFolderProperties.js) content/messenger/virtualFolderListDialog.xul (/mailnews/base/resources/content/virtualFolderListDialog.xul) diff --git a/mail/locales/en-US/chrome/messenger/renameFolderDialog.dtd b/mail/locales/en-US/chrome/messenger/renameFolderDialog.dtd index b04c754ecae..98590f1b8f9 100644 --- a/mail/locales/en-US/chrome/messenger/renameFolderDialog.dtd +++ b/mail/locales/en-US/chrome/messenger/renameFolderDialog.dtd @@ -38,7 +38,4 @@ - - - - + diff --git a/mail/locales/jar.mn b/mail/locales/jar.mn index 3f8b574cc6a..e3f0864a9f8 100644 --- a/mail/locales/jar.mn +++ b/mail/locales/jar.mn @@ -39,7 +39,6 @@ locale/@AB_CD@/messenger/folderpane.dtd (%chrome/messenger/folderpane.dtd) locale/@AB_CD@/messenger/newFolderDialog.dtd (%chrome/messenger/newFolderDialog.dtd) locale/@AB_CD@/messenger/renameFolderDialog.dtd (%chrome/messenger/renameFolderDialog.dtd) - locale/@AB_CD@/messenger/virtualFolderName.dtd (%chrome/messenger/virtualFolderName.dtd) locale/@AB_CD@/messenger/folderProps.dtd (%chrome/messenger/folderProps.dtd) locale/@AB_CD@/messenger/subscribe.dtd (%chrome/messenger/subscribe.dtd) locale/@AB_CD@/messenger/subscribe.properties (%chrome/messenger/subscribe.properties) diff --git a/mailnews/base/resources/content/commandglue.js b/mailnews/base/resources/content/commandglue.js index 2186959770b..826821ba5da 100644 --- a/mailnews/base/resources/content/commandglue.js +++ b/mailnews/base/resources/content/commandglue.js @@ -1035,21 +1035,6 @@ function RemoveMailOfflineObserver() observerService.removeObserver(mailOfflineObserver,"network:offline-status-changed"); } -function getViewName(okCallbackFunc, defaultViewName) -{ - var preselectedURI = GetSelectedFolderURI(); - var folderTree = GetFolderTree(); - - var name = GetFolderNameFromUri(preselectedURI, folderTree); - name += defaultViewName + "-view"; - var dialog = window.openDialog( - "chrome://messenger/content/virtualFolderName.xul", - "newFolder", - "chrome,titlebar,modal", - {siblingFolderURI: preselectedURI, searchFolderURIs: preselectedURI, - okCallback: okCallbackFunc, name: name}); -} - function getSearchTermString(searchTerms) { var searchIndex; diff --git a/mailnews/base/resources/content/mailWindowOverlay.js b/mailnews/base/resources/content/mailWindowOverlay.js index 7f45cebe5e5..ebccaa1bf33 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mailnews/base/resources/content/mailWindowOverlay.js @@ -110,16 +110,11 @@ function menu_new_init() .getService(Components.interfaces.nsIIOService); var showNew = ((serverType != 'nntp') && canCreateNew) || isInbox; ShowMenuItem("menu_newFolder", showNew); + ShowMenuItem("menu_newVirtualFolder", showNew); EnableMenuItem("menu_newFolder", !isIMAPFolder || !ioService.offline); + EnableMenuItem("menu_newVirtualFolder", true); if (showNew) - { - if (isServer || isInbox) - SetMenuItemLabel("menu_NewFolder", - gMessengerBundle.getString("newFolder")); - else - SetMenuItemLabel("menu_NewFolder", - gMessengerBundle.getString("newSubfolder")); - } + SetMenuItemLabel("menu_newFolder", gMessengerBundle.getString((isServer || isInbox) ? "newFolderMenuItem" : "newSubfolderMenuItem")); } function goUpdateMailMenuItems(commandset) diff --git a/mailnews/base/resources/content/mailWindowOverlay.xul b/mailnews/base/resources/content/mailWindowOverlay.xul index 55c110e990c..9c30e31f060 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.xul +++ b/mailnews/base/resources/content/mailWindowOverlay.xul @@ -1041,6 +1041,9 @@ + diff --git a/mailnews/base/resources/content/msgMail3PaneWindow.js b/mailnews/base/resources/content/msgMail3PaneWindow.js index 89b9b6c22fc..6658f98b283 100644 --- a/mailnews/base/resources/content/msgMail3PaneWindow.js +++ b/mailnews/base/resources/content/msgMail3PaneWindow.js @@ -259,16 +259,13 @@ var folderListener = { else if (gVirtualFolderTerms) { gDefaultSearchViewTerms = null; - ViewChangeByValue(-1); // override current view viewDebug("searching gVirtualFolderTerms\n"); - Search(""); - // gVirtualFolderTerms = null; + loadVirtualFolder(); } else if (gMsgFolderSelected.flags & MSG_FOLDER_FLAG_VIRTUAL) { viewDebug("selected folder is virtual\n"); gDefaultSearchViewTerms = null; - ViewChangeByValue(-1); // override current view } else { diff --git a/mailnews/base/resources/content/searchBar.js b/mailnews/base/resources/content/searchBar.js index 9e9bb55b1c9..5c5615bfdd8 100644 --- a/mailnews/base/resources/content/searchBar.js +++ b/mailnews/base/resources/content/searchBar.js @@ -540,15 +540,18 @@ function Search(str) function saveViewAsVirtualFolder() { -// prompt for view name - create virtual folder in ok callback. - getViewName(CreateView, gSearchInput.value); + openNewVirtualFolderDialogWithArgs(gSearchInput.value, gSearchSession.searchTerms); } -function CreateView(newName, origFolderURI) +// When the front end has finished loading a virtual folder, it calls openVirtualFolder +// to actually perform the folder search. We use this method instead of calling Search("") directly +// from FolderLoaded in order to avoid moving focus into the search bar. +function loadVirtualFolder() { - var selectedFolder = GetResourceFromUri(origFolderURI); - var folderToSearch = selectedFolder.QueryInterface(Components.interfaces.nsIMsgFolder); - CreateVirtualFolder(newName, folderToSearch.parent, origFolderURI, gSearchSession.searchTerms); + // bit of a hack...if the underlying real folder is loaded with the same view value + // as the value for the virtual folder being searched, then ViewChangeByValue + // fails to change the view because it thinks the view is already correctly loaded. + // so set gCurrentViewValue back to All. + gCurrentViewValue = 0; + onEnterInSearchBar(); } - - diff --git a/mailnews/base/resources/content/virtualFolderName.js b/mailnews/base/resources/content/virtualFolderName.js deleted file mode 100755 index e69de29bb2d..00000000000 diff --git a/mailnews/base/resources/content/virtualFolderName.xul b/mailnews/base/resources/content/virtualFolderName.xul deleted file mode 100755 index e69de29bb2d..00000000000 diff --git a/mailnews/base/resources/locale/en-US/messenger.dtd b/mailnews/base/resources/locale/en-US/messenger.dtd index 9af8ae61c0a..b2445ec92d6 100644 --- a/mailnews/base/resources/locale/en-US/messenger.dtd +++ b/mailnews/base/resources/locale/en-US/messenger.dtd @@ -46,6 +46,8 @@ + + @@ -566,7 +568,6 @@ - diff --git a/mailnews/base/resources/locale/en-US/messenger.properties b/mailnews/base/resources/locale/en-US/messenger.properties index 4c1490daf06..b9ff8072ef8 100644 --- a/mailnews/base/resources/locale/en-US/messenger.properties +++ b/mailnews/base/resources/locale/en-US/messenger.properties @@ -46,6 +46,8 @@ compactFolder=Compact This Folder removeAccount=Delete Account... removeNewsAccount=Delete News Account... removeFolder=Delete Folder +newFolderMenuItem=Folder... +newSubfolderMenuItem=Subfolder... newFolder=New Folder... newSubfolder=New Subfolder... folderProperties=Folder Properties diff --git a/mailnews/base/resources/locale/en-US/renameFolderDialog.dtd b/mailnews/base/resources/locale/en-US/renameFolderDialog.dtd index 8f002205b81..e69de29bb2d 100644 --- a/mailnews/base/resources/locale/en-US/renameFolderDialog.dtd +++ b/mailnews/base/resources/locale/en-US/renameFolderDialog.dtd @@ -1,6 +0,0 @@ - - - - - - diff --git a/mailnews/base/resources/locale/en-US/virtualFolderName.dtd b/mailnews/base/resources/locale/en-US/virtualFolderName.dtd deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mailnews/base/resources/locale/en-US/virtualFolderProperties.dtd b/mailnews/base/resources/locale/en-US/virtualFolderProperties.dtd index 5f8cbdbb02b..300bc4512e4 100644 --- a/mailnews/base/resources/locale/en-US/virtualFolderProperties.dtd +++ b/mailnews/base/resources/locale/en-US/virtualFolderProperties.dtd @@ -7,7 +7,7 @@ - + diff --git a/mailnews/jar.mn b/mailnews/jar.mn index 4c1c6288b20..6b9f45dd86c 100644 --- a/mailnews/jar.mn +++ b/mailnews/jar.mn @@ -125,13 +125,11 @@ messenger.jar: content/messenger/msgFolderPickerOverlay.xul (base/resources/content/msgFolderPickerOverlay.xul) content/messenger/renameFolderDialog.xul (base/resources/content/renameFolderDialog.xul) content/messenger/renameFolderDialog.js (base/resources/content/renameFolderDialog.js) - content/messenger/virtualFolderName.xul (base/resources/content/virtualFolderName.xul) content/messenger/virtualFolderProperties.xul (base/resources/content/virtualFolderProperties.xul) content/messenger/virtualFolderProperties.js (base/resources/content/virtualFolderProperties.js) content/messenger/virtualFolderListDialog.xul (base/resources/content/virtualFolderListDialog.xul) content/messenger/virtualFolderListDialog.js (base/resources/content/virtualFolderListDialog.js) content/messenger/messengerdnd.js (base/resources/content/messengerdnd.js) - content/messenger/virtualFolderName.js (base/resources/content/virtualFolderName.js) content/messenger/mailContextMenus.js (base/resources/content/mailContextMenus.js) content/messenger/msgPrintEngine.js (base/resources/content/msgPrintEngine.js) content/messenger/msgPrintEngine.xul (base/resources/content/msgPrintEngine.xul) @@ -208,7 +206,6 @@ en-US.jar: locale/en-US/messenger/folderpane.dtd (base/resources/locale/en-US/folderpane.dtd) locale/en-US/messenger/newFolderDialog.dtd (base/resources/locale/en-US/newFolderDialog.dtd) locale/en-US/messenger/renameFolderDialog.dtd (base/resources/locale/en-US/renameFolderDialog.dtd) - locale/en-US/messenger/virtualFolderName.dtd (base/resources/locale/en-US/virtualFolderName.dtd) locale/en-US/messenger/virtualFolderProperties.dtd (base/resources/locale/en-US/virtualFolderProperties.dtd) locale/en-US/messenger/virtualFolderListDialog.dtd (base/resources/locale/en-US/virtualFolderListDialog.dtd) locale/en-US/messenger/folderProps.dtd (base/resources/locale/en-US/folderProps.dtd)