<?xml version="1.0"?>
<?xul-overlay href="chrome://kmprefs/content/kmprefs/ovrl-urlbar.xul"?>
<!DOCTYPE overlay SYSTEM "chrome://kmprefs/locale/kmprefs/ovrl-history.dtd">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/x-javascript">
<![CDATA[
var kHistory = {

name: "history",
pref: "kmeleon.plugins.history.load",
init: function() {
	if(kPlugin.absent(this.name))
		document.getElementById(this.pref).setAttribute("hidden",true);
	else
		initCheckbox(this.pref);	
}

};

var History = {

_srvc: null,

init : function() {
	kHistory.init();
	URLBarHeight.init();

	this._srvc = Components.classes["@mozilla.org/browser/global-history;2"]
			       .getService(Components.interfaces.nsIBrowserHistory);
	var _elem,_pref;

	_pref = "browser.history_expire_days",
	_elem = document.getElementById("toggleHistory");
	_elem.checked = (pref.getIntPref(_pref));
	initTextbox(_pref,false);
	document.getElementById(_pref).disabled = !_elem.checked;

	_pref = "kmeleon.MRU.maxURLs";
	_elem = document.getElementById("mru");
	_elem.checked = (pref.getIntPref(_pref));
	initTextbox(_pref,false);
	document.getElementById(_pref).disabled = !_elem.checked;

	_pref = "kmeleon.MRU.behavior";
	initRadiogroup(_pref);
	document.getElementById(_pref).disabled = !_elem.checked;

	document.getElementById("clearHistory").disabled = !this._srvc.count;
},
clear: function() {
	this._srvc.removeAllPages();
},
toggle: function(elem) {
	if(elem.checked)
		restoreDefault(elem.nextSibling.id);
	else
		pref.setIntPref(elem.nextSibling.id,0);
	this.init();
	elem.nextSibling.focus();
}

};
//addEventListener("load",History.init,true);
]]>
</script>

<vbox id="history">
  <groupbox>
    <caption label="&history.global.label;"/>
    <hbox align="center">
      <checkbox oncommand="History.toggle(this)" id="toggleHistory" label="&history.global.keepBefore;"/>
      <textbox id="browser.history_expire_days" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
      <label value="&history.global.keepAfter;"/>
      <spacer flex="1"/>
      <button oncommand="History.clear();this.disabled=true" id="clearHistory" label="&history.global.clear;"/>
    </hbox>
    <checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.plugins.history.load" label="&history.plugin;"/>
    <separator class="thin"/>
  </groupbox>
  <separator class="thin"/>
  <groupbox>
    <caption label="&history.urlbar.label;"/>
    <hbox align="center">
      <checkbox oncommand="History.toggle(this)" id="mru" label="&history.urlbar.keepBefore;"/>
      <textbox id="kmeleon.MRU.maxURLs" size="4" class="uri-element" oninput="setIntPref(this.id,this.value)"/>
      <label value="&history.urlbar.keepAfter;"/>
    </hbox>
    <separator class="thin"/>
    <hbox id="urlbarheight"/>
    <separator class="thin"/>
    <description>&history.urlbar.descr;</description>
    <radiogroup id="kmeleon.MRU.behavior" oncommand="toggleRadiogroup(this.id)">
      <radio value="0" label="&history.urlbar.everything;"/>
      <radio value="1" label="&history.urlbar.domains;"/>
      <radio value="2" label="&history.urlbar.typed;"/>
      <radio value="3" label="&history.urlbar.nothing;"/>
    </radiogroup>
    <separator class="thin"/>
  </groupbox>
</vbox>

</overlay>