importMediaPrefs.js
Go to the documentation of this file.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2009 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27  */
28 
34 //------------------------------------------------------------------------------
35 //
36 // Import media preference pane services defs.
37 //
38 //------------------------------------------------------------------------------
39 
40 // Component manager defs.
41 if (typeof(Cc) == "undefined")
42  var Cc = Components.classes;
43 if (typeof(Ci) == "undefined")
44  var Ci = Components.interfaces;
45 if (typeof(Cr) == "undefined")
46  var Cr = Components.results;
47 if (typeof(Cu) == "undefined")
48  var Cu = Components.utils;
49 
50 // DOM defs.
51 if (typeof(XUL_NS) == "undefined")
52  var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
53 
54 
55 //------------------------------------------------------------------------------
56 //------------------------------------------------------------------------------
57 //
58 // Import media preference pane services.
59 //
60 //------------------------------------------------------------------------------
61 //------------------------------------------------------------------------------
62 
63 var importMediaPrefsPane = {
64  //----------------------------------------------------------------------------
65  //
66  // Event handling services.
67  //
68  //----------------------------------------------------------------------------
69 
76  doPaneLoad: function importMediaPrefs_doPaneLoad(aEvent) {
77  // Forward the event to all import media preference tab panels.
78  var tabPanelsElem = document.getElementById("import_media_tabpanels");
79  var tabPanelList = tabPanelsElem.getElementsByTagNameNS(XUL_NS, "tabpanel");
80  for (var i = 0; i < tabPanelList.length; i++) {
81  var tabPanel = tabPanelList[i];
82  this._fireEvent(tabPanel, aEvent.type, aEvent.bubbles, aEvent.cancelable);
83  }
84  var tabBox = document.getElementById("import_media_tabbox");
85  if (tabBox.hasAttribute("selectedIndex")) {
86  tabBox.selectedIndex = tabBox.getAttribute("selectedIndex");
87  }
88  },
89 
90 
91  //----------------------------------------------------------------------------
92  //
93  // Internal services.
94  //
95  //----------------------------------------------------------------------------
96 
108  _fireEvent: function importMediaPrefs__fireEvent(aTarget,
109  aEventType,
110  aBubbles,
111  aCancelable) {
112  // Report any exceptions from firing event.
113  try {
114  // Create and initialized the event.
115  var event = document.createEvent("Events");
116  event.initEvent(aEventType, aBubbles, aCancelable);
117 
118  // Dispatch the event to the target.
119  var cancel = !aTarget.dispatchEvent(event);
120 
121  // Dispatch the event to the target attribute event handler.
122  var eventHandlerAttrName = "on" + aEventType;
123  if (aTarget.hasAttribute(eventHandlerAttrName)) {
124  var func = new Function("event",
125  aTarget.getAttribute(eventHandlerAttrName));
126  var result = func.call(aTarget, event);
127  if (result == false)
128  cancel = true;
129  }
130 
131  return !cancel;
132  } catch (ex) {
133  Cu.reportError(ex);
134  }
135 
136  return false;
137  }
138 }
139 
const Cu
const Cc
const XUL_NS
Definition: FeedWriter.js:83
var event
const Cr
const Ci
_getSelectedPageStyle s i