%dtdPrefs; %dtdGlobalPrefs; ]> #ifdef XP_UNIX null s from .url if requested var autopanes = (this.getAttribute('autopanes') == 'true'); if (!autopanes) { // without autopanes, we can return early: don't bother // with a navigation tree if we only have one prefpane aTreeElement.hidden = (this.preferencePanes.length < 2); if (aTreeElement.hidden) return; } // ensure that we have a tree body if (!aTreeElement.getElementsByTagName('treechildren').length) aTreeElement.appendChild(document.createElement('treechildren')); // ensure that we have a tree column if (!aTreeElement.getElementsByTagName('treecol').length) { var navcols = document.createElement('treecols'); var navcol = document.createElement('treecol'); navcol.setAttribute('id', 'navtreecol'); navcol.setAttribute('primary', true); navcol.setAttribute('flex', 1); navcol.setAttribute('hideheader', true); navcols.appendChild(navcol); aTreeElement.appendChild(navcols); aTreeElement.setAttribute('hidecolumnpicker', true); } // add the class "prefnavtree", so that themes can set defaults aTreeElement.className += ' prefnavtree'; // Do some magic with the treeitem ingredient: // - if it has a label attribute but no treerow child, // generate a treerow with a treecell child with that label // - if it has a prefpane attribute, tie it to that panel // - if still no panel found and a url attribute is present, // autogenerate the prefpane and connect to it var treeitems = aTreeElement.getElementsByTagName('treeitem'); for (var i = 0; i < treeitems.length; ++i) { var node = treeitems[i]; var label = node.getAttribute('label'); if (label) { // autocreate the treecell? var row = node.firstChild; while (row && row.nodeName != 'treerow') row = row.nextSibling; if (!row) { var itemrow = document.createElement('treerow'); var itemcell = document.createElement('treecell'); itemcell.setAttribute('label', label); itemrow.appendChild(itemcell); node.appendChild(itemrow); } } var paneID = node.getAttribute('prefpane'); var pane = paneID && document.getElementById(paneID); if (!pane && autopanes) { // if we have a url, create a for it var paneURL = node.getAttribute('url'); if (paneURL) { // reuse paneID if present, else use the url as id pane = document.createElement('prefpane'); pane.setAttribute('id', paneID || paneURL); pane.setAttribute('src', paneURL); pane.setAttribute('label', label || paneID || paneURL); var helpTopic = node.getAttribute('helpTopic'); if (helpTopic) { pane.setAttribute('helpURI', 'chrome://communicator/locale/help/suitehelp.rdf'); pane.setAttribute('helpTopic', helpTopic); } // add pane to prefwindow this.appendChild(pane); } } node.prefpane = pane; if (pane) pane.preftreeitem = node; // hide unused treeitems node.hidden = !pane; } // now that the number of s is known, try to return early: // don't bother with a navigation tree if we only have one prefpane aTreeElement.hidden = (this.preferencePanes.length < 2); if (aTreeElement.hidden) return; this._navigationTree = aTreeElement; // append any still unreferenced s to the tree's top level for (var j = 0; j < this.preferencePanes.length; ++j) { // toolkit believes in fancy pane resizing - we don't var lostpane = this.preferencePanes[j]; lostpane.setAttribute('flex', 1); if (!("preftreeitem" in lostpane)) { var treebody = this._navigationTree .getElementsByTagName('treechildren')[0]; var treeitem = document.createElement('treeitem'); var treerow = document.createElement('treerow'); var treecell = document.createElement('treecell'); var label = lostpane.getAttribute('label'); if (!label) label = lostpane.getAttribute('id'); treecell.setAttribute('label', label); treerow.appendChild(treecell); treeitem.appendChild(treerow); treebody.appendChild(treeitem); treeitem.prefpane = lostpane; lostpane.preftreeitem = treeitem; } } // Some parts of the toolkit base binding's initialization code (like // panel select events) "fire" before we get here. Thus, we may need // to sync the tree manually now (again), if we added any panels or // if toolkit failed to select one. // (This is a loose copy from the toolkit ctor.) var lastPane = this.lastSelected && document.getElementById(this.lastSelected); if (!lastPane) this.lastSelected = ""; if ("arguments" in window && window.arguments[0]) { var initialPane = document.getElementById(window.arguments[0]); if (initialPane && initialPane.nodeName == "prefpane") { this.currentPane = initialPane; this.lastSelected = initialPane.id; } } else if (lastPane) this.currentPane = lastPane; try { this.showPane(this.currentPane); // may need to load it first this.syncTreeWithPane(this.currentPane, true); } catch (e) { dump('***** broken prefpane: ' + this.currentPane.id + '\n' + e + '\n'); } ]]> #ifndef XP_MACOSX #endif = 0)) { // load the prefpane associated with this treeitem var treeitem = this._navigationTree.contentView .getItemAtIndex(aTreeIndex); if ('prefpane' in treeitem) { pane = treeitem.prefpane; if (pane && (this.currentPane != pane)) { try { this.showPane(pane); // may need to load it first } catch (e) { dump('***** broken prefpane: ' + pane.id + '\n' + e + '\n'); pane = null; } } } } // don't show broken panels this._paneDeck.hidden = (pane == null); this.setPaneTitle(pane); ]]> window.innerHeight) window.innerHeight = this.scrollHeight; if (this.scrollWidth > window.innerWidth) window.innerWidth = this.scrollWidth; } ]]> s now share the same global document, their //