B2G/gecko/browser/components/places/content/places.js
/**
   * Run a search for the specified text, over the collection specified by
   * the dropdown arrow. The default is all bookmarks, but can be
   * localized to the active collection.
   * @param   filterString
   *          The text to search for.
   */
Run a search for the specified text, over the collection specified by
the dropdown arrow. The default is all bookmarks, but can be
localized to the active collection.
@param   filterString
The text to search for.
Run a search for the specified text over the collection specified by the dropdown arrow . The default is all bookmarks but can be localized to the active collection . @param filterString The text to search for .
function PSB_search(filterString) {
    var PO = PlacesOrganizer;
    if (filterString == "") {
      PO.onPlaceSelected(false);
      return;
    }
    var currentOptions = PO.getCurrentOptions();
    var content = PO._content;
    switch (PlacesSearchBox.filterCollection) {
    case "collection":
      content.applyFilter(filterString, this.folders);
      break;
    case "bookmarks":
      content.applyFilter(filterString, this.folders);
      break;
    case "history":
      if (currentOptions.queryType != Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
        var query = PlacesUtils.history.getNewQuery();
        query.searchTerms = filterString;
        var options = currentOptions.clone();
        options.resultType = currentOptions.RESULT_TYPE_URI;
        options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
        options.includeHidden = true;
        content.load([query], options);
      }
      else {
        content.applyFilter(filterString, null, true);
      }
      break;
    case "downloads": {
        let query = PlacesUtils.history.getNewQuery();
        query.searchTerms = filterString;
        query.setTransitions([Ci.nsINavHistoryService.TRANSITION_DOWNLOAD], 1);
        let options = currentOptions.clone();
        options.resultType = currentOptions.RESULT_TYPE_URI;
        options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
        options.includeHidden = true;
        content.load([query], options);
      break;
    }
    default:
      throw "Invalid filterCollection on search";
      break;
    }
    PlacesSearchBox.showSearchUI();
    PlacesOrganizer.onContentTreeSelect();
  }
function PSB_search ( filterString ) { var PO = PlacesOrganizer ; if ( filterString == "" ) { PO . onPlaceSelected ( false ) ; return ; } var currentOptions = PO . getCurrentOptions ( ) ; var content = PO . _content ; switch ( PlacesSearchBox . filterCollection ) { case "collection" : content . applyFilter ( filterString , this . folders ) ; break ; case "bookmarks" : content . applyFilter ( filterString , this . folders ) ; break ; case "history" : if ( currentOptions . queryType != Ci . nsINavHistoryQueryOptions . QUERY_TYPE_HISTORY ) { var query = PlacesUtils . history . getNewQuery ( ) ; query . searchTerms = filterString ; var options = currentOptions . clone ( ) ; options . resultType = currentOptions . RESULT_TYPE_URI ; options . queryType = Ci . nsINavHistoryQueryOptions . QUERY_TYPE_HISTORY ; options . includeHidden = true ; content . load ( [ query ] , options ) ; } else { content . applyFilter ( filterString , null , true ) ; } break ; case "downloads" : { let query = PlacesUtils . history . getNewQuery ( ) ; query . searchTerms = filterString ; query . setTransitions ( [ Ci . nsINavHistoryService . TRANSITION_DOWNLOAD ] , 1 ) ; let options = currentOptions . clone ( ) ; options . resultType = currentOptions . RESULT_TYPE_URI ; options . queryType = Ci . nsINavHistoryQueryOptions . QUERY_TYPE_HISTORY ; options . includeHidden = true ; content . load ( [ query ] , options ) ; break ; } default : throw "Invalid filterCollection on search" ; break ; } PlacesSearchBox . showSearchUI ( ) ; PlacesOrganizer . onContentTreeSelect ( ) ; }
Run a search for the specified text, over the collection specified by
 the dropdown arrow.
Run a search for the specified text over the collection specified by the dropdown arrow .
// If the user empties the search box manually, reset it and load all // contents of the current scope. // XXX this might be to jumpy, maybe should search for "", so results // are ungrouped, and search box not reset // Search according to the current scope and folders, which were set by // PQB_setScope() // XXX changing the button text is badness //var scopeBtn = document.getElementById("scopeBarFolder"); //scopeBtn.label = PlacesOrganizer._places.selectedNode.title; // Make sure we're getting uri results. // Make sure we're getting uri results. // Update the details panel