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-browsing.xul < prev    next >
Extensible Markup Language  |  2007-04-23  |  9KB  |  213 lines

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://global/skin/"?>
  3. <?xul-overlay href="chrome://kmprefs/content/kplugins/layers.xul"?>
  4. <?xul-overlay href="chrome://kmprefs/content/kmprefs/ovrl-popups.xul"?>
  5. <!DOCTYPE page SYSTEM "chrome://kmprefs/locale/pref-browsing.dtd">
  6. <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  7. id="prefBrowsing" onload="Browsing.init();kLayers.init()">
  8.  
  9. <stringbundle id="pref_bundle" src="chrome://kmprefs/locale/pref.properties"/>
  10. <stringbundle id="brws_bundle" src="chrome://kmprefs/locale/pref-browsing.properties"/>
  11.  
  12. <script type="application/x-javascript" src="chrome://kmprefs/content/pref.js"/>
  13. <script type="application/x-javascript">
  14. <![CDATA[
  15. var Browsing = {
  16.  
  17. lst : null,
  18. grp : null,
  19.  
  20. init: function() {
  21.     this.lst = document.getElementById("openURL");
  22.     this.grp = document.getElementById("openHow");
  23.  
  24.     var brwsBundle = document.getElementById("brws_bundle"), tag, val;
  25.  
  26.     kLayers.init();
  27.     document.getElementById("openURLInCurrent").label = brwsBundle.getString((kLayers.load)?"layer_current":"window_current");
  28.     document.getElementById("openURLInLayer").label = brwsBundle.getString("layer_new");
  29.     document.getElementById("openURLInLayer").disabled = (kLayers.load) ? false : true;
  30.     document.getElementById("layers(OpenURLBg)").disabled = document.getElementById("openURLInLayer").disabled;
  31.     document.getElementById("openURLInWindow").label = brwsBundle.getString("window_new");
  32.     document.getElementById("openURLInWindow").disabled = (kLayers.only) ? true : false;
  33.     document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").disabled = document.getElementById("openURLInWindow").disabled
  34.  
  35.     for(var j=0,p=new Array("macros","favorites","bookmarks","hotlist");j<p.length;j++)
  36.         if(!kPlugin.load(p[j])) document.getElementById(p[j]).setAttribute("disabled",true);
  37.  
  38.     this.initOpen();
  39. },
  40. initOpen: function() {
  41.     var val;
  42.  
  43.     try {
  44.         val = pref.getCharPref(this.lst.value);
  45.     } catch(e) {
  46.         for(var j=0,c=this.grp.childNodes;j<c.length;j++) c[j].setAttribute("disabled",true);
  47.     }
  48.  
  49.     document.getElementById("layers(OpenURLBg)").checked = false;
  50.     document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").checked = false;
  51.     switch(val) {
  52.         case "ID_OPEN_LINK"              : this.grp.selectedIndex = 0; break;
  53.         case "layers(OpenURL)"           : this.grp.selectedIndex = 1; break;
  54.         case "layers(OpenURLBg)"         : this.grp.selectedIndex = 1; document.getElementById("layers(OpenURLBg)").checked = true; break;
  55.         case "ID_OPEN_LINK_IN_NEW_WINDOW": this.grp.selectedIndex = 2; break;
  56.         case "ID_OPEN_LINK_IN_BACKGROUND": this.grp.selectedIndex = 2; document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").checked = true; break;
  57.         default                          : this.grp.selectedIndex =-1;
  58.     }
  59. },
  60. setDefault: function() {
  61.     var proc = Components.classes["@mozilla.org/process/util;1"]
  62.                  .createInstance(Components.interfaces.nsIProcess);
  63.     proc.init(getFile(getFolder("CurProcD"),"SetDefault.exe"));
  64.     proc.run(true,[pref.getCharPref("general.useragent.locale")],1);
  65. },
  66. setOpen: function() {
  67.     pref.setCharPref(this.lst.value,this.grp.value);
  68.     this.initOpen();
  69. },
  70. toggleOpen: function(chkBox) {
  71.     if(chkBox.checked)
  72.         pref.setCharPref(this.lst.value,chkBox.id);
  73.     else
  74.         pref.setCharPref(this.lst.value,chkBox.previousSibling.value);
  75.     this.initOpen();
  76. }
  77.  
  78. };
  79. var Diversion = {
  80.  
  81. lst : null,
  82. grp : null,
  83.  
  84. init: function() {
  85.     this.lst = document.getElementById("openDivURL");
  86.     this.grp = document.getElementById("openDivHow");
  87.  
  88.     var layerBundle = document.getElementById("brws_bundle");
  89.  
  90.     kLayers.init();
  91.     document.getElementById("browser.tabs.loadDivertedInBackground").disabled = (kLayers.load) ? true : false;
  92.     initCheckbox("browser.tabs.loadDivertedInBackground");
  93.  
  94.     document.getElementById("openDivURLInCurrent").label = layerBundle.getString((kLayers.load)?"layer_current":"window_current");
  95.     document.getElementById("openDivURLInLayer").label = layerBundle.getString("layer_new");
  96.     document.getElementById("openDivURLInLayer").disabled = (kLayers.only) ? false : true;
  97.     document.getElementById("openDivURLInLayer").value = (kLayers.only) ? 2 : 3;
  98.     document.getElementById("openDivURLInWindow").label = layerBundle.getString("window_new");
  99.     document.getElementById("openDivURLInWindow").disabled = (kLayers.only) ? true : false;
  100.  
  101.     this.initOpen();
  102.     initRadiogroup("browser.link.open_newwindow.restriction");
  103. },
  104. initOpen: function() {
  105.     var val;
  106.  
  107.     try {
  108.         val = pref.getIntPref(this.lst.value);
  109.         for(this.grp.selectedIndex=0;this.grp.selectedItem.value!=val;this.grp.selectedIndex++);
  110.     } catch(e) {
  111.         try {
  112.             for(this.grp.selectedIndex=0;this.grp.selectedItem.value;this.grp.selectedIndex++);
  113.                 this.grp.selectedItem.disabled = true;
  114.         } catch(e) {}
  115.     }
  116. }
  117.  
  118. };
  119. ]]>
  120. </script>
  121.  
  122.  
  123. <vbox flex="1" style="overflow:auto">
  124.   <dialogheader title="&browsing.header;"/>
  125.   <separator class="thin"/>
  126.   <tabcontrol flex="1">
  127.     <tabbox flex="1">
  128.       <tabs>
  129.         <tab label="&general;" oncommand="Browsing.init()"/>
  130.         <tab label="&browsing.layered;"/>
  131.         <tab label="&browsing.diverted;" oncommand="Diversion.init()"/>
  132.       </tabs>
  133.       <tabpanels flex="1">
  134.         <tabpanel flex="1" orient="vertical" style="overflow:auto">
  135. <!-- General Browsing -->
  136. <hbox>
  137.   <groupbox flex="1">
  138.     <caption>
  139.       <hbox align="center">
  140.         <label value="&browsing.open;"/>
  141.         <menulist id="openURL" oncommand="Browsing.initOpen()">
  142.           <menupopup>
  143.             <menuitem value="kmeleon.general.openurl" label="&browsing.typedURL;"/>
  144.             <menuitem value="kmeleon.plugins.macros.selected.openurl" label="&browsing.selectedText;" id="macros"/>
  145.             <menuitem value="kmeleon.plugins.favorites.openurl" label="&browsing.favorites;" id="favorites"/>
  146.             <menuitem value="kmeleon.plugins.bookmarks.openurl" label="&browsing.bookmarks;" id="bookmarks"/>
  147.             <menuitem value="kmeleon.plugins.hotlist.openurl" label="&browsing.hotlist;" id="hotlist"/>
  148.           </menupopup>
  149.         </menulist>
  150.       </hbox>
  151.     </caption>
  152.     <separator class="thin"/>
  153.     <radiogroup id="openHow">
  154.       <radio oncommand="Browsing.setOpen()" value="ID_OPEN_LINK" id="openURLInCurrent"/>
  155.       <radio oncommand="Browsing.setOpen()" value="layers(OpenURL)" id="openURLInLayer"/>
  156.       <checkbox oncommand="Browsing.toggleOpen(this)" id="layers(OpenURLBg)" label="&inBackground;" style="margin-left:2em"/>
  157.       <radio oncommand="Browsing.setOpen()" value="ID_OPEN_LINK_IN_NEW_WINDOW" id="openURLInWindow"/>
  158.       <checkbox oncommand="Browsing.toggleOpen(this)" id="ID_OPEN_LINK_IN_BACKGROUND" label="&inBackground;" style="margin-left:2em"/>
  159.     </radiogroup>
  160.     <separator class="thin"/>
  161.   </groupbox>
  162.   <hbox style="padding-top:0.6em" flex="1">
  163.     <groupbox flex="1">
  164.       <caption label="&DefaultBrowser;"/>
  165.       <separator class="thin"/>
  166.       <description flex="1">&DefaultBrowser.descr;</description>
  167.       <separator class="thin"/>
  168.       <button label="&DefaultBrowser.set;" oncommand="Browsing.setDefault()"/>
  169.     </groupbox>
  170.   </hbox>
  171. </hbox>
  172. <!-- General Browsing -->
  173.     </tabpanel>
  174.         <tabpanel flex="1" orient="vertical" style="overflow:auto">
  175.           <separator class="thin"/>
  176.           <vbox id="kLayersLoad"/>
  177.           <separator class="thin"/>
  178.           <vbox id="kLayersOpen"/>
  179.     </tabpanel>
  180.         <tabpanel flex="1" orient="vertical" style="overflow:auto">
  181. <!-- Window Diversion (Mozilla 1.8) -->
  182. <groupbox>
  183.   <caption>
  184.     <hbox align="center">
  185.       <label value="&browsing.open;"/>
  186.       <menulist id="openDivURL" oncommand="Diversion.initOpen()">
  187.         <menupopup>
  188.           <menuitem value="browser.link.open_newwindow" label="&browsing.newwindow;"/>
  189.           <menuitem value="browser.link.open_external" label="&browsing.external;"/>
  190.         </menupopup>
  191.       </menulist>
  192.     </hbox>
  193.   </caption>
  194.   <separator class="thin"/>
  195.   <radiogroup id="openDivHow" oncommand="pref.setIntPref(Diversion.lst.value,parseInt(Diversion.grp.value))">
  196.     <radio value="1" id="openDivURLInCurrent"/>
  197.     <radio value="3" id="openDivURLInLayer"/>
  198.     <radio value="2" id="openDivURLInWindow"/>
  199.   </radiogroup>
  200.   <separator class="thin"/>
  201. </groupbox>
  202. <separator class="thin"/>
  203. <checkbox oncommand="toggleCheckbox(this.id)" id="browser.tabs.loadDivertedInBackground" label="&browsing.inBackground;"/>
  204. <separator class="thin"/>
  205. <groupbox id="popups.diversion"/>
  206. <!-- Window Diversion (Mozilla 1.8) -->
  207.     </tabpanel>
  208.       </tabpanels>
  209.     </tabbox>
  210.   </tabcontrol>
  211. </vbox>
  212.  
  213. </page>