home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / komunikace / kmeleon / K-Meleon1.1.3en-US.exe / chrome / embed.jar / kmprefs / content / pref.xul < prev   
Extensible Markup Language  |  2007-04-23  |  9KB  |  244 lines

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://communicator/skin/"?>
  3. <!DOCTYPE dialog SYSTEM "chrome://kmprefs/locale/pref.dtd">
  4. <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  5. id="prefDialog" title="&prefDialog.title;" 
  6. style="&prefDialog.style;" contextmenu="0" 
  7. buttons="cancel,extra1,extra2" 
  8. buttonlabelcancel="&prefDialog.close.label;" 
  9. buttonaccesskeycancel="&prefDialog.close.ackey;" 
  10. ondialogcancel="closePrefDialog()" 
  11. buttonlabelextra1="&prefDialog.next.label; >" 
  12. buttonaccesskeyextra1="&prefDialog.next.ackey;" 
  13. ondialogextra1="nextItem()" 
  14. buttonlabelextra2="< &prefDialog.prev.label;" 
  15. buttonaccesskeyextra2="&prefDialog.prev.ackey;" 
  16. ondialogextra2="prevItem()" 
  17. persist="screenX screenY width height">
  18.  
  19. <stringbundle id="pref_bundle" src="chrome://kmprefs/locale/pref.properties"/>
  20. <stringbundle id="kplugin_bundle" src="chrome://kmprefs/locale/kplugins/kplugins.properties"/>
  21.  
  22. <script type="application/x-javascript" src="chrome://kmprefs/content/pref.js"/>
  23. <script type="application/x-javascript">
  24. <![CDATA[
  25. var ifrm, page, tree, url;
  26. function init() {
  27.     var kplugins = new Array("bookmarks","favorites","hotlist","layers","macros","gestures"), elem;
  28.     for(var j=0;j<kplugins.length;j++)
  29.         if(kPlugin.absent(kplugins[j]))
  30.             document.getElementById("kplugins_children").removeChild(document.getElementById(kplugins[j]));
  31.     if(!kPlugin.load("macros") || !kMacrosModule.load("hotlink")) {
  32.         elem = document.getElementById("hotlinks");
  33.         elem.parentNode.removeChild(elem);
  34.     }
  35.     if(kPlugin.load("macros") && !kMacrosModule.load("main")) {
  36.         elem = document.getElementById("macros");
  37.         elem.parentNode.removeChild(elem);
  38.     }
  39.     ifrm = document.getElementById("panelFrame");
  40.     page = document.location.search;
  41.     page = (page) ? page.substring(1,page.length) : "browsing";
  42.     url = "chrome://kmprefs/content/pref-" + page + ".xul";
  43.     ifrm.setAttribute("src",url);
  44.     tree = document.getElementById("prefTree");
  45.     initTree(0);
  46. }
  47. function closePrefDialog() {
  48.     try {
  49.         Components.classes["@mozilla.org/preferences-service;1"]
  50.               .getService(Components.interfaces.nsIPrefService)
  51.               .savePrefFile(null);
  52.     } catch (e) {}
  53.     this.close();
  54. }
  55. function nextItem() {
  56.     openTree();
  57.     var index = tree.currentIndex;
  58.     if (++index < document.getElementsByTagName("treeitem").length)
  59.         tree.view.selection.select(index);
  60. }
  61. function prevItem() {
  62.     openTree();
  63.     var index = tree.currentIndex;
  64.     if (--index > -1)
  65.         tree.view.selection.select(index);
  66. }
  67. function initTree(oldCnt) {
  68.     var items = document.getElementsByTagName("treeitem");
  69.     var newCnt = items.length;
  70.     if((newCnt) && (newCnt == oldCnt)) {
  71.         var item = document.getElementById(page);
  72.         if(item)
  73.             openBranch(item.parentNode.parentNode,item);
  74.         else
  75.             for(var j=0;j<newCnt;j++)
  76.                 if(items[j].firstChild.firstChild.getAttribute("url")==url)
  77.                     openBranch(items[j].parentNode.parentNode,items[j]);
  78.         if(!document.location.search)
  79.             openTree();
  80.     } else
  81.         setTimeout("initTree("+newCnt+")",100);
  82. }
  83. function openTree() {
  84.     var items = document.getElementsByTagName("treeitem");
  85.     for(var j=0,index;j<items.length;j++) {
  86.         index = tree.contentView.getIndexOfItem(items[j]);
  87.     if(index != -1 && !tree.view.isContainerOpen(index))
  88.         tree.view.toggleOpenState(index);
  89.     }
  90. }
  91. function openBranch(selectItemroot,selectItem) {
  92.     var parentIndex = tree.contentView.getIndexOfItem(selectItemroot);
  93.     if(parentIndex > -1 && !tree.view.isContainerOpen(parentIndex))
  94.         tree.view.toggleOpenState(parentIndex);
  95.     var index = tree.view.getIndexOfItem(selectItem);
  96.     if(index > -1) {
  97.         tree.view.selection.select(index);
  98.         if(!tree.view.isContainerOpen(index))
  99.             tree.view.toggleOpenState(index);
  100.     }
  101. }
  102. function switchPage() {
  103.     var item = tree.contentView.getItemAtIndex(tree.currentIndex);
  104.     var src = ifrm.getAttribute("src");
  105.     var url = item.firstChild.firstChild.getAttribute("url");
  106.     if(url!=src) {
  107.         ifrm.setAttribute("src",url);
  108.         panelFrame.location.replace(url);
  109.     }
  110. }
  111. ]]>
  112. </script>
  113.  
  114.  
  115. <hbox flex="1">
  116.   <vbox>
  117.     <label value="&category.label;" accesskey="&category.ackey;" control="prefTree"/>
  118.     <tree id="prefTree" style="&prefTree.width;" flex="1" seltype="single" hidecolumnpicker="true" onselect="switchPage();">
  119.       <treecols><treecol flex="1" primary="true" hideheader="true"/></treecols>
  120.       <treechildren>
  121.  
  122.         <treeitem id="appearance" container="true">
  123.           <treerow>
  124.             <treecell url="chrome://kmprefs/content/pref-appearance.xul" label="&appearance.label;"/>
  125.           </treerow>
  126.           <treechildren>
  127.             <treeitem id="toolbars">
  128.               <treerow>
  129.                 <treecell url="chrome://kmprefs/content/pref-toolbars.xul" label="&toolbars.label;"/>
  130.               </treerow>
  131.             </treeitem>
  132.           </treechildren>
  133.         </treeitem>
  134.  
  135.         <treeitem id="display" container="true">
  136.           <treerow>
  137.             <treecell url="chrome://kmprefs/content/pref-display.xul" label="&display.label;"/>
  138.           </treerow>
  139.           <treechildren>
  140.             <treeitem id="filters">
  141.               <treerow>
  142.                 <treecell url="chrome://kmprefs/content/pref-filters.xul" label="&filters.label;"/>
  143.               </treerow>
  144.             </treeitem>
  145.           </treechildren>
  146.         </treeitem>
  147.  
  148.         <treeitem id="browsing" container="true">
  149.           <treerow>
  150.             <treecell url="chrome://kmprefs/content/pref-browsing.xul" label="&browsing.label;"/>
  151.           </treerow>
  152.           <treechildren>
  153.             <treeitem id="filetypes">
  154.               <treerow>
  155.                 <treecell url="chrome://kmprefs/content/pref-filetypes.xul" label="&filetypes.label;"/>
  156.               </treerow>
  157.             </treeitem>
  158.             <treeitem id="webfind">
  159.               <treerow>
  160.                 <treecell url="chrome://kmprefs/content/pref-webfind.xul" label="&webfind.label;"/>
  161.               </treerow>
  162.             </treeitem>
  163.             <treeitem id="history">
  164.               <treerow>
  165.                 <treecell url="chrome://kmprefs/content/pref-history.xul" label="&history.label;"/>
  166.               </treerow>
  167.             </treeitem>
  168.             <treeitem id="hotlinks">
  169.               <treerow>
  170.                 <treecell url="chrome://kmprefs/content/pref-hotlinks.xul" label="&hotlinks.label;"/>
  171.               </treerow>
  172.             </treeitem>
  173.           </treechildren>
  174.         </treeitem>
  175.  
  176.         <treeitem id="privacy" container="true">
  177.           <treerow>
  178.             <treecell url="chrome://kmprefs/content/pref-privacy.xul" label="&privacy.label;"/>
  179.           </treerow>
  180.           <treechildren>
  181.             <treeitem id="encryption">
  182.               <treerow>
  183.                 <treecell url="chrome://kmprefs/content/pref-encryption.xul" label="&encryption.label;"/>
  184.               </treerow>
  185.             </treeitem>
  186.           </treechildren>
  187.         </treeitem>
  188.  
  189.         <treeitem id="javascript">
  190.           <treerow>
  191.             <treecell url="chrome://kmprefs/content/pref-javascript.xul" label="&javascript.label;"/>
  192.           </treerow>
  193.         </treeitem>
  194.  
  195.         <treeitem id="kplugins" container="true">
  196.           <treerow>
  197.             <treecell url="chrome://kmprefs/content/pref-kplugins.xul" label="&kplugins.label;"/>
  198.           </treerow>
  199.           <treechildren id="kplugins_children">
  200.             <treeitem id="bookmarks">
  201.               <treerow>
  202.                 <treecell url="chrome://kmprefs/content/pref-kbookmarks.xul" label="&kbookmarks.label;"/>
  203.               </treerow>
  204.             </treeitem>
  205.             <treeitem id="favorites">
  206.               <treerow>
  207.                 <treecell url="chrome://kmprefs/content/pref-kfavorites.xul" label="&kfavorites.label;"/>
  208.               </treerow>
  209.             </treeitem>
  210.             <treeitem id="hotlist">
  211.               <treerow>
  212.                 <treecell url="chrome://kmprefs/content/pref-khotlist.xul" label="&khotlist.label;"/>
  213.               </treerow>
  214.             </treeitem>
  215.             <treeitem id="layers">
  216.               <treerow>
  217.                 <treecell url="chrome://kmprefs/content/pref-klayers.xul" label="&klayers.label;"/>
  218.               </treerow>
  219.             </treeitem>
  220.             <treeitem id="macros">
  221.               <treerow>
  222.                 <treecell url="chrome://kmprefs/content/pref-kmacros.xul" label="&kmacros.label;"/>
  223.               </treerow>
  224.             </treeitem>
  225.             <treeitem id="gestures">
  226.               <treerow>
  227.                 <treecell url="chrome://kmprefs/content/pref-kgestures.xul" label="&kgestures.label;"/>
  228.               </treerow>
  229.             </treeitem>
  230.           </treechildren>
  231.         </treeitem>
  232.  
  233.       </treechildren>
  234.     </tree>
  235.   </vbox>
  236.   <splitter collapse="before"><grippy/></splitter>
  237.   <iframe id="panelFrame" name="panelFrame" flex="1"/>
  238. </hbox>
  239.  
  240. <script type="application/x-javascript">
  241. init();
  242. </script>
  243.  
  244. </dialog>