Add reload and stop sidebar tab header context menu items.

b=41445; r=morse; sr=alecf
This commit is contained in:
sgehani%netscape.com 2006-07-27 14:56:22 +00:00
parent c750007682
commit 06aca86c28
3 changed files with 67 additions and 24 deletions

View File

@ -316,7 +316,9 @@ function (force_reload)
} else { } else {
var saved_src = iframe.getAttribute('content'); var saved_src = iframe.getAttribute('content');
var src = iframe.getAttribute('src'); var src = iframe.getAttribute('src');
if (saved_src != src) { // either we have been requested to force_reload or the
// panel src has changed so we must restore the original src
if (force_reload || (saved_src != src)) {
debug(" set src="+saved_src); debug(" set src="+saved_src);
iframe.setAttribute('src', saved_src); iframe.setAttribute('src', saved_src);
@ -325,7 +327,6 @@ function (force_reload)
gCurFrame = iframe; gCurFrame = iframe;
gTimeoutID = setTimeout (setBlank, 20000); gTimeoutID = setTimeout (setBlank, 20000);
} }
} }
@ -904,6 +905,11 @@ function SidebarStopPanelLoad(header) {
panel.stop_load(); panel.stop_load();
} }
function SidebarReloadPanel(header) {
var panel = sidebarObj.panels.get_panel_from_header_node(header);
panel.reload();
}
// No one is calling this right now. // No one is calling this right now.
function SidebarReload() { function SidebarReload() {
sidebarObj.panels.refresh(); sidebarObj.panels.refresh();
@ -1184,6 +1190,33 @@ function SidebarFinishClick() {
} }
} }
function SidebarInitContextMenu(aMenu, aPopupNode)
{
var panel = sidebarObj.panels.get_panel_from_header_node(aPopupNode);
var switchItem = document.getElementById("switch-ctx-item");
var reloadItem = document.getElementById("reload-ctx-item");
var stopItem = document.getElementById("stop-ctx-item");
// the current panel can be reloaded, but other panels are not showing
// any content, so we only allow you to switch to other panels
if (panel.is_selected())
{
switchItem.setAttribute("collapsed", "true");
reloadItem.removeAttribute("disabled");
}
else
{
switchItem.removeAttribute("collapsed");
reloadItem.setAttribute("disabled", "true");
}
// only if a panel is currently loading enable the ``Stop'' item
if (panel.get_iframe().getAttribute("loadstate") == "loading")
stopItem.removeAttribute("disabled");
else
stopItem.setAttribute("disabled", "true");
}
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// Handy Debug Tools // Handy Debug Tools
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////

View File

@ -34,16 +34,24 @@
<command id="toggleSidebar" oncommand="SidebarShowHide();"/> <command id="toggleSidebar" oncommand="SidebarShowHide();"/>
<key id="showHideSidebar" keycode="VK_F9" command="toggleSidebar"/> <key id="showHideSidebar" keycode="VK_F9" command="toggleSidebar"/>
<popup id="sidebarPopup" onpopupshowing="if (sidebarObj.panels.get_panel_from_header_node(document.popupNode).is_selected()) <popup id="sidebarPopup"
this.firstChild.setAttribute('collapsed', 'true'); onpopupshowing="SidebarInitContextMenu(this, document.popupNode);">
else <menuitem id="switch-ctx-item" label="&sidebar.switch.label;"
this.firstChild.removeAttribute('collapsed');"> accesskey="&sidebar.switch.accesskey;" default="true"
<menuitem label="&sidebar.switch.label;" accesskey="&sidebar.switch.accesskey;" oncommand="SidebarSelectPanel(document.popupNode,false,false);"/>
default="true" oncommand="SidebarSelectPanel(document.popupNode, false, false);"/> <menuitem id="reload-ctx-item" label="&sidebar.reload.label;"
<menuitem label="&sidebar.hide.label;" accesskey="&sidebar.hide.accesskey;" accesskey="&sidebar.reload.accesskey;" disabled="true"
oncommand="SidebarReloadPanel(document.popupNode);"/>
<menuitem id="stop-ctx-item" label="&sidebar.loading.stop.label;"
accesskey="&sidebar.loading.stop.accesskey;" disabled="true"
oncommand="SidebarStopPanelLoad(document.popupNode);"/>
<menuseparator/>
<menuitem id="hide-ctx-item" label="&sidebar.hide.label;"
accesskey="&sidebar.hide.accesskey;"
oncommand="SidebarTogglePanel(document.popupNode);"/> oncommand="SidebarTogglePanel(document.popupNode);"/>
<menuseparator/> <menuseparator/>
<menuitem label="&sidebar.customize.label;" accesskey="&sidebar.customize.accesskey;" <menuitem id="customize-ctx-item" label="&sidebar.customize.label;"
accesskey="&sidebar.customize.accesskey;"
oncommand="SidebarCustomize();"/> oncommand="SidebarCustomize();"/>
</popup> </popup>

View File

@ -21,20 +21,22 @@
- Samir Gehani <sgehani@netscape.com> - Samir Gehani <sgehani@netscape.com>
--> -->
<!ENTITY sidebar.panels.label "Sidebar"> <!ENTITY sidebar.panels.label "Sidebar">
<!ENTITY sidebar.reload.label "Reload"> <!ENTITY sidebar.reload.label "Reload">
<!ENTITY sidebar.picker.label "Tabs"> <!ENTITY sidebar.reload.accesskey "R">
<!ENTITY sidebar.customize.label "Customize Sidebar..."> <!ENTITY sidebar.picker.label "Tabs">
<!ENTITY sidebar.customize.accesskey "u"> <!ENTITY sidebar.customize.label "Customize Sidebar...">
<!ENTITY sidebar.hide.label "Hide Panel"> <!ENTITY sidebar.customize.accesskey "u">
<!ENTITY sidebar.hide.accesskey "H"> <!ENTITY sidebar.hide.label "Hide Tab">
<!ENTITY sidebar.switch.label "Switch to Panel"> <!ENTITY sidebar.hide.accesskey "H">
<!ENTITY sidebar.switch.accesskey "S"> <!ENTITY sidebar.switch.label "Switch to Tab">
<!ENTITY sidebarCmd.label "Sidebar"> <!ENTITY sidebar.switch.accesskey "T">
<!ENTITY sidebarCmd.accesskey "b"> <!ENTITY sidebarCmd.label "Sidebar">
<!ENTITY sidebar.loading.label "Loading..."> <!ENTITY sidebarCmd.accesskey "b">
<!ENTITY sidebar.loadstopped.label "Load stopped"> <!ENTITY sidebar.loading.label "Loading...">
<!ENTITY sidebar.loading.stop.label "Stop"> <!ENTITY sidebar.loadstopped.label "Load stopped">
<!ENTITY sidebar.loading.stop.label "Stop">
<!ENTITY sidebar.loading.stop.accesskey "S">
<!ENTITY sidebar.no-panels.state "The sidebar is currently empty."> <!ENTITY sidebar.no-panels.state "The sidebar is currently empty.">
<!ENTITY sidebar.no-panels.add 'You may add tabs by clicking on the "Tabs" button above.'> <!ENTITY sidebar.no-panels.add 'You may add tabs by clicking on the "Tabs" button above.'>