home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / mail.xpi / bin / chrome / messenger.jar / content / messenger / am-main.js < prev    next >
Text File  |  2001-04-01  |  2KB  |  62 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  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.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape Communications
  16.  * Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  * Alec Flett <alecf@netscape.com>
  22.  */
  23.  
  24. const nsIFilePicker = Components.interfaces.nsIFilePicker;
  25.  
  26. function onAdvanced()
  27. {
  28.     dump("onAdvanced..\n");
  29.     var serverKeyElement = document.getElementById("identity.smtpServerKey");
  30.     var oldSmtpServerKey = serverKeyElement.getAttribute("value");
  31.     dump("selected key = " + oldSmtpServerKey + "\n");
  32.     var arg = { smtpServerKey: oldSmtpServerKey };
  33.     window.openDialog('am-identity-advanced.xul','smtpadvanced',
  34.                       'modal,titlebar,chrome', arg);
  35.     
  36.     if (arg.smtpServerKey != oldSmtpServerKey) {
  37.         // save the identity back to the page as a key
  38.         dump("Setting the smtp server to " + arg.smtpServerKey + "\n");
  39.         if (arg.smtpServerKey)
  40.             serverKeyElement.setAttribute("value", arg.smtpServerKey);
  41.         else
  42.             serverKeyElement.removeAttribute("value");
  43.     }
  44. }
  45.  
  46. function selectFile()
  47. {
  48.     var fp = Components.classes["@mozilla.org/filepicker;1"]
  49.                        .createInstance(nsIFilePicker);
  50.   
  51.     var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
  52.     var title = prefutilitiesBundle.getString("choosefile");
  53.     fp.init(window, title, nsIFilePicker.modeOpen);
  54.     fp.appendFilters(nsIFilePicker.filterAll);
  55.   
  56.     var ret = fp.show();
  57.     if (ret == nsIFilePicker.returnOK) {
  58.         var folderField = document.getElementById("identity.signature");
  59.         folderField.value = fp.file.unicodePath;
  60.     }
  61. }
  62.