Bug 59049 - Disable 'Search subfolders' if no subfolders exist. r=Mnyromyr sr=Mnyromyr
authorEdmund Wong <ewong@pw-wspx.org>
Tue, 13 Mar 2012 09:02:47 +0800
changeset 11078 4b5da7e5d0680c6617ec743109e6efc88ca413da
parent 11077 609cf9e6f184e00158fbb0c5b6c9c1f4cb975e5a
child 11079 8cdfed92867f885fda98664395236b7829947a1d
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMnyromyr, Mnyromyr
bugs59049
Bug 59049 - Disable 'Search subfolders' if no subfolders exist. r=Mnyromyr sr=Mnyromyr
suite/mailnews/search/SearchDialog.js
--- a/suite/mailnews/search/SearchDialog.js
+++ b/suite/mailnews/search/SearchDialog.js
@@ -272,17 +272,21 @@ 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])
-      selectFolder(window.arguments[0].folder);
+  {
+    var winArgFolder = window.arguments[0].folder;
+    selectFolder(winArgFolder);
+    UpdateSubFolder(winArgFolder);
+  }
 
   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
@@ -362,17 +366,17 @@ 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 searchLocalSystem = document.getElementById("checkSearchLocalSystem");
     if (searchLocalSystem)
         searchLocalSystem.disabled = gMsgFolderSelected.server.searchScope == nsMsgSearchScope.offlineMail;
     setSearchScope(GetScopeForFolder(gMsgFolderSelected));
 }
@@ -781,8 +785,14 @@ 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);
+}