Bug 943096 - Search subfolders checkbox is always disabled in Search Messages dialog r=neil a=me for CLOSED TREE
authorIan Neal <iann_cvs@blueyonder.co.uk>
Mon, 20 Jan 2014 23:18:03 +0000
changeset 15618 0cc1fba46d56fb787d75eaa5889bc561062a47e0
parent 15617 50104122059c467493a2b12acc81658d44b77536
child 15619 287a93b9779abf858254df65d1163dc7c5d2a51d
push id9793
push useriann_cvs@blueyonder.co.uk
push dateMon, 20 Jan 2014 23:18:12 +0000
treeherdercomm-central@0cc1fba46d56 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, me
bugs943096
Bug 943096 - Search subfolders checkbox is always disabled in Search Messages dialog r=neil a=me for CLOSED TREE
suite/mailnews/search/SearchDialog.js
--- a/suite/mailnews/search/SearchDialog.js
+++ b/suite/mailnews/search/SearchDialog.js
@@ -240,21 +240,17 @@ function searchOnLoad()
   gSearchBundle = document.getElementById("bundle_search");
   gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
   gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
   gMessengerBundle = document.getElementById("bundle_messenger");
   setupDatasource();
   setupSearchListener();
 
   if (window.arguments && window.arguments[0])
-  {
-    var winArgFolder = window.arguments[0].folder;
-    selectFolder(winArgFolder);
-    UpdateSubFolder(winArgFolder);
-  }
+    selectFolder(window.arguments[0].folder);
 
   onMore(null);
   UpdateMailSearch("onload");
   
   // hide and remove these columns from the column picker.  you can't thread search results
   HideSearchColumn("threadCol"); // since you can't thread search results
   HideSearchColumn("totalCol"); // since you can't thread search results
   HideSearchColumn("unreadCol"); // since you can't thread search results
@@ -334,20 +330,23 @@ function selectFolder(folder)
         folderURI = folder.URI;
     }
     updateSearchFolderPicker(folderURI);
 }
 
 function updateSearchFolderPicker(folderURI) 
 { 
     SetFolderPicker(folderURI, gFolderPicker.id);
-    UpdateSubFolder(folderURI);
+
     // use the URI to get the real folder
     gMsgFolderSelected = GetMsgFolderFromUri(folderURI);
 
+    var searchSubFolders = document.getElementById("checkSearchSubFolders");
+    if (searchSubFolders)
+      searchSubFolders.disabled = !gMsgFolderSelected.hasSubFolders;
     var searchLocalSystem = document.getElementById("menuSearchLocalSystem");
     if (searchLocalSystem)
         searchLocalSystem.disabled = gMsgFolderSelected.server.searchScope == nsMsgSearchScope.offlineMail;
     setSearchScope(GetScopeForFolder(gMsgFolderSelected));
 }
 
 function updateSearchLocalSystem()
 {
@@ -755,14 +754,8 @@ function saveAsVirtualFolder()
                                   searchTerms:gSearchSession.searchTerms,
                                   searchFolderURIs: searchFolderURIs});
 }
 
 function OnTagsChange()
 {
   // Dummy, called by RemoveAllMessageTags and ToggleMessageTag
 }
-
-function UpdateSubFolder(aFolderSelect)
-{
-  var folder = GetMsgFolderFromUri(aFolderSelect, true);
-  document.getElementById("checkSearchSubFolders").disabled = (!folder || !folder.hasSubFolders);
-}