B2G/gecko/browser/components/places/content/places.js
/**
   * Sets the search scope.  This can be called when no search is active, and
   * in that case, when the user does begin a search aScope will be used (see
   * PSB_search()).  If there is an active search, it's performed again to
   * update the content tree.
   * @param   aScope
   *          The search scope: "bookmarks", "collection", "downloads" or
   *          "history".
   */
Sets the search scope.  This can be called when no search is active, and
in that case, when the user does begin a search aScope will be used (see
PSB_search()).  If there is an active search, it's performed again to
update the content tree.
Sets the search scope . This can be called when no search is active and in that case when the user does begin a search aScope will be used ( see PSB_search () ) . If there is an active search it ' s performed again to update the content tree .
function PQB_setScope(aScope) {
    var filterCollection;
    var folders = [];
    var scopeButtonId;
    switch (aScope) {
    case "history":
      filterCollection = "history";
      scopeButtonId = "scopeBarHistory";
      break;
    case "collection":
      if (!document.getElementById("scopeBarFolder").hidden) {
        filterCollection = "collection";
        scopeButtonId = "scopeBarFolder";
        folders.push(PlacesUtils.getConcreteItemId(
                       PlacesOrganizer._places.selectedNode));
        break;
      }
    case "bookmarks":
      filterCollection = "bookmarks";
      scopeButtonId = "scopeBarAll";
      folders.push(PlacesUtils.bookmarksMenuFolderId,
                   PlacesUtils.toolbarFolderId,
                   PlacesUtils.unfiledBookmarksFolderId);
      break;
    case "downloads":
      filterCollection = "downloads";
      scopeButtonId = "scopeBarDownloads";
      break;
    default:
      throw "Invalid search scope";
      break;
    }
    document.getElementById(scopeButtonId).checked = true;
    PlacesSearchBox.filterCollection = filterCollection;
    PlacesSearchBox.folders = folders;
    var searchStr = PlacesSearchBox.searchFilter.value;
    if (searchStr)
      PlacesSearchBox.search(searchStr);
  }
function PQB_setScope ( aScope ) { var filterCollection ; var folders = [ ] ; var scopeButtonId ; switch ( aScope ) { case "history" : filterCollection = "history" ; scopeButtonId = "scopeBarHistory" ; break ; case "collection" : if ( ! document . getElementById ( "scopeBarFolder" ) . hidden ) { filterCollection = "collection" ; scopeButtonId = "scopeBarFolder" ; folders . push ( PlacesUtils . getConcreteItemId ( PlacesOrganizer . _places . selectedNode ) ) ; break ; } case "bookmarks" : filterCollection = "bookmarks" ; scopeButtonId = "scopeBarAll" ; folders . push ( PlacesUtils . bookmarksMenuFolderId , PlacesUtils . toolbarFolderId , PlacesUtils . unfiledBookmarksFolderId ) ; break ; case "downloads" : filterCollection = "downloads" ; scopeButtonId = "scopeBarDownloads" ; break ; default : throw "Invalid search scope" ; break ; } document . getElementById ( scopeButtonId ) . checked = true ; PlacesSearchBox . filterCollection = filterCollection ; PlacesSearchBox . folders = folders ; var searchStr = PlacesSearchBox . searchFilter . value ; if ( searchStr ) PlacesSearchBox . search ( searchStr ) ; }
Sets the search scope.
Sets the search scope .
// Determine filterCollection, folders, and scopeButtonId based on aScope. // The folder scope button can only become hidden upon selecting a new // folder in the left pane, and the disabled state will remain unchanged // until a new folder is selected.  See PO__setScopeForNode(). // Fall through.  If collection scope doesn't make sense for the // selected node, choose bookmarks scope. // Check the appropriate scope button in the scope bar. // Update the search box.  Re-search if there's an active search.