25 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
27 Components.utils.import(
"resource://app/jsmodules/DebugUtils.jsm");
29 const Cc = Components.classes;
30 const Ci = Components.interfaces;
32 const LOG = DebugUtils.generateLogFunction(
"sbLibrarySearch", 2);
40 classID: Components.ID(
"{13d82f60-a625-11df-981c-0800200c9a66}"),
41 contractID:
"@songbirdnest.com/Songbird/songbird-internal-search;1",
48 _isMediaPageShowing:
function sbLibrarySearch__isMediaPageShowing(
aBrowser) {
56 _getCurrentMediaListView:
57 function sbLibrarySearch__getCurrentMediaListView(
aBrowser) {
59 return aBrowser.currentMediaPage.mediaListView;
70 function sbLibrarySearch__setMediaPageSearch(
aBrowser, aQuery) {
72 var mediaListView = this._getCurrentMediaListView(
aBrowser);
75 if (!mediaListView || !mediaListView.cascadeFilterSet) {
76 LOG(
"no cascade filter set!");
81 var filters = mediaListView.cascadeFilterSet;
84 for (let
i = 0;
i < filters.length; ++
i) {
85 if (filters.isSearch(
i)) {
90 if (searchIndex < 0) {
91 searchIndex = filters.appendSearch([
"*"], 1);
94 if (aQuery ==
"" || aQuery ==
null) {
95 filters.set(searchIndex, [], 0);
98 Cc[
"@songbirdnest.com/Songbird/Intl/StringTransform;1"]
99 .createInstance(
Ci.sbIStringTransform);
101 aQuery = stringTransform.normalizeString(
"",
102 Ci.sbIStringTransform.TRANSFORM_IGNORE_NONSPACE,
105 var valArray = aQuery.split(
" ");
107 filters.set(searchIndex, valArray, valArray.length);
111 doSearch:
function sbLibrarySearch_doSearch(aWindow, aQuery) {
112 var
browser = aWindow.gBrowser;
119 var query = aQuery.trim();
121 if (!this._isMediaPageShowing(browser)) {
124 var view =
LibraryUtils.createStandardMediaListView(library, query);
127 browser.loadMediaList(library,
null,
null, view);
130 this._setMediaPageSearch(browser, query);
function NSGetModule(compMgr, fileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function sbLibrarySearch()
_updateTextAndScrollDataForTab aBrowser
sbDeviceFirmwareAutoCheckForUpdate prototype classID
Javascript wrappers for common library tasks.
function doSearch(searchTerm, cmdLine)
_getSelectedPageStyle s i