home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / browser.xpi / bin / chrome / comm.jar / content / wallet / walletTasksOverlay.xul < prev   
Encoding:
Extensible Markup Language  |  2001-08-06  |  8.3 KB  |  223 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    The contents of this file are subject to the Netscape Public
  5.    License Version 1.1 (the "License"); you may not use this file
  6.    except in compliance with the License. You may obtain a copy of
  7.    the License at http://www.mozilla.org/NPL/
  8.     
  9.    Software distributed under the License is distributed on an "AS
  10.    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    implied. See the License for the specific language governing
  12.    rights and limitations under the License.
  13.     
  14.    The Original Code is Mozilla Communicator client code, released
  15.    March 31, 1998.
  16.    
  17.    The Initial Developer of the Original Code is Netscape
  18.    Communications Corporation. Portions created by Netscape are
  19.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  20.    Rights Reserved.
  21.    
  22.    Contributor(s): 
  23.   -->
  24.  
  25. <!DOCTYPE window SYSTEM "chrome://wallet/locale/walletTasksOverlay.dtd">
  26.  
  27. <overlay id="walletTasksOverlay"
  28.          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  29.  
  30.   <script type="application/x-javascript" src="chrome://wallet/content/walletOverlay.js"/>
  31.  
  32.   <script type="application/x-javascript">
  33.   <![CDATA[
  34.  
  35.     function CheckForEncrypt() {
  36.       // remove either encrypt or obscure depending on pref setting
  37.       var elementOn, elementOff;
  38.       var pref;
  39.       pref = Components.classes['@mozilla.org/preferences;1'];
  40.       pref = pref.getService();
  41.       pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
  42.       try {
  43.         if (pref.getBoolPref("wallet.crypto")) {
  44.           elementOn = document.getElementById("obscure");
  45.           elementOff = document.getElementById("encrypt");
  46.         } else {
  47.           elementOn = document.getElementById("encrypt");
  48.           elementOff = document.getElementById("obscure");
  49.         }
  50.         elementOn.setAttribute("disabled","false");
  51.         elementOff.setAttribute("disabled","true");
  52.       } catch(e) {
  53.         var encrypt = document.getElementById("encrypt");
  54.         if(encrypt) {
  55.           encrypt.setAttribute("disabled", "true");
  56.         }
  57.         var obscure = document.getElementById("obscure");
  58.         if(obscure) {
  59.           obscure.setAttribute("disabled", "true");
  60.         }
  61.         dump("wallet.crypto pref is missing from all.js\n");
  62.       }
  63.     }
  64.  
  65.     // perform a wallet action
  66.     function WalletAction( action ) {
  67.       var wallet = Components.classes['@mozilla.org/wallet/wallet-service;1'];
  68.       wallet = wallet.getService();
  69.       wallet = wallet.QueryInterface(Components.interfaces.nsIWalletService);
  70.       var strings = document.getElementById("personalManagers");
  71.  
  72.       var pref;
  73.       pref = Components.classes['@mozilla.org/preferences;1'];
  74.       pref = pref.getService();
  75.       pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
  76.  
  77.       switch( action ) {
  78.         case "password":
  79.           if (!wallet.WALLET_ChangePassword()) {
  80.             window.alert(strings.getAttribute("PasswordNotChanged"));
  81.           }
  82.           break;
  83.         case "expire":
  84.           if (wallet.WALLET_ExpirePassword()) {
  85.             window.alert(strings.getAttribute("PasswordExpired"));
  86.           } else {
  87.             window.alert(strings.getAttribute("PasswordNotExpired"));
  88.           }
  89.           break;
  90.         case "clear":
  91.           if (window.confirm(strings.getAttribute("AllDataWillBeCleared"))) {
  92.             wallet.WALLET_DeleteAll();
  93.           }
  94.           break;
  95.         case "encrypt":
  96.           if (pref) {
  97.             wallet.WALLET_InitReencryptCallback(window._content);
  98.             pref.setBoolPref("wallet.crypto", true);
  99.           }
  100.           break;
  101.         case "obscure":
  102.           if (pref) {
  103.             wallet.WALLET_InitReencryptCallback(window._content);
  104.             pref.setBoolPref("wallet.crypto", false);
  105.           }
  106.           break;
  107. /*
  108.         case "safefill":
  109.           formPrefill();
  110.           break;
  111.         case "quickfill": 
  112.           formQuickPrefill();
  113.           break;
  114.         case "capture":
  115.           formCapture();
  116.           walletService.WALLET_RequestToCapture(window._content);
  117.           break;
  118. */
  119.         default:
  120.           break;
  121.       }
  122.     }  
  123.  
  124.     // display a Wallet Dialog
  125.     function WalletDialog(which) {
  126.       switch( which ) {
  127.         case "signon":
  128.           window.openDialog("chrome://communicator/content/wallet/SignonViewer.xul",
  129.                             "_blank","modal=yes,chrome,resizable=yes","S"); 
  130.           break;
  131.         case "samples":
  132.           window._content.location.href = 'chrome://communicator/locale/wallet/index.html';
  133.           break;
  134.         case "walletsites":
  135.           window.openDialog("chrome://communicator/content/wallet/SignonViewer.xul",
  136.                             "_blank","modal=yes,chrome,resizable=no","W"); 
  137.           break;
  138.         case "wallet":
  139.         default:
  140.           formShow();
  141.           break;
  142.       }
  143.     }
  144.  
  145.   ]]>
  146.   </script>         
  147.  
  148.   <!-- tasksOverlay menu items -->
  149.   <menupopup  id="personalManagers"
  150.               PasswordNotChanged = "&PasswordNotChanged;"
  151.               PasswordExpired = "&PasswordExpired;"
  152.               PasswordNotExpired = "&PasswordNotExpired;"
  153.               AllDataWillBeCleared = "&AllDataWillBeCleared;"
  154.               UnableToCapture = "&UnableToCapture;"
  155.               Captured = "&Captured;"
  156.               NotCaptured = "&NotCaptured;"
  157.               noPrefills = "&noPrefills;">
  158.     <menu label="&walletPasswordManager.label;"
  159.           accesskey="&walletPasswordManager.accesskey;"
  160.           position="1">
  161.       <menupopup onpopupshowing="CheckForEncrypt()">
  162.         <menuitem label="&walletDisplaySignonsCmd.label;"
  163.                   accesskey="&walletDisplaySignonsCmd.accesskey;"
  164.                   oncommand="WalletDialog('signon');"/> 
  165.         <menuitem label="&walletChangePasswordCmd.label;"
  166.                   accesskey="&walletChangePasswordCmd.accesskey;"
  167.                   oncommand="WalletAction('password');"/>
  168.         <menuitem label="&walletExpirePasswordCmd.label;"
  169.                   accesskey="&walletExpirePasswordCmd.accesskey;"
  170.                   oncommand="WalletAction('expire');"/>
  171.         <menuseparator/>
  172.         <menuitem label="&walletEncryptCmd.label;"
  173.                   id="encrypt"
  174.                   accesskey="&walletEncryptCmd.accesskey;" 
  175.                   oncommand="WalletAction('encrypt');"/>
  176.         <menuitem label="&walletObscureCmd.label;"
  177.                   id="obscure"
  178.                   accesskey="&walletObscureCmd.accesskey;" 
  179.                   oncommand="WalletAction('obscure');"/>
  180.         <menuitem label="&walletClearCmd.label;"
  181.                   id="clear"
  182.                   accesskey="&walletClearCmd.accesskey;" 
  183.                   oncommand="WalletAction('clear');"/>
  184.       </menupopup>
  185.     </menu>
  186.     <menu label="&walletFormManager.label;"
  187.           accesskey="&walletFormManager.accesskey;"
  188.           id="wallet"
  189.           position="2">
  190.       <menupopup>
  191.         <menuitem label="&walletContentsCmd.label;"
  192.                   accesskey="&walletContentsCmd.accesskey;"
  193.                   id="walleteditor"
  194.                   oncommand="WalletDialog('wallet');"/> 
  195.         <menuitem label="&walletSitesCmd.label;"
  196.                   accesskey="&walletSitesCmd.accesskey;"
  197.                   id="walletsites"
  198.                   oncommand="WalletDialog('walletsites');"/> 
  199. <!--        
  200.         <menuseparator/>
  201.         <menuitem label="&walletSafeFillCmd.label;"
  202.                   accesskey="&walletSafeFillCmd.accesskey;"
  203.                   id="walletSafeFill"
  204.                   oncommand="WalletAction('safefill');"/> 
  205.         <menuitem label="&walletQuickFillCmd.label;"
  206.                   accesskey="&walletQuickFillCmd.accesskey;"
  207.                   id="walletQuickFill"
  208.                   oncommand="WalletAction('quickfill');"/> 
  209.         <menuitem label="&walletRequestToCaptureCmd.label;"
  210.                   accesskey="&walletRequestToCaptureCmd.accesskey;"
  211.                   id="walletCapture"
  212.                   oncommand="WalletAction('capture');"/> 
  213.         <menuseparator/>
  214.         <menuitem label="&walletSamplesCmd.label;"
  215.                   accesskey="&walletSamplesCmd.accesskey;"
  216.                   id="walletSamples"
  217.                   oncommand="WalletDialog('samples');"/> 
  218. -->
  219.       </menupopup>
  220.     </menu>
  221.   </menupopup>
  222. </overlay>
  223.