playerOpen.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 // For Songbird properties.
26 Components.utils.import("resource://app/jsmodules/sbProperties.jsm");
27 Components.utils.import("resource://app/jsmodules/sbLibraryUtils.jsm");
28 Components.utils.import("resource://app/jsmodules/WindowUtils.jsm");
29 Components.utils.import("resource://app/jsmodules/StringUtils.jsm");
30 Components.utils.import("resource://app/jsmodules/ArrayConverter.jsm");
31 
32 
33 // Open functions
34 //
35 // This file is not standalone
36 
37 try
38 {
39  function _SBGetCurrentView()
40  {
41  var browser = SBGetBrowser();
42  var mediaPage = browser.currentMediaPage;
43  if (!mediaPage) {
44  Components.utils.reportError("_SBGetCurrentView - Cannot return a view without a mediaPage");
45  return;
46  }
47  var view = mediaPage.mediaListView;
48  if (!view) {
49  Components.utils.reportError("_SBGetCurrentView - Cannot return a view");
50  return;
51  }
52  return view;
53  }
54 
55  function SBFileOpen( )
56  {
57  // Make a filepicker thingie.
58  var nsIFilePicker = Components.interfaces.nsIFilePicker;
59  var fp = Components.classes["@mozilla.org/filepicker;1"]
60  .createInstance(nsIFilePicker);
61 
62  // Get some text for the filepicker window.
63  var sel = SBString("faceplate.select", "Select", theSongbirdStrings);
64 
65  // Initialize the filepicker with our text, a parent and the mode.
66  fp.init(window, sel, nsIFilePicker.modeOpen);
67 
68  var mediafiles = SBString("open.mediafiles", "Media Files", theSongbirdStrings);
69 
70  // ask the playback core for supported extensions
71  var extensions = gTypeSniffer.mediaFileExtensions;
72  if (!Application.prefs.getValue("songbird.mediascan.enableVideo", false)) {
73  // disable video, so scan only audio - see bug 13173
74  extensions = gTypeSniffer.audioFileExtensions;
75  }
76  var exts = ArrayConverter.JSArray(extensions);
77 
78  // map ["mp3", "ogg"] to ["*.mp3", "*.ogg"]
79  var filters = exts.map(function(x){return "*." + x});
80 
81  // Add a filter to show all files.
82  fp.appendFilters(nsIFilePicker.filterAll);
83  // Add a filter to show only HTML files.
84  fp.appendFilters(nsIFilePicker.filterHTML);
85  // Add a filter to show only supported media files.
86  fp.appendFilter(mediafiles, filters.join(";"));
87 
88  // Add a new filter for each and every file extension.
89  var filetype;
90  for (i in exts)
91  {
92  filetype = SBFormattedString("open.filetype",
93  [exts[i].toUpperCase(), filters[i]]);
94  fp.appendFilter(filetype, filters[i]);
95  }
96 
97  // Show the filepicker
98  var fp_status = fp.show();
99  if ( fp_status == nsIFilePicker.returnOK )
100  {
101  // Use a nsIURI because it is safer and contains the scheme etc...
102  var ios = Components.classes["@mozilla.org/network/io-service;1"]
103  .getService(Components.interfaces.nsIIOService);
104  var uri = ios.newFileURI(fp.file, null, null);
105 
106  // Linux specific hack to be able to read badly named files (bug 6227)
107  // nsIIOService::newFileURI actually forces to be valid UTF8 - which isn't
108  // correct if the file on disk manages to have an incorrect name
109  // note that Mac OSX has a different persistentDescriptor
110  if (fp.file instanceof Components.interfaces.nsILocalFile) {
111  switch(getPlatformString()) {
112  case "Linux":
113  var spec = "file://" + escape(fp.file.persistentDescriptor);
114  uri = ios.newURI(spec, null, null);
115  }
116  }
117 
118  // See if we're asking for an extension
119  if ( isXPI( uri.spec ) )
120  {
121  installXPI( uri.spec );
122  }
123  else if ( gTypeSniffer.isValidMediaURL(uri) )
124  {
125  if (fp.file instanceof Components.interfaces.nsILocalFile) {
126  if (!fp.file.exists()) {
127  gBrowser.addTab(uri.spec);
128  return;
129  }
130  }
131 
132  // And if we're good, play it.
133  SBDataSetStringValue("metadata.title", fp.file.leafName);
134  SBDataSetStringValue("metadata.artist", "");
135  SBDataSetStringValue("metadata.album", "");
136 
137  var item = SBImportURLIntoMainLibrary(uri);
138 
139  if (!gServicePane)
140  return;
141 
142  var librarySPS = Cc['@songbirdnest.com/servicepane/library;1']
143  .getService(Ci.sbILibraryServicePaneService);
144  var node = librarySPS.getNodeForLibraryResource(
145  LibraryUtils.mainLibrary,
146  item.getProperty(SBProperties.contentType));
147 
148  gServicePane.activateAndLoadNode(node, null, null);
149 
150  // Wait for the item to show up in the view before trying to play it
151  // and give it time to sort (given 10 tracks per millisecond)
152  var interval = setInterval(function() {
153  // If the view has been updated then we're good to go
154  var index;
155  var view;
156  try {
157  view = _SBGetCurrentView();
158  index = view.getIndexForItem(item);
159  }
160  catch (e if Components.lastResult == Cr.NS_ERROR_NOT_AVAILABLE) {
161  // It's not there so wait for the next interval
162  return;
163  }
164  catch (e) {
165  // If we get anything but not available then that's bad and we need
166  // to bail
167  // Unexpected error, cancel the interval and rethrow
168  clearInterval(interval);
169  throw e;
170  }
171  clearInterval(interval);
172  // If we have a browser, try to show the view
173  if (window.gBrowser) {
174  gBrowser.showIndexInView(view, index);
175  }
176  index = view.getIndexForItem(item);
177  // Play the item
178  gMM.sequencer.playView(view, index);
179  }, 500);
180  }
181  else
182  {
183  // Unknown type, let the browser figure out what the best course
184  // of action is.
185  gBrowser.loadURI( uri.spec );
186  }
187  }
188  }
189 
190  function MediaUriCheckerObserver(uri) {
191  this._uri = uri;
192  }
193 
194  MediaUriCheckerObserver.prototype.onStartRequest =
195  function MediaUriCheckerObserver_onStartRequest(aRequest, aContext)
196  {
197  }
198 
199  MediaUriCheckerObserver.prototype.onStopRequest =
200  function MediaUriCheckerObserver_onStopRequest(aRequest, aContext, aStatusCode)
201  {
202  if (!Components.isSuccessCode(aStatusCode)) {
203  var libraryManager = Cc["@songbirdnest.com/Songbird/library/Manager;1"]
204  .getService(Ci.sbILibraryManager);
205 
206  library = libraryManager.mainLibrary;
207  var mediaItem =
208  getFirstItemByProperty(library,
209  "http://songbirdnest.com/data/1.0#contentURL",
210  this._uri.spec);
211  if (mediaItem)
212  library.remove(mediaItem);
213 
214  gBrowser.addTab(this._uri.spec);
215  }
216 
217  return;
218  }
219 
220  function SBUrlOpen( parentWindow )
221  {
222  // Make a magic data object to get passed to the dialog
223  var url_open_data = new Object();
224  url_open_data.URL = SBDataGetStringValue("faceplate.play.url");
225  url_open_data.retval = "";
226  // Open the modal dialog
227  SBOpenModalDialog( "chrome://songbird/content/xul/openURL.xul", "open_url", "chrome,centerscreen", url_open_data, parentWindow );
228  if ( url_open_data.retval == "ok" )
229  {
230  var library = LibraryUtils.webLibrary;
231 
232  // Use a nsIURI because it is safer and contains the scheme etc...
233  var ios = Components.classes["@mozilla.org/network/io-service;1"]
234  .getService(Components.interfaces.nsIIOService);
235  var url = url_open_data.URL;
236  var uri = null;
237  var isLocal = false;
238 
239  if (getPlatformString() == "Windows_NT") {
240  // Handle the URL starts with something like "c:\"
241  isLocal = /^.:/.test(url);
242  } else {
243  // URL starts with "/" on MacOS/Linux/OpenSolaris
244  isLocal = (url[0] == '/');
245  }
246 
247  try {
248  if (isLocal) {
249  var file = Components.classes["@mozilla.org/file/local;1"]
250  .createInstance(Ci.nsILocalFile);
251  file.initWithPath(url);
252  uri = ios.newFileURI(file);
253  } else {
254  uri = ios.newURI(url, null, null);
255  }
256  }
257  catch(e) {
258  // Bad URL :(
259  Components.utils.reportError(e);
260  return;
261  }
262 
263  // See if we're asking for an extension
264  if ( isXPI( uri.spec ) )
265  {
266  installXPI( uri.spec );
267  }
268  else if ( gTypeSniffer.isValidMediaURL(uri) )
269  {
270  if (uri.scheme == "file") {
271  var pFileURL = uri.QueryInterface(Ci.nsIFileURL);
272  if (pFileURL.file && !pFileURL.file.exists()) {
273  gBrowser.addTab(uri.spec);
274  return;
275  }
276  }
277 
278  if (uri.scheme == "http") {
279  var checker = Cc["@mozilla.org/network/urichecker;1"]
280  .createInstance(Ci.nsIURIChecker);
281  checker.init(uri);
282  checker.asyncCheck(new MediaUriCheckerObserver(uri), null);
283  }
284 
285  var item = null;
286 
287  // Doesn't import local file to the web Library
288  if (uri.scheme != "file")
289  item = SBImportURLIntoWebLibrary(uri);
290 
291  // Import the item.
292  item = SBImportURLIntoMainLibrary(uri);
293 
294  if (!gServicePane)
295  return;
296 
297  var librarySPS = Cc['@songbirdnest.com/servicepane/library;1']
298  .getService(Ci.sbILibraryServicePaneService);
299  var node = librarySPS.getNodeForLibraryResource(
300  LibraryUtils.mainLibrary,
301  item.getProperty(SBProperties.contentType));
302 
303  gServicePane.activateAndLoadNode(node, null, null);
304 
305  // Wait for the item to show up in the view before trying to play it
306  // and give it time to sort (given 10 tracks per millisecond)
307  var interval = setInterval(function() {
308  // If the view has been updated then we're good to go
309  var index;
310  var view;
311  try {
312  view = _SBGetCurrentView();
313  index = view.getIndexForItem(item);
314  }
315  catch (e if Components.lastResult == Cr.NS_ERROR_NOT_AVAILABLE) {
316  // It's not there so wait for the next interval
317  return;
318  }
319  catch (e) {
320  // If we get anything but not available then that's bad and we need
321  // to bail
322  // Unexpected error, cancel the interval and rethrow
323  clearInterval(interval);
324  throw e;
325  }
326  clearInterval(interval);
327  // If we have a browser, try to show the view
328  if (window.gBrowser) {
329  gBrowser.showIndexInView(view, index);
330  }
331  index = view.getIndexForItem(item);
332  // Play the item
333  gMM.sequencer.playView(view, index);
334  }, 500);
335  }
336  else
337  {
338  // Unknown type, let the browser figure out what the best course
339  // of action is.
340  gBrowser.loadURI( uri.spec );
341  }
342  }
343  }
344 
345  function SBPlaylistOpen()
346  {
347  try
348  {
349  var aPlaylistReaderManager =
350  Components.classes["@songbirdnest.com/Songbird/PlaylistReaderManager;1"]
351  .getService(Components.interfaces.sbIPlaylistReaderManager);
352 
353  // Make a filepicker thingie.
354  var nsIFilePicker = Components.interfaces.nsIFilePicker;
355  var fp = Components.classes["@mozilla.org/filepicker;1"]
356  .createInstance(nsIFilePicker);
357 
358  // Get some text for the filepicker window.
359  var sel = SBString("faceplate.open.playlist", "Open Playlist",
361 
362  // Initialize the filepicker with our text, a parent and the mode.
363  fp.init(window, sel, nsIFilePicker.modeOpenMultiple);
364 
365  var playlistfiles = SBString("open.playlistfiles", "Playlist Files",
367 
368  var ext;
369  var exts = new Array();
370  var extensionCount = new Object;
371  var extensions = aPlaylistReaderManager.supportedFileExtensions(extensionCount);
372 
373  for (i in extensions)
374  {
375  ext = extensions[i];
376  if (ext)
377  exts.push(ext);
378  }
379 
380  // map ["m3u", "pls"] to ["*.m3u", "*.pls"]
381  var filters = exts.map(function(x){return "*." + x});
382 
383  // Add a filter to show all files.
384  fp.appendFilters(nsIFilePicker.filterAll);
385  // Add a filter to show only supported playlist files.
386  fp.appendFilter(playlistfiles, filters.join(";"));
387 
388  // Add a new filter for each and every file extension.
389  var filetype;
390  for (i in exts)
391  {
392  filetype = SBFormattedString("open.filetype",
393  [exts[i].toUpperCase(), filters[i]]);
394  fp.appendFilter(filetype, filters[i]);
395  }
396 
397  // Show it
398  var fp_status = fp.show();
399  if ( fp_status == nsIFilePicker.returnOK )
400  {
401  var aFile, aURI, allFiles = fp.files;
402  var ioService = Components.classes["@mozilla.org/network/io-service;1"]
403  .getService(Components.interfaces.nsIIOService)
404  while(allFiles.hasMoreElements()) {
405  aFile = allFiles.getNext().QueryInterface(Components.interfaces.nsIFile);
406  aURI = ioService.newFileURI(aFile);
407 
408  // Remove the file extension if exist
409  var name = aFile.leafName;
410  var p = name.lastIndexOf(".");
411  if (p != -1) {
412  ext = name.slice(p + 1, name.length);
413  if (exts.indexOf(ext) > -1) {
414  name = name.slice(0, p);
415  }
416  }
417  SBOpenPlaylistURI(aURI, name);
418  }
419  }
420  }
421  catch(err)
422  {
423  alert(err);
424  }
425  }
426 
427  function SBOpenPlaylistURI(aURI, aName) {
428  var uri = aURI;
429  if(!(aURI instanceof Components.interfaces.nsIURI)) {
430  uri = newURI(aURI);
431  }
432  var name = aName;
433  if (!aName) {
434  name = uri.path;
435  var p = name.lastIndexOf(".");
436  if (p != -1) name = name.slice(0, p);
437  p = name.lastIndexOf("/");
438  if (p != -1) name = name.slice(p+1);
439  }
440  var aPlaylistReaderManager =
441  Components.classes["@songbirdnest.com/Songbird/PlaylistReaderManager;1"]
442  .getService(Components.interfaces.sbIPlaylistReaderManager);
443 
444  var library = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"]
445  .getService(Components.interfaces.sbILibraryManager).mainLibrary;
446 
447  // Create the media list
448  var mediaList = library.createMediaList("simple");
449  mediaList.name = name;
450  mediaList.setProperty("http://songbirdnest.com/data/1.0#originURL", uri.spec);
451 
452  aPlaylistReaderManager.originalURI = uri;
453  var success = aPlaylistReaderManager.loadPlaylist(uri, mediaList, null, false, null);
454  if (success == 1 &&
455  mediaList.length) {
456  var array = Components.classes["@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
457  .createInstance(Components.interfaces.nsIMutableArray);
458  for (var i = 0; i < mediaList.length; i++) {
459  array.appendElement(mediaList.getItemByIndex(i), false);
460  }
461 
462  var metadataService =
463  Components.classes["@songbirdnest.com/Songbird/FileMetadataService;1"]
464  .getService(Components.interfaces.sbIFileMetadataService);
465  var metadataJob = metadataService.read(array);
466 
467 
468  // Give the new media list focus
469  if (typeof gBrowser != 'undefined') {
470  gBrowser.loadMediaList(mediaList);
471  }
472  } else {
473  library.remove(mediaList);
474  return null;
475  }
476  return mediaList;
477  }
478 
479  function SBLibraryOpen( parentWindow, silent )
480  {
481  // Get the default library importer. Do nothing if none available.
482  var libraryImporterManager =
483  Cc["@songbirdnest.com/Songbird/LibraryImporterManager;1"]
484  .getService(Ci.sbILibraryImporterManager);
485  var libraryImporter = libraryImporterManager.defaultLibraryImporter;
486  if (!libraryImporter)
487  return null;
488 
489  var importTracks = Application.prefs.getValue(
490  "songbird.library_importer.import_tracks", false);
491  var importPlaylists = Application.prefs.getValue(
492  "songbird.library_importer.import_playlists", false);
493  if (!importTracks && !importPlaylists)
494  return null;
495 
496  // Present the import library dialog.
497  var doImport;
498  if (!silent) {
499  doImport = {};
500  WindowUtils.openModalDialog
501  (parentWindow,
502  "chrome://songbird/content/xul/importLibrary.xul",
503  "",
504  "chrome,centerscreen",
505  [ "manual" ],
506  [ doImport ]);
507  doImport = doImport.value == "true" ? true : false;
508  } else {
509  doImport = true;
510  }
511 
512  // Import the library as user directs.
513  var job = null;
514  if (doImport) {
515  var libraryFilePath = Application.prefs.getValue
516  ("songbird.library_importer.library_file_path",
517  "");
518  job = libraryImporter.import(libraryFilePath, "songbird", false);
519  SBJobUtils.showProgressDialog(job, window, 0, true);
520  }
521  return job;
522  }
523 
524  function log(str)
525  {
526  var consoleService = Components.classes['@mozilla.org/consoleservice;1']
527  .getService(Components.interfaces.nsIConsoleService);
528  consoleService.logStringMessage( str );
529  }
530 
531  // This function should be called when we need to open a URL but gBrowser is
532  // not available. Eventually this should be replaced by code that opens a new
533  // Songbird window, when we are able to do that, but for now, open in the
534  // default external browser.
535  // If what you want to do is ALWAYS open in the default external browser,
536  // use SBOpenURLInDefaultBrowser directly!
537  function SBBrowserOpenURLInNewWindow( the_url ) {
538  SBOpenURLInDefaultBrowser(the_url);
539  }
540 
541  // This function opens a URL externally, in the default web browser for the system
542  function SBOpenURLInDefaultBrowser( the_url ) {
543  var externalLoader = (Components
544  .classes["@mozilla.org/uriloader/external-protocol-service;1"]
545  .getService(Components.interfaces.nsIExternalProtocolService));
546  var nsURI = (Components
547  .classes["@mozilla.org/network/io-service;1"]
548  .getService(Components.interfaces.nsIIOService)
549  .newURI(the_url, null, null));
550  externalLoader.loadURI(nsURI, null);
551  }
552 
553 // Help
554 function onHelp()
555 {
556  var helpitem = document.getElementById("menuitem_help_topics");
557  onMenu(helpitem);
558 }
559 
560 function SBOpenEqualizer()
561 {
562  // Only open the equalizer UI if the control is enabled.
563  var equalizerControl = document.getElementById("menu_equalizer");
564  if (equalizerControl.getAttribute("disabled"))
565  return;
566 
567  var features = "chrome,titlebar,toolbar,centerscreen,resizable=no";
568  SBOpenWindow( "chrome://songbird/content/xul/mediacore/mediacoreEqualizer.xul", "Equalizer", features);
569 }
570 
571 function SBOpenPreferences(paneID, parentWindow)
572 {
573  if (!parentWindow) parentWindow = window;
574 
575  // On all systems except Windows pref changes should be instant.
576  //
577  // In mozilla this is the browser.prefereces.instantApply pref,
578  // and is set at compile time.
579  var instantApply = navigator.userAgent.indexOf("Windows") == -1;
580 
581  // BUG 5081 - You can't call restart in a modal window, so
582  // we're making prefs non-modal on all platforms.
583  // Original line: var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
584  var features = "chrome,titlebar,resizable,toolbar,centerscreen" + (instantApply ? ",dialog=no" : "");
585 
586  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
587  var win = wm.getMostRecentWindow("Browser:Preferences");
588  if (win) {
589  win.focus();
590  if (paneID) {
591  var pane = win.document.getElementById(paneID);
592  win.document.documentElement.showPane(pane);
593  }
594  return win;
595  } else {
596  return parentWindow.openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences", features, paneID);
597  }
598 
599  // to open connection settings only:
600  // SBOpenModalDialog("chrome://browser/content/preferences/connection.xul", "chrome,centerscreen", null);
601 }
602 
603 function SBOpenDownloadManager()
604 {
605  var dlmgr = Cc['@mozilla.org/download-manager;1'].getService();
606  dlmgr = dlmgr.QueryInterface(Ci.nsIDownloadManager);
607 
608  var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1']
609  .getService();
610  windowMediator = windowMediator.QueryInterface(Ci.nsIWindowMediator);
611 
612  var dlmgrWindow = windowMediator.getMostRecentWindow("Download:Manager");
613  if (dlmgrWindow) {
614  dlmgrWindow.focus();
615  }
616  else {
617  window.openDialog("chrome://mozapps/content/downloads/downloads.xul",
618  "Download:Manager",
619  "chrome,centerscreen,dialog=no,resizable",
620  null);
621  }
622 }
623 
624 function SBScanMedia( aParentWindow, aScanDirectory )
625 {
626  var scanDirectory = aScanDirectory;
627 
628  if ( !scanDirectory ) {
629  const nsIFilePicker = Components.interfaces.nsIFilePicker;
630  const CONTRACTID_FILE_PICKER = "@mozilla.org/filepicker;1";
631  var fp = Components.classes[CONTRACTID_FILE_PICKER].createInstance(nsIFilePicker);
632  var scan = SBString("faceplate.scan", "Scan", theSongbirdStrings);
633  fp.init( window, scan, nsIFilePicker.modeGetFolder );
634  if (getPlatformString() == "Darwin") {
635  var defaultDirectory =
636  Components.classes["@mozilla.org/file/directory_service;1"]
637  .getService(Components.interfaces.nsIProperties)
638  .get("Home", Components.interfaces.nsIFile);
639  defaultDirectory.append("Music");
640  fp.displayDirectory = defaultDirectory;
641  }
642  var res = fp.show();
643  if ( res != nsIFilePicker.returnOK )
644  return null; /* no job */
645  scanDirectory = fp.file;
646  }
647 
648  if ( scanDirectory && !scanDirectory.exists() ) {
649  var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
650  .getService(Ci.nsIPromptService);
651  var strTitle = SBString("media_scan.error.non_existent_directory.title");
652  var strMsg = SBFormattedString
653  ("media_scan.error.non_existent_directory.msg",
654  [scanDirectory.path]);
655  promptService.alert(window, strTitle, strMsg);
656  return null;
657  }
658 
659  if ( scanDirectory )
660  {
661  var importer = Cc['@songbirdnest.com/Songbird/DirectoryImportService;1']
662  .getService(Ci.sbIDirectoryImportService);
663  if (typeof(ArrayConverter) == "undefined") {
664  Components.utils.import("resource://app/jsmodules/ArrayConverter.jsm");
665  }
666  if (typeof(SBJobUtils) == "undefined") {
667  Components.utils.import("resource://app/jsmodules/SBJobUtils.jsm");
668  }
669  var directoryArray = ArrayConverter.nsIArray([scanDirectory]);
670  var job = importer.import(directoryArray);
671  SBJobUtils.showProgressDialog(job, window, /* no delay */ 0);
672  return job;
673  }
674  return null; /* no job - but unreachable */
675 }
676 
678 function SBNewPlaylist(aEnumerator, aAllowDevicePlaylist)
679 {
680  var playlist = makeNewPlaylist("simple", aAllowDevicePlaylist);
681  if (aEnumerator) {
682  // make playlist from selected items
683  playlist.addSome(aEnumerator);
684  }
685  return playlist;
686 }
687 
688 function SBNewSmartPlaylist(aAllowDevicePlaylist)
689 {
690  var obj = { newSmartPlaylist: null,
691  newPlaylistFunction: function() {
692  return makeNewPlaylist("smart", aAllowDevicePlaylist);
693  }
694  };
695 
696  SBOpenModalDialog("chrome://songbird/content/xul/smartPlaylist.xul",
697  "Songbird:SmartPlaylist",
698  "chrome,dialog=yes,centerscreen,modal,titlebar=no",
699  obj);
700 
701  return obj.newSmartPlaylist;
702 }
703 
711 function makeNewPlaylist(mediaListType, allowDevicePlaylist) {
712  var servicePane = null;
713  if (typeof gServicePane != 'undefined') servicePane = gServicePane;
714 
715  var librarySPS = Cc['@songbirdnest.com/servicepane/library;1']
716  .getService(Ci.sbILibraryServicePaneService);
717  if (allowDevicePlaylist) {
718  // Try to find the currently selected service pane node
719  var selectedNode = null;
720  if (servicePane) {
721  selectedNode = servicePane.activeNode;
722  }
723 
724  // Ask the library service pane provider to suggest where
725  // a new playlist should be created
726  var library = librarySPS.suggestLibraryForNewList(mediaListType,
727  selectedNode);
728  } else {
729  var library = LibraryUtils.mainLibrary;
730  }
731 
732  // Looks like no libraries support the given mediaListType
733  if (!library) {
734  throw("Could not find a library supporting lists of type " + mediaListType);
735  }
736 
737  // Make sure the library is user editable, if it is not, use the main
738  // library instead of the currently selected library.
739  if (!library.userEditable ||
740  !library.userEditableContent) {
741  var libraryManager = Cc["@songbirdnest.com/Songbird/library/Manager;1"]
742  .getService(Ci.sbILibraryManager);
743 
744  library = libraryManager.mainLibrary;
745  }
746 
747  // Create the playlist
748  var name = librarySPS.suggestNameForNewPlaylist(library);
749  var properties =
750  Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
751  .createInstance(Ci.sbIMutablePropertyArray);
752  properties.appendProperty(SBProperties.mediaListName, name);
753 
754  var mediaList = library.createMediaList(mediaListType, properties);
755 
756  // If we have a servicetree, tell it to make the new playlist node editable
757  if (servicePane) {
758  // Find the servicepane node for our new medialist
759  var node = librarySPS.getNodeForLibraryResource(mediaList);
760  if (node) {
761  // Make the new node visible
762  for (let parent = node.parentNode; parent; parent = parent.parentNode)
763  if (!parent.isOpen)
764  parent.isOpen = true;
765 
766  // Ask the service pane to start editing our new node
767  // so that the user can give it a name
768  servicePane.startEditingNode(node);
769  } else {
770  throw("Error: Couldn't find a service pane node for the list we just created\n");
771  }
772 
773  // Otherwise pop up a dialog and ask for playlist name
774  } else {
775  var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1" ]
776  .getService(Ci.nsIPromptService);
777 
778  var input = {value: mediaList.name};
779  var title = SBString("newPlaylist.title", "Create New Playlist");
780  var prompt = SBString("newPlaylist.prompt", "Enter the name of the new playlist.");
781 
782  if (promptService.prompt(window, title, prompt, input, null, {})) {
783  mediaList.name = input.value;
784  }
785  }
786 
787 #ifdef METRICS_ENABLED
788  var metrics = Cc["@songbirdnest.com/Songbird/Metrics;1"]
789  .createInstance(Ci.sbIMetrics);
790  metrics.metricsInc("medialist", "create", mediaListType);
791 #endif
792 
793  return mediaList;
794 }
795 
800 function SBDeleteMediaList(aMediaList)
801 {
802  var mediaList = aMediaList;
803  if (!mediaList) {
804  mediaList = _SBGetCurrentView().mediaList;
805  }
806  // if this list is the storage for an outer list, the outer list is the one
807  // that should be deleted
808  var outerListGuid =
809  mediaList.getProperty(SBProperties.outerGUID);
810  if (outerListGuid)
811  mediaList = mediaList.library.getMediaItem(outerListGuid);
812  // smart playlists are never user editable, determine whether we can delete
813  // them based on their parent library user-editable flag. Also don't delete
814  // libraries or the download node.
815  var listType = mediaList.getProperty(SBProperties.customType);
816  if (mediaList.userEditable &&
817  listType != "download" &&
818  !(mediaList instanceof Ci.sbILibrary)) {
819  const BYPASSKEY = "playlist.deletewarning.bypass";
820  const STRINGROOT = "playlist.deletewarning.";
821  if (!SBDataGetBoolValue(BYPASSKEY)) {
822  var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
823  .getService(Ci.nsIPromptService);
824  var check = { value: false };
825 
826  var sbs = Cc["@mozilla.org/intl/stringbundle;1"]
827  .getService(Ci.nsIStringBundleService);
828  var songbirdStrings = sbs.createBundle("chrome://songbird/locale/songbird.properties");
829  var strTitle = SBString(STRINGROOT + "title");
830  var strMsg = SBFormattedString(STRINGROOT + "message", [mediaList.name]);
831 
832  var strCheck = SBString(STRINGROOT + "check");
833 
834  var r = promptService.confirmEx(window,
835  strTitle,
836  strMsg,
837  Ci.nsIPromptService.STD_YES_NO_BUTTONS,
838  null,
839  null,
840  null,
841  strCheck,
842  check);
843  if (check.value == true) {
844  SBDataSetBoolValue(BYPASSKEY, true);
845  }
846  if (r == 1) { // 0 = yes, 1 = no
847  return;
848  }
849  }
850  // delete the medialist. if the medialist is visible in the browser, the
851  // browser will automatically switch to the main library
852  mediaList.library.remove(mediaList);
853  } else {
854  Components.utils.reportError("SBDeleteMediaList - Medialist is not user editable");
855  }
856 }
857 
858 function SBExtensionsManagerOpen( parentWindow )
859 {
860  if (!parentWindow) parentWindow = window;
861  const EM_TYPE = "Extension:Manager";
862 
863  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
864  .getService(Components.interfaces.nsIWindowMediator);
865  var theEMWindow = wm.getMostRecentWindow(EM_TYPE);
866  if (theEMWindow) {
867  theEMWindow.focus();
868  return;
869  }
870 
871  const EM_URL = "chrome://mozapps/content/extensions/extensions.xul?type=extensions";
872  const EM_FEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
873  parentWindow.openDialog(EM_URL, "", EM_FEATURES);
874 }
875 
876 function SBTrackEditorOpen( initialTab, parentWindow ) {
877  if (!parentWindow)
878  parentWindow = window;
879  var browser;
880  if (typeof SBGetBrowser == 'function')
881  browser = SBGetBrowser();
882  if (browser) {
883  if (browser.currentMediaPage) {
884  var view = browser.currentMediaPage.mediaListView;
885  if (view) {
886  var numSelected = view.selection.count;
887  if (numSelected > 1) {
888  const BYPASSKEY = "trackeditor.multiplewarning.bypass";
889  const STRINGROOT = "trackeditor.multiplewarning.";
890  if (!SBDataGetBoolValue(BYPASSKEY)) {
891  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
892  .getService(Components.interfaces.nsIPromptService);
893  var check = { value: false };
894 
895  var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
896  .getService(Components.interfaces.nsIStringBundleService);
897  var songbirdStrings = sbs.createBundle("chrome://songbird/locale/songbird.properties");
898  var strTitle = songbirdStrings.GetStringFromName(STRINGROOT + "title");
899  var strMsg = songbirdStrings.formatStringFromName(STRINGROOT + "message", [numSelected], 1);
900  var strCheck = songbirdStrings.GetStringFromName(STRINGROOT + "check");
901 
902  var r = promptService.confirmEx(window,
903  strTitle,
904  strMsg,
905  Ci.nsIPromptService.STD_YES_NO_BUTTONS,
906  null,
907  null,
908  null,
909  strCheck,
910  check);
911  if (check.value == true) {
912  SBDataSetBoolValue(BYPASSKEY, true);
913  }
914  if (r == 1) { // 0 = yes, 1 = no
915  return;
916  }
917  }
918  } else if (numSelected < 1) {
919  // no track is selected, can't invoke the track editor on nothing !
920  return;
921  }
922 
923  var isVideo = view.selection.currentMediaItem.getProperty(SBProperties.contentType) == "video";
924  SBOpenModalDialog((isVideo ? "chrome://songbird/content/xul/trackEditorVideo.xul"
925  : "chrome://songbird/content/xul/trackEditor.xul"),
926  "Songbird:TrackEditor", "chrome,centerscreen",
927  initialTab, parentWindow);
928  }
929  }
930  }
931 }
932 
933 function SBGetArtworkOpen() {
934  var browser = SBGetBrowser();
935  var view = null;
936  if (browser && browser.currentMediaPage) {
937  view = browser.currentMediaPage.mediaListView;
938  }
939 
940  if (!view)
941  return;
942 
943  var artworkScanner = Cc["@songbirdnest.com/Songbird/album-art/scanner;1"]
944  .createInstance(Ci.sbIAlbumArtScanner);
945  artworkScanner.scanListForArtwork(view.mediaList);
946  SBJobUtils.showProgressDialog(artworkScanner, window, 0);
947 }
948 
949 function SBRevealFile( initialTab, parentWindow ) {
950  if (!parentWindow) parentWindow = window;
951  var browser;
952  var view = _SBGetCurrentView();
953  if (!view) { return; }
954 
955  var numSelected = view.selection.count;
956  if (numSelected != 1) { return; }
957 
958  var item = null;
959  var selection = view.selection.selectedIndexedMediaItems;
960  item = selection.getNext().QueryInterface(Ci.sbIIndexedMediaItem).mediaItem;
961 
962  if (!item) {
963  Cu.reportError("Failed to get media item to reveal.")
964  return;
965  }
966 
967  var uri = item.contentSrc;
968  if (!uri || uri.scheme != "file") { return; }
969 
970  let f = uri.QueryInterface(Ci.nsIFileURL).file;
971  try {
972  // Show the directory containing the file and select the file
973  f.QueryInterface(Ci.nsILocalFile);
974  f.reveal();
975  } catch (e) {
976  // If reveal fails for some reason (e.g., it's not implemented on unix or
977  // the file doesn't exist), try using the parent if we have it.
978  let parent = f.parent.QueryInterface(Ci.nsILocalFile);
979  if (!parent)
980  return;
981 
982  try {
983  // "Double click" the parent directory to show where the file should be
984  parent.launch();
985  } catch (e) {
986  // If launch also fails (probably because it's not implemented), let the
987  // OS handler try to open the parent
988  var parentUri = Cc["@mozilla.org/network/io-service;1"]
989  .getService(Ci.nsIIOService).newFileURI(parent);
990 
991  var protocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
992  .getService(Ci.nsIExternalProtocolService);
993  protocolSvc.loadURI(parentUri);
994  }
995  }
996 }
997 
998 function SBSubscribe(mediaList, defaultUrl, parentWindow)
999 {
1000  // Make sure the argument is a dynamic media list
1001  if (mediaList) {
1002  if (!(mediaList instanceof Components.interfaces.sbIMediaList))
1003  throw Components.results.NS_ERROR_INVALID_ARG;
1004 
1005  var isSubscription =
1006  mediaList.getProperty("http://songbirdnest.com/data/1.0#isSubscription");
1007  if (isSubscription != "1")
1008  throw Components.results.NS_ERROR_INVALID_ARG;
1009  }
1010 
1011  if (defaultUrl && !(defaultUrl instanceof Components.interfaces.nsIURI))
1012  throw Components.results.NS_ERROR_INVALID_ARG;
1013 
1014  var params = Components.classes["@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
1015  .createInstance(Components.interfaces.nsIMutableArray);
1016  params.appendElement(mediaList, false);
1017  params.appendElement(defaultUrl, false);
1018 
1019  // Open the window
1020  SBOpenModalDialog("chrome://songbird/content/xul/subscribe.xul",
1021  "",
1022  "chrome,centerscreen",
1023  params,
1024  parentWindow);
1025 }
1026 
1027 function SBNewPodcast()
1028 {
1029  WindowUtils.openModalDialog
1030  (window,
1031  "chrome://songbird/content/xul/podcast/podcastCreationDialog.xul",
1032  "",
1033  "chrome,centerscreen");
1034 }
1035 
1036 // TODO: This function should be renamed. See openAboutDialog in browserUtilities.js
1037 function About( parentWindow )
1038 {
1039  // Make a magic data object to get passed to the dialog
1040  var about_data = new Object();
1041  about_data.retval = "";
1042  // Open the modal dialog
1043  SBOpenModalDialog( "chrome://songbird/content/xul/about.xul", "about", "chrome,centerscreen", about_data, parentWindow );
1044  if ( about_data.retval == "ok" )
1045  {
1046  }
1047 }
1048 
1052 function checkForUpdates()
1053 {
1054  var um =
1055  Components.classes["@mozilla.org/updates/update-manager;1"].
1056  getService(Components.interfaces.nsIUpdateManager);
1057  var prompter =
1058  Components.classes["@mozilla.org/updates/update-prompt;1"].
1059  createInstance(Components.interfaces.nsIUpdatePrompt);
1060 
1061  // If there's an update ready to be applied, show the "Update Downloaded"
1062  // UI instead and let the user know they have to restart the browser for
1063  // the changes to be applied.
1064  if (um.activeUpdate && um.activeUpdate.state == "pending")
1065  prompter.showUpdateDownloaded(um.activeUpdate);
1066  else
1067  prompter.checkForUpdates();
1068 }
1069 
1070 function buildHelpMenu()
1071 {
1072  var updates =
1073  Components.classes["@mozilla.org/updates/update-service;1"].
1074  getService(Components.interfaces.nsIApplicationUpdateService);
1075  var um =
1076  Components.classes["@mozilla.org/updates/update-manager;1"].
1077  getService(Components.interfaces.nsIUpdateManager);
1078 
1079  // Disable the UI if the update enabled pref has been locked by the
1080  // administrator or if we cannot update for some other reason
1081  var checkForUpdates = document.getElementById("updateCmd");
1082  var canUpdate = updates.canUpdate;
1083  checkForUpdates.setAttribute("disabled", !canUpdate);
1084  if (!canUpdate)
1085  return;
1086 
1087  var strings = document.getElementById("songbird_strings");
1088  var activeUpdate = um.activeUpdate;
1089 
1090  // If there's an active update, substitute its name into the label
1091  // we show for this item, otherwise display a generic label.
1092  function getStringWithUpdateName(key) {
1093  if (activeUpdate && activeUpdate.name)
1094  return strings.getFormattedString(key, [activeUpdate.name]);
1095  return strings.getString(key + "Fallback");
1096  }
1097 
1098  // By default, show "Check for Updates..."
1099  var key = "default";
1100  if (activeUpdate) {
1101  switch (activeUpdate.state) {
1102  case "downloading":
1103  // If we're downloading an update at present, show the text:
1104  // "Downloading Firefox x.x..." otherwise we're paused, and show
1105  // "Resume Downloading Firefox x.x..."
1106  key = updates.isDownloading ? "downloading" : "resume";
1107  break;
1108  case "pending":
1109  // If we're waiting for the user to restart, show: "Apply Downloaded
1110  // Updates Now..."
1111  key = "pending";
1112  break;
1113  }
1114  }
1115  checkForUpdates.label = getStringWithUpdateName("updateCmd_" + key);
1116 }
1117 
1118 function buildFileMenu() {
1119  var closeTabItem = document.getElementById("menuitem_file_closetab");
1120 
1121  // Disable "Close Tab" menu item if media tab is selected.
1122  if (gBrowser.mediaTab == gBrowser.selectedTab) {
1123  closeTabItem.setAttribute("disabled", "true");
1124  } else {
1125  closeTabItem.removeAttribute("disabled");
1126  }
1127 }
1128 
1129 function buildControlsMenu() {
1130  var equalizerControl = document.getElementById("menu_equalizer");
1131  var mm = Cc["@songbirdnest.com/Songbird/Mediacore/Manager;1"]
1132  .getService(Ci.sbIMediacoreManager);
1133  var equalizerEnabled = false;
1134 
1135  try {
1136  // Enable equalizer menu item if playback is stopped or the media core
1137  // has equalizer interface.
1138  if (!mm.primaryCore ||
1139  mm.primaryCore.QueryInterface(Ci.sbIMediacoreMultibandEqualizer))
1140  {
1141  equalizerEnabled = true;
1142  }
1143  }
1144  catch (e) {
1145  }
1146 
1147  // Disable the equalizer menu item if equalizer is not supported.
1148  if (!equalizerEnabled) {
1149  equalizerControl.setAttribute("disabled", "true");
1150  } else {
1151  equalizerControl.removeAttribute("disabled");
1152  }
1153 }
1154 
1155 function buildViewMenu() {
1156  var disabled = !SBDataGetBoolValue("faceplate.playingvideo");
1157  var fullscreen = SBDataGetBoolValue("video.fullscreen");
1158 
1159  var fullscreenItem = document.getElementById("menuitem-video-fullscreen");
1160  if(fullscreenItem) {
1161  fullscreenItem.setAttribute("checked", !disabled && fullscreen);
1162  fullscreenItem.setAttribute("disabled", disabled);
1163  }
1164 
1165  var videoToFrontItem = document.getElementById("menuitem-video-to-front");
1166  if(videoToFrontItem) {
1167  videoToFrontItem.setAttribute("disabled", disabled);
1168  }
1169 }
1170 
1171 function javascriptConsole() {
1172  window.open("chrome://global/content/console.xul", "global:console", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar,titlebar");
1173 }
1174 
1175 // Match filenames ending with .xpi or .jar
1176 function isXPI(filename) {
1177  return /\.(xpi|jar)$/i.test(filename);
1178 }
1179 
1180 // Prompt the user to install the given XPI.
1181 function installXPI(localFilename)
1182 {
1183  var inst = { xpi: localFilename };
1184  InstallTrigger.install( inst ); // "InstallTrigger" is a Moz Global. Don't grep for it.
1185  // http://developer.mozilla.org/en/docs/XPInstall_API_Reference:InstallTrigger_Object
1186 }
1187 
1188 // Install an array of XPI files.
1189 // @see extensions.js for more information
1190 function installXPIArray(aXPIArray)
1191 {
1192  InstallTrigger.install(aXPIArray);
1193 }
1194 
1201 function SBImportURLIntoMainLibrary(url) {
1202  var libraryManager = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"]
1203  .getService(Components.interfaces.sbILibraryManager);
1204 
1205  var library = libraryManager.mainLibrary;
1206 
1207  if (url instanceof Components.interfaces.nsIURI) url = url.spec;
1208  if (getPlatformString() == "Windows_NT") url = url.toLowerCase();
1209 
1210 
1211  var ioService = Components.classes["@mozilla.org/network/io-service;1"]
1212  .getService(Components.interfaces.nsIIOService);
1213 
1214  var uri = null;
1215  try {
1216  if( typeof(url.spec) == "undefined" ) {
1217  uri = ioService.newURI(url, null, null);
1218  }
1219  else {
1220  uri = url;
1221  }
1222  }
1223  catch (e) {
1224  log(e);
1225  uri = null;
1226  }
1227 
1228  if(!uri) {
1229  return null;
1230  }
1231 
1232  // skip import of the item if it already exists
1233  var mediaItem = getFirstItemByProperty(library, "http://songbirdnest.com/data/1.0#contentURL", url);
1234  if (mediaItem)
1235  return mediaItem;
1236 
1237  try {
1238  mediaItem = library.createMediaItem(uri);
1239  }
1240  catch(e) {
1241  log(e);
1242  mediaItem = null;
1243  }
1244 
1245  if(!mediaItem) {
1246  return null;
1247  }
1248 
1249  var items = Components.classes["@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
1250  .createInstance(Components.interfaces.nsIMutableArray);
1251 
1252  items.appendElement(mediaItem, false);
1253 
1254  var metadataService =
1255  Components.classes["@songbirdnest.com/Songbird/FileMetadataService;1"]
1256  .getService(Components.interfaces.sbIFileMetadataService);
1257  var metadataJob = metadataService.read(items);
1258 
1259  return mediaItem;
1260 }
1261 
1262 function SBImportURLIntoWebLibrary(url) {
1263  var library = LibraryUtils.webLibrary;
1264  var ioService = Components.classes["@mozilla.org/network/io-service;1"]
1265  .getService(Components.interfaces.nsIIOService);
1266 
1267  var uri = null;
1268  try {
1269  if( typeof(url.spec) == "undefined" ) {
1270  uri = ioService.newURI(url, null, null);
1271  }
1272  else {
1273  uri = url;
1274  }
1275  }
1276  catch (e) {
1277  log(e);
1278  uri = null;
1279  }
1280 
1281  if(!uri) {
1282  return null;
1283  }
1284 
1285  var mediaItem = null;
1286  try {
1287  mediaItem = library.createMediaItem(uri);
1288  }
1289  catch(e) {
1290  log(e);
1291  mediaItem = null;
1292  }
1293 
1294  if(!mediaItem) {
1295  return null;
1296  }
1297 
1298  var items = Components.classes["@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
1299  .createInstance(Components.interfaces.nsIMutableArray);
1300 
1301  items.appendElement(mediaItem, false);
1302 
1303  var metadataService =
1304  Components.classes["@songbirdnest.com/Songbird/FileMetadataService;1"]
1305  .getService(Components.interfaces.sbIFileMetadataService);
1306  var metadataJob = metadataService.read(items);
1307 
1308  return mediaItem;
1309 }
1310 
1311 
1312 function getFirstItemByProperty(aMediaList, aProperty, aValue) {
1313 
1314  var listener = {
1315  item: null,
1316  onEnumerationBegin: function() {
1317  },
1318  onEnumeratedItem: function(list, item) {
1319  this.item = item;
1320  return Components.interfaces.sbIMediaListEnumerationListener.CANCEL;
1321  },
1322  onEnumerationEnd: function() {
1323  }
1324  };
1325 
1326  aMediaList.enumerateItemsByProperty(aProperty,
1327  aValue,
1328  listener );
1329 
1330  return listener.item;
1331 }
1332 
1333 function toggleFullscreenVideo() {
1334  SBDataSetBoolValue("video.fullscreen", !SBDataGetBoolValue("video.fullscreen"));
1335 }
1336 
1337 function bringVideoWindowToFront() {
1338  var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
1339  .getService(Ci.nsIWindowMediator);
1340 
1341  var coreEnum = wm.getEnumerator("Songbird:Core");
1342  while(coreEnum.hasMoreElements()) {
1343  let win = coreEnum.getNext();
1344  if(win.document.documentElement.getAttribute("id") == "video_window") {
1345  win.focus();
1346  break;
1347  }
1348  }
1349 }
1350 
1351 }
1352 catch (e)
1353 {
1354  alert(e);
1355 }
const Cu
const Cc
var gMM
Definition: windowUtils.js:62
function checkForUpdates()
function getFirstItemByProperty(aMediaList, aProperty, aValue)
var Application
Definition: sbAboutDRM.js:37
function SBFormattedString(aKey, aParams, aDefault, aStringBundle)
onPageChanged aValue
Definition: FeedWriter.js:1395
function getPlatformString()
Get the name of the platform we are running on.
inArray array
function log(s)
sidebarFactory createInstance
Definition: nsSidebar.js:351
function buildHelpMenu()
var ioService
function SBDataGetStringValue(aKey)
Get the value of the data in string format.
getService(Ci.sbIFaceplateManager)
function SBString(aKey, aDefault, aStringBundle)
Definition: StringUtils.jsm:93
let window
var strings
Definition: Info.js:46
inst settings prompt
function SBDataGetBoolValue(aKey)
Get the value of the data in boolean format.
function SBDataSetBoolValue(aKey, aBoolValue)
Set a boolean value. Changes the value of the data remote to the boolean passed in, regardless of its value before.
const nsIFilePicker
var libraryManager
_inlineDatepicker inst
return null
Definition: FeedWriter.js:1143
function check(ch, cx)
function newURI(aURLString)
let node
_updateCookies aName
function url(spec)
var uri
Definition: FeedWriter.js:1135
var gTypeSniffer
Definition: windowUtils.js:71
countRef value
Definition: FeedWriter.js:1423
const Cr
let promptService
const Ci
Javascript wrappers for common library tasks.
var gServicePane
Definition: mainWinInit.js:39
var ios
Definition: head_feeds.js:5
function SBDataSetStringValue(aKey, aStringValue)
Set a string value. Changes the value of the data remote to the boolean passed in, regardless of its value before.
var theSongbirdStrings
Definition: windowUtils.js:241
var browser
Definition: openLocation.js:42
_getSelectedPageStyle s i
var file