Bug 392497 - search in history sidebar loses sort, r=mano ui-r=faaborg a191=beltzner
authorThomas Bertels <tbertels+bugzilla@gmail.com>
Wed, 15 Apr 2009 22:24:42 +0200
changeset 24730 c51d6084775c32a3a7d9ac98d6713685a6b2eb32
parent 24729 21a56d7f1497097af40fdf5f0943b2379516d665
child 24731 df52eb41dbccfab29eec53458a1106bc6711bbc3
push id1205
push usermak77@bonardo.net
push dateWed, 15 Apr 2009 20:25:28 +0000
reviewersmano, faaborg
bugs392497
milestone1.9.1b4pre
Bug 392497 - search in history sidebar loses sort, r=mano ui-r=faaborg a191=beltzner
browser/components/places/content/history-panel.js
--- a/browser/components/places/content/history-panel.js
+++ b/browser/components/places/content/history-panel.js
@@ -94,42 +94,43 @@ function searchHistory(aInput)
 {
   var query = PlacesUtils.history.getNewQuery();
   var options = PlacesUtils.history.getNewQueryOptions();
 
   const NHQO = Ci.nsINavHistoryQueryOptions;
   var sortingMode;
   var resultType;
 
+  switch (gHistoryGrouping) {
+    case "visited":
+      resultType = NHQO.RESULTS_AS_URI;
+      sortingMode = NHQO.SORT_BY_VISITCOUNT_DESCENDING;
+      break; 
+    case "lastvisited":
+      resultType = NHQO.RESULTS_AS_URI;
+      sortingMode = NHQO.SORT_BY_DATE_DESCENDING;
+      break; 
+    case "dayandsite":
+      resultType = NHQO.RESULTS_AS_DATE_SITE_QUERY;
+      break;
+    case "site":
+      resultType = NHQO.RESULTS_AS_SITE_QUERY;
+      sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
+      break;
+    case "day":
+    default:
+      resultType = NHQO.RESULTS_AS_DATE_QUERY;
+      break;
+  }
+
   if (aInput) {
     query.searchTerms = aInput;
-    sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
-    resultType = NHQO.RESULTS_AS_URI;
-  }
-  else {
-    switch (gHistoryGrouping) {
-      case "visited":
-        resultType = NHQO.RESULTS_AS_URI;
-        sortingMode = NHQO.SORT_BY_VISITCOUNT_DESCENDING;
-        break; 
-      case "lastvisited":
-        resultType = NHQO.RESULTS_AS_URI;
-        sortingMode = NHQO.SORT_BY_DATE_DESCENDING;
-        break; 
-      case "dayandsite":
-        resultType = NHQO.RESULTS_AS_DATE_SITE_QUERY;
-        break;
-      case "site":
-        resultType = NHQO.RESULTS_AS_SITE_QUERY;
-        sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
-        break;
-      case "day":
-      default:
-        resultType = NHQO.RESULTS_AS_DATE_QUERY;
-        break;
+    if (gHistoryGrouping != "visited" && gHistoryGrouping != "lastvisited") {
+      sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
+      resultType = NHQO.RESULTS_AS_URI;
     }
   }
 
   options.sortingMode = sortingMode;
   options.resultType = resultType;
 
   // call load() on the tree manually
   // instead of setting the place attribute in history-panel.xul