home *** CD-ROM | disk | FTP | other *** search
/ ftp.swcp.com / ftp.swcp.com.zip / ftp.swcp.com / mac / mozilla-macos9-1.3.1.sea.bin / Mozilla1.3.1 / Chrome / comm.jar / content / communicator / pref / pref-history.xul < prev    next >
Extensible Markup Language  |  2003-06-08  |  5KB  |  117 lines

  1. <?xml version="1.0"?> 
  2. <!--
  3.    The contents of this file are subject to the Netscape Public
  4.    License Version 1.1 (the "License"); you may not use this file
  5.    except in compliance with the License. You may obtain a copy of
  6.    the License at http://www.mozilla.org/NPL/
  7.     
  8.    Software distributed under the License is distributed on an "AS
  9.    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.    implied. See the License for the specific language governing
  11.    rights and limitations under the License.
  12.     
  13.    The Original Code is Mozilla Communicator client code, released
  14.    March 31, 1998.
  15.    
  16.    The Initial Developer of the Original Code is Netscape
  17.    Communications Corporation. Portions created by Netscape are
  18.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  19.    Rights Reserved.
  20.    
  21.    Contributor(s): 
  22.      Jason Eager <jce2@po.cwru.edu>
  23.   -->
  24.  
  25. <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
  26.  
  27. <!DOCTYPE page SYSTEM "chrome://communicator/locale/pref/pref-history.dtd" >
  28.  
  29. <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  30.       onload="parent.initPanel('chrome://communicator/content/pref/pref-history.xul');"
  31.       headertitle="&lHeader;">
  32.  
  33.   <script type="application/x-javascript">
  34.  
  35.   <![CDATA[
  36.     var _elementIDs = ["histDay"];
  37.  
  38.   function Startup()
  39.   { 
  40.     var urlbarHistButton = document.getElementById("ClearUrlBarHistoryButton");
  41.     try {
  42.       var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
  43.                                  .getService(Components.interfaces.nsIUrlbarHistory);
  44.       var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(urlbarHistButton.getAttribute("prefstring"));
  45.       var pref = Components.classes["@mozilla.org/preferences-service;1"]
  46.                            .getService(Components.interfaces.nsIPrefBranch);
  47.       var lastUrl = pref.getComplexValue("general.open_location.last_url",
  48.                                          Components.interfaces.nsISupportsString).data;
  49.       urlbarHistButton.disabled = ( urlBarHist.count == 0 && !lastUrl ) || isBtnLocked ;
  50.     }
  51.     catch(ex) {
  52.     }
  53.     
  54.     var globalHistButton = document.getElementById("browserClearHistory");
  55.     var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
  56.                                   .getService(Components.interfaces.nsIBrowserHistory);
  57.     if (globalHistory.count == 0)
  58.       globalHistButton.disabled = true;
  59.  
  60.   }
  61.  
  62.   function prefClearGlobalHistory()
  63.   {
  64.     var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
  65.                                   .getService(Components.interfaces.nsIBrowserHistory);
  66.     globalHistory.removeAllPages();
  67.   }
  68.  
  69.   function prefClearUrlbarHistory()
  70.   {
  71.     var button = document.getElementById("ClearUrlBarHistoryButton");
  72.     var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
  73.                                   .getService(Components.interfaces.nsIUrlbarHistory);
  74.     urlBarHistory.clearHistory();
  75.     var pref = Components.classes["@mozilla.org/preferences-service;1"]
  76.                          .getService(Components.interfaces.nsIPrefBranch);
  77.     var str = Components.classes["@mozilla.org/supports-string;1"]
  78.                          .createInstance(Components.interfaces.nsISupportsString);
  79.     str.data = "";
  80.     pref.setComplexValue("general.open_location.last_url",
  81.                          Components.interfaces.nsISupportsString,
  82.                          str);
  83.   }
  84.   ]]>
  85.   </script>
  86.  
  87.   <groupbox>
  88.     <caption label="&header3.label;"/>
  89.     <description>&historyPages.label;</description>
  90.     <hbox align="center">
  91.       <label value="&pageHis.label;" accesskey="&pageHis.accesskey;" control="histDay"/>
  92.       <textbox id="histDay" size="3"
  93.                  preftype="int" prefstring="browser.history_expire_days"/>
  94.       <label value="&days.label;"/>
  95.       <spacer flex="1"/>
  96.       <button label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
  97.         oncommand="prefClearGlobalHistory(); this.disabled = true;"
  98.         id="browserClearHistory"
  99.         prefstring="pref.browser.history.disable_button.clear_hist"/>
  100.     </hbox>
  101.   </groupbox>  
  102.   
  103.   <!-- no honey, I haven't been viewing porn, honest! -->
  104.   <groupbox>
  105.     <caption label="&locationBarHistory.label;"/>
  106.     <hbox align="center">
  107.       <description flex="1">&clearLocationBar.label;</description>
  108.       <hbox align="center" pack="end">
  109.         <button id="ClearUrlBarHistoryButton" label="&clearLocationBarButton.label;" accesskey="&clearLocationBarButton.accesskey;"
  110.          oncommand="prefClearUrlbarHistory(); this.disabled = true;"
  111.          prefstring="pref.browser.history.disable_button.clear_urlbar"/>
  112.       </hbox>
  113.     </hbox>
  114.   </groupbox>  
  115. </page>
  116.  
  117.