This is just some static backup of the original site, don't expect every link to work!

source: content/prefDialog/vI_prefDialog_TB3FolderPicker.js @ 509348

ng_0.9
Last change on this file since 509348 was 509348, checked in by rene <rene@…>, 8 years ago

code formatting (no code changes)

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/**
2 * some code copied and adapted from Thunderbird Sources
3 * thanks to all Thunderbird Developers
4 */
5
6/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
7 * ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 *
10 * The contents of this file are subject to the Mozilla Public License Version
11 * 1.1 (the "License"); you may not use this file except in compliance with
12 * the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS" basis,
16 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 * for the specific language governing rights and limitations under the
18 * License.
19 *
20 * The Original Code is Mozilla Communicator client code, released
21 * March 31, 1998.
22 *
23 * The Initial Developer of the Original Code is
24 * Netscape Communications Corporation.
25 * Portions created by the Initial Developer are Copyright (C) 1998-1999
26 * the Initial Developer. All Rights Reserved.
27 *
28 * Contributor(s):
29 *
30 * Alternatively, the contents of this file may be used under the terms of
31 * either of the GNU General Public License Version 2 or later (the "GPL"),
32 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
33 * in which case the provisions of the GPL or the LGPL are applicable instead
34 * of those above. If you wish to allow use of your version of this file only
35 * under the terms of either the GPL or the LGPL, and not to allow others to
36 * use your version of this file under the terms of the MPL, indicate your
37 * decision by deleting the provisions above and replace them with the notice
38 * and other provisions required by the GPL or the LGPL. If you do not delete
39 * the provisions above, a recipient may use your version of this file under
40 * the terms of any one of the MPL, the GPL or the LGPL.
41 *
42 * ***** END LICENSE BLOCK ***** */
43
44Components.utils.import("resource://v_identity/vI_nameSpaceWrapper.js");
45virtualIdentityExtension.ns(function () {
46  with(virtualIdentityExtension.LIB) {
47
48    var InitFolderDisplays = function (msgFolder, accountPickerId, folderPickerId) {
49      var accountPicker = document.getElementById(accountPickerId);
50      var folderPicker = document.getElementById(folderPickerId);
51      InitFolderDisplay(msgFolder.server.rootFolder, accountPicker);
52      InitFolderDisplay(msgFolder, folderPicker);
53    }
54
55    // Initialize the folder display based on prefs values
56    var InitFolderDisplay = function (folder, folderPicker) {
57      try {
58        folderPicker.firstChild.selectFolder(folder);
59      } catch (ex) {
60        folderPicker.setAttribute("label", folder.prettyName);
61      }
62      folderPicker.folder = folder;
63    }
64
65    // Capture any menulist changes
66    var noteSelectionChange = function (radioItemId, aEvent) {
67      var checkedElem = document.getElementById(radioItemId);
68      var folder = aEvent.target._folder;
69      var modeValue = checkedElem.value;
70      var radioGroup = checkedElem.radioGroup.getAttribute("id");
71      var picker;
72      switch (radioGroup) {
73      case "VIdent_doFcc":
74        vI.gFccRadioElemChoice = modeValue;
75        picker = document.getElementById("msgFccFolderPicker");
76        break;
77
78      case "VIdent_messageDrafts":
79        vI.gDraftsRadioElemChoice = modeValue;
80        picker = document.getElementById("msgDraftsFolderPicker");
81        break;
82
83      case "VIdent_messageTemplates":
84        vI.gTmplRadioElemChoice = modeValue;
85        picker = document.getElementById("msgStationeryFolderPicker");
86        break;
87      }
88      picker.folder = folder;
89      picker.setAttribute("label", folder.prettyName);
90    }
91
92    // Save folder settings and radio element choices
93    var SaveFolderSettings = function (radioElemChoice,
94      radioGroupId,
95      folderSuffix,
96      accountPickerId,
97      folderPickerId,
98      folderElementId,
99      folderPickerModeId) {
100      var formElement = document.getElementById(folderElementId);
101      var uri = "";
102
103      switch (radioElemChoice) {
104      case "0":
105        uri = document.getElementById(accountPickerId).selectedItem._folder.URI;
106        if (uri) {
107          // Create  Folder URI
108          uri = uri + folderSuffix;
109        }
110        break;
111
112      case "1":
113        uri = document.getElementById(folderPickerId).folder.URI;
114        break;
115
116      default:
117        break;
118      }
119      formElement.setAttribute("value", uri);
120
121      formElement = document.getElementById(folderPickerModeId);
122      formElement.setAttribute("value", radioElemChoice);
123    }
124    vI.InitFolderDisplays = InitFolderDisplays;
125    vI.SaveFolderSettings = SaveFolderSettings;
126    vI.noteSelectionChange = noteSelectionChange;
127  }
128});
Note: See TracBrowser for help on using the repository browser.