зеркало из https://github.com/mozilla/pjs.git
bugs 195213, 202174. no content in sidebar on uncollapsing when collapsed on startup, make sidebar deal with missing panels. r=sgehani, sr=jag
This commit is contained in:
Родитель
bf0737459e
Коммит
30cba0d5b4
|
@ -43,6 +43,7 @@ var gCurFrame;
|
|||
var gTimeoutID = null;
|
||||
var gMustInit = true;
|
||||
var gAboutToUncollapse = false;
|
||||
var gCheckMissingPanels = true;
|
||||
|
||||
function setBlank()
|
||||
{
|
||||
|
@ -771,10 +772,6 @@ function sidebar_overlay_init() {
|
|||
debug("Showing the panels splitter");
|
||||
sidebar_panels_splitter.removeAttribute('hidden');
|
||||
}
|
||||
var panels = document.getElementById('sidebar-panels');
|
||||
panels.database.AddDataSource(RDF.GetDataSource(sidebarObj.datasource_uri));
|
||||
panels.database.AddObserver(panel_observer);
|
||||
panels.setAttribute('ref', sidebarObj.resource);
|
||||
}
|
||||
if (sidebar_is_collapsed()) {
|
||||
sidebarObj.collapsed = true;
|
||||
|
@ -805,8 +802,16 @@ function sidebar_open_default_panel(wait, tries) {
|
|||
var panelListRes = RDF.GetResource("http://home.netscape.com/NC-rdf#panel-list");
|
||||
var container = ds.GetTarget(currentListRes, panelListRes, true);
|
||||
if (container) {
|
||||
sidebarObj.panels.initialized = false;
|
||||
var panels = document.getElementById("sidebar-panels");
|
||||
// Add the user's current panel choices to the template builder,
|
||||
// which will aggregate it with the other datasources that describe
|
||||
// the individual panel's title, customize URL, and content URL.
|
||||
var panels = document.getElementById('sidebar-panels');
|
||||
panels.database.AddDataSource(ds);
|
||||
|
||||
debug("Adding observer to database.");
|
||||
panels.database.AddObserver(panel_observer);
|
||||
|
||||
// XXX This is a hack to force re-display
|
||||
panels.builder.rebuild();
|
||||
} else {
|
||||
if (tries < 3) {
|
||||
|
@ -821,6 +826,8 @@ function sidebar_open_default_panel(wait, tries) {
|
|||
|
||||
sidebarObj.panels.refresh();
|
||||
gBusyOpeningDefault = false;
|
||||
if (gCheckMissingPanels)
|
||||
check_for_missing_panels();
|
||||
}
|
||||
|
||||
function SidebarRebuild() {
|
||||
|
@ -830,6 +837,39 @@ function SidebarRebuild() {
|
|||
sidebar_open_default_panel(100, 0);
|
||||
}
|
||||
|
||||
const NS_ERROR_FILE_NOT_FOUND = 0x80520012;
|
||||
|
||||
function check_for_missing_panels() {
|
||||
var tabs = sidebarObj.panels.node.childNodes;
|
||||
var currHeader;
|
||||
var currTab;
|
||||
for (var i = 2; i < tabs.length; i += 2) {
|
||||
currHeader = tabs[i];
|
||||
currTab = new sbPanel(currHeader.getAttribute("id"), currHeader, i);
|
||||
if (!currTab.is_excluded()) {
|
||||
if (currHeader.hasAttribute("prereq") && currHeader.getAttribute("prereq") != "") {
|
||||
var prereq_file = currHeader.getAttribute("prereq");
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ioService.newURI(prereq_file, null, null);
|
||||
var channel = ioService.newChannelFromURI(uri);
|
||||
try {
|
||||
channel.open();
|
||||
}
|
||||
catch(ex if (ex.result == NS_ERROR_FILE_NOT_FOUND)) {
|
||||
sidebarObj.datasource = RDF.GetDataSource(sidebarObj.datasource_uri);
|
||||
sidebarObj.datasource.Assert(RDF.GetResource(currHeader.getAttribute("id")),
|
||||
RDF.GetResource(NC + "exclude"),
|
||||
RDF.GetLiteral(sidebarObj.component),
|
||||
true);
|
||||
currTab.exclude();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gCheckMissingPanels = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Sidebar File and Datasource functions
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
@ -1491,7 +1531,6 @@ function SidebarFinishClick() {
|
|||
if (is_collapsed != sidebarObj.collapsed) {
|
||||
if (gMustInit)
|
||||
sidebar_overlay_init();
|
||||
setTimeout("sidebarObj.panels.refresh();",100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,10 +90,13 @@
|
|||
<binding subject="?panel"
|
||||
predicate="http://home.netscape.com/NC-rdf#exclude"
|
||||
object="?exclude"/>
|
||||
<binding subject="?panel"
|
||||
predicate="http://home.netscape.com/NC-rdf#prereq"
|
||||
object="?prereq"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<menuitem uri="?panel" type="checkbox"
|
||||
label="?title" exclude="?exclude"/>
|
||||
label="?title" exclude="?exclude" prereq="?prereq"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
|
@ -111,7 +114,7 @@
|
|||
<vbox id="sidebar-panels"
|
||||
datasources="rdf:null"
|
||||
ref="urn:sidebar:current-panel-list"
|
||||
persist="last-selected-panel height collapsed" flex="1*"
|
||||
persist="last-selected-panel height collapsed" flex="1"
|
||||
onclick="return contentAreaClick(event);"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, contentAreaDNDObserver);">
|
||||
<template id="sidebar-template">
|
||||
|
@ -129,13 +132,15 @@
|
|||
<bindings>
|
||||
<binding subject="?panel" object="?exclude"
|
||||
predicate="http://home.netscape.com/NC-rdf#exclude" />
|
||||
<binding subject="?panel" object="?prereq"
|
||||
predicate="http://home.netscape.com/NC-rdf#prereq" />
|
||||
</bindings>
|
||||
<action>
|
||||
<hbox uri="?panel" class="box-texttab texttab-sidebar"
|
||||
oncommand="SidebarSelectPanel(this,false,false)"
|
||||
hidden="true" label="?title" exclude="?exclude"
|
||||
context="sidebarPopup"/>
|
||||
<vbox uri="?panel" flex="1*" hidden="true"
|
||||
prereq="?prereq" context="sidebarPopup"/>
|
||||
<vbox uri="?panel" flex="1" hidden="true"
|
||||
loadstate="never loaded">
|
||||
<vbox flex="1" class="iframe-panel loadarea">
|
||||
<hbox flex="1" align="center">
|
||||
|
@ -152,9 +157,9 @@
|
|||
</hbox>
|
||||
<spacer flex="100%"/>
|
||||
</vbox>
|
||||
<browser flex="1*" class="browser-sidebar" src="about:blank"
|
||||
<browser flex="1" class="browser-sidebar" src="about:blank"
|
||||
hidden="true" collapsed="true" content="?content"/>
|
||||
<browser flex="1*" class="browser-sidebar" src="about:blank"
|
||||
<browser flex="1" class="browser-sidebar" src="about:blank"
|
||||
hidden="true" collapsed="true" content="?content" type="content" context="contentAreaContextMenu"/>
|
||||
</vbox>
|
||||
</action>
|
||||
|
|
Загрузка…
Ссылка в новой задаче