<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/"?>
<?xml-stylesheet type="text/css" href="chrome://kmprefs/skin/"?>
<?xul-overlay href="chrome://kmprefs/content/kmprefs/ovrl-urlbar.xul"?>
<?xul-overlay href="chrome://kmprefs/content/kmprefs/ovrl-tabbar.xul"?>
<?xul-overlay href="chrome://kmprefs/content/kplugins/bookmarksbar.xul"?>
<?xul-overlay href="chrome://kmprefs/content/kplugins/favoritesbar.xul"?>
<?xul-overlay href="chrome://kmprefs/content/kplugins/hotlistbar.xul"?>
<!DOCTYPE page SYSTEM "chrome://kmprefs/locale/pref-toolbars.dtd">
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
id="prefToolbars" onload="init()">

<stringbundle id="pref_bundle" src="chrome://kmprefs/locale/pref.properties"/>

<script type="application/x-javascript" src="chrome://kmprefs/content/pref.js"/>
<script type="application/x-javascript">
<![CDATA[
function init() {
	var kplugins = new Array("toolbars","rebarmenu");

	for(var j=0;j<kplugins.length;j++) {
		document.getElementById("kmeleon.plugins."+kplugins[j]+".load").checked  = kPlugin.load(kplugins[j]);
		document.getElementById("kmeleon.plugins."+kplugins[j]+".load").disabled = kPlugin.absent(kplugins[j]);
	}
	Alltoolbars.init();
	Title.init();
	Menu.init();
	URLBarHeight.init();
	TabBar.init();
	kBookmarksBar.init();
	kFavoritesBar.init();
	kHotlistBar.init();
}

var Alltoolbars = {

pref: "kmeleon.display.toolbars_line",
init: function() {
	initCheckbox(this.pref);
}

};

var Title = {

pref: "kmeleon.display.URLbarTitle",
init: function() {
	initTextbox(this.pref,document.getElementById("pref_bundle").getString("toolbar_title_none"));
}

};

var Menu = {

pref: "kmeleon.toolband.Menu.visibility",
init: function() {
	this.elem = document.getElementById(this.pref);
	this._im1 = "user_pref(\"kmeleon.toolband.Menu.visibility\", ";
	this._im2 = ");";
	this._rx1 = "user_pref[\\s]*\\([\\s]*.kmeleon.toolband.Menu.visibility.[\\s]*,[\\s]*";
	this._rx2 = "[\\s]*\\)[\\s]*;";
	this._Import = new Array(this._im1+"false"+this._im2,this._im1+"true"+this._im2);
	this._RegExp = new Array(this._rx1+"false"+this._rx2,this._rx1+"true"+this._rx2);

	var txt = getFileContents(UserPrefs);

	if(testMultiline(txt,this._RegExp[0]))
		this.elem.checked = true;
	else
		if(testMultiline(txt,this._RegExp[1]))
			this.elem.checked = false;
		else {
			initCheckbox(this.pref);
			this.elem.checked = !this.elem.checked;
		}
	this.elem.disabled = !kPlugin.load("rebarmenu");
},
toggle: function() {
	removeFromFile(UserPrefs,this._RegExp[0]);
	removeFromFile(UserPrefs,this._RegExp[1]);

	if(this.elem.checked)
		addToUserPrefs(this._Import[0]);
	else
		pref.setBoolPref(this.pref,true);
	this.init();
}

};
]]>
</script>

<vbox flex="1" style="overflow:auto">
  <dialogheader title="&toolbars.header;"/>
  <separator class="thin"/>
  <tabcontrol flex="1">
    <tabbox flex="1">
      <tabs>
        <tab label="&general;"/>
        <tab id="TabBarTab"/>
        <tab id="kBookmarksTBarTab"/>
        <tab id="kFavoritesTBarTab"/>
        <tab id="kHotlistTBarTab"/>
      </tabs>
      <tabpanels flex="1">
        <tabpanel flex="1" orient="vertical" style="overflow:auto">
<!-- Main Toolbar -->
<separator class="thin"/>
<checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.plugins.toolbars.load" label="&toolbars.enable;"/>
<separator class="thick"/>
<separator class="groove"/>
<checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.display.toolbars_line" inverse="true" label="&toolbars.hideLines;"/>
<separator class="thick"/>
<groupbox flex="1">
<caption><label>&toolbars.urltoolbar.label;</label></caption>
<hbox align="center">
  <description>&toolbars.URLBarTitle;</description>
  <textbox id="kmeleon.display.URLbarTitle" flex="1" class="uri-element" oninput="setCharPref(this.id,this.value)"/>
  <button label="&clear;" oncommand="pref.setCharPref(this.previousSibling.id,'');Title.init()"/>
  <button label="&restoreDefault;" oncommand="restoreDefault(this.previousSibling.previousSibling.id);Title.init()"/>
</hbox>
<separator class="thin"/>
<hbox id="urlbarheight"/>
</groupbox>
<separator class="thick"/>
<groupbox flex="1">
<caption><label>&toolbars.menutoolbar.label;</label></caption>
<checkbox oncommand="toggleCheckbox(this.id);this.nextSibling.disabled=!this.checked" id="kmeleon.plugins.rebarmenu.load" label="&toolbars.menuAsToolbar;"/>
<checkbox oncommand="Menu.toggle()" id="kmeleon.toolband.Menu.visibility" label="&toolbars.menuHide;" style="margin-left:2em"/>
</groupbox>
<separator class="thick"/>
<vbox flex="1"/>
<description>&restartNote1;</description>
<!-- Main Toolbar -->
	</tabpanel>
        <tabpanel id="TabBar"/>
        <tabpanel id="kBookmarksTBar"/>
        <tabpanel id="kFavoritesTBar"/>
        <tabpanel id="kHotlistTBar"/>
      </tabpanels>
    </tabbox>
  </tabcontrol>
</vbox>

</page>