Combine clear global history and clear location bar history prefs.

This commit is contained in:
blakeross%telocity.com 2002-08-05 21:46:55 +00:00
parent f650dbcdba
commit ec3e5b629f
2 changed files with 7 additions and 48 deletions

View File

@ -37,26 +37,17 @@
function Startup()
{
var urlbarHistButton = document.getElementById("ClearUrlBarHistoryButton");
var clearHistButton = document.getElementById("browserClearHistory");
try {
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
.getService(Components.interfaces.nsIUrlbarHistory);
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(urlbarHistButton.getAttribute("prefstring"));
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var lastUrl = pref.getComplexValue("general.open_location.last_url",
Components.interfaces.nsISupportsWString).data;
urlbarHistButton.disabled = ( urlBarHist.count == 0 && !lastUrl ) || isBtnLocked ;
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(clearHistButton.getAttribute("prefstring"));
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
.getService(Components.interfaces.nsIBrowserHistory);
clearHistButton.disabled = ( urlBarHist.count == 0 && globalHistory.count == 0) || isBtnLocked;
}
catch(ex) {
}
var globalHistButton = document.getElementById("browserClearHistory");
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
.getService(Components.interfaces.nsIBrowserHistory);
if (globalHistory.count == 0)
globalHistButton.disabled = true;
}
function prefClearGlobalHistory()
@ -64,22 +55,9 @@
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
.getService(Components.interfaces.nsIBrowserHistory);
globalHistory.removeAllPages();
}
function prefClearUrlbarHistory()
{
var button = document.getElementById("ClearUrlBarHistoryButton");
var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
.getService(Components.interfaces.nsIUrlbarHistory);
urlBarHistory.clearHistory();
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = "";
pref.setComplexValue("general.open_location.last_url",
Components.interfaces.nsISupportsWString,
str);
}
]]>
</script>
@ -99,18 +77,5 @@
prefstring="pref.browser.history.disable_button.clear_hist"/>
</hbox>
</groupbox>
<!-- no honey, I haven't been viewing porn, honest! -->
<groupbox>
<caption label="&locationBarHistory.label;"/>
<hbox align="center">
<description flex="1">&clearLocationBar.label;</description>
<hbox align="center" pack="end">
<button id="ClearUrlBarHistoryButton" label="&clearLocationBarButton.label;" accesskey="&clearLocationBarButton.accesskey;"
oncommand="prefClearUrlbarHistory(); this.disabled = true;"
prefstring="pref.browser.history.disable_button.clear_urlbar"/>
</hbox>
</hbox>
</groupbox>
</page>

View File

@ -7,9 +7,3 @@
<!ENTITY days.label "days">
<!ENTITY clearHistory.label "Clear History">
<!ENTITY clearHistory.accesskey "r">
<!ENTITY locationBarHistory.label "Location Bar History">
<!ENTITY clearLocationBar.label "Clear the list of sites stored in the location bar menu.">
<!ENTITY clearLocationBarButton.label "Clear Location Bar">
<!ENTITY clearLocationBarButton.accesskey "b">