!import
1 //@line 38 "/home/visbrero/mnt/roisin/rev_control/hg/mozilla/mail/components/preferences/advanced.js"
2
3 var gAdvancedPane = {
4 mPane: null,
5 mInitialized: false,
6
init
7 init: function ()
8 {
9 this.mPane = document.getElementById("paneAdvanced");
10 this.updateMarkAsReadTextbox(false);
11
12 if ("arguments" in window && window.arguments[1] && document.getElementById(window.arguments[1]))
13 document.getElementById("advancedPrefs").selectedTab = document.getElementById(window.arguments[1]);
14 else
15 {
16 var preference = document.getElementById("mail.preferences.advanced.selectedTabIndex");
17 if (preference.value)
18 document.getElementById("advancedPrefs").selectedIndex = preference.value;
19 }
20
21 this.updateAppUpdateItems();
22 this.updateAutoItems();
23 this.updateModeItems();
24
25 this.mInitialized = true;
26 },
27
tabSelectionChanged
28 tabSelectionChanged: function ()
29 {
30 if (this.mInitialized)
31 {
32 document.getElementById("mail.preferences.advanced.selectedTabIndex")
33 .valueFromPreferences = document.getElementById("advancedPrefs").selectedIndex;
34 }
35 },
36
showConfigEdit
37 showConfigEdit: function()
38 {
39 document.documentElement.openWindow("Preferences:ConfigManager",
40 "chrome://global/content/config.xul",
41 "", null);
42 },
43
updateButtons
44 updateButtons: function (aButtonID, aPreferenceID)
45 {
46 var button = document.getElementById(aButtonID);
47 var preference = document.getElementById(aPreferenceID);
48 // This is actually before the value changes, so the value is not as you expect.
49 button.disabled = preference.value == true;
50 return undefined;
51 },
52
53 /**
54 * UI state matrix for update preference conditions
55 *
56 * UI Components: Preferences
57 * 1 = Thunderbird checkbox i = app.update.enabled
58 * 2 = When updates for Thunderbird are found label ii = app.update.auto
59 * 3 = Automatic Radiogroup (Ask vs. Automatically) iii = app.update.mode
60 * 4 = Warn before disabling extensions checkbox
61 *
62 * States:
63 * Element p val locked Disabled
64 * 1 i t/f f false
65 * i t/f t true
66 * ii t/f t/f false
67 * iii 0/1/2 t/f false
68 * 2,3 i t t/f false
69 * i f t/f true
70 * ii t/f f false
71 * ii t/f t true
72 * iii 0/1/2 t/f false
73 * 4 i t t/f false
74 * i f t/f true
75 * ii t t/f false
76 * ii f t/f true
77 * iii 0/1/2 f false
78 * iii 0/1/2 t true
79 *
80 */
updateAppUpdateItems
81 updateAppUpdateItems: function ()
82 {
83 var aus =
84 Components.classes["@mozilla.org/updates/update-service;1"].
85 getService(Components.interfaces.nsIApplicationUpdateService);
86
87 var enabledPref = document.getElementById("app.update.enabled");
88 var enableAppUpdate = document.getElementById("enableAppUpdate");
89
90 enableAppUpdate.disabled = !aus.canUpdate || enabledPref.locked;
91 },
92
updateAutoItems
93 updateAutoItems: function ()
94 {
95 var enabledPref = document.getElementById("app.update.enabled");
96 var autoPref = document.getElementById("app.update.auto");
97
98 var updateModeLabel = document.getElementById("updateModeLabel");
99 var updateMode = document.getElementById("updateMode");
100
101 var disable = enabledPref.locked || !enabledPref.value ||
102 autoPref.locked;
103 updateModeLabel.disabled = updateMode.disabled = disable;
104 },
105
updateModeItems
106 updateModeItems: function ()
107 {
108 var enabledPref = document.getElementById("app.update.enabled");
109 var autoPref = document.getElementById("app.update.auto");
110 var modePref = document.getElementById("app.update.mode");
111
112 var warnIncompatible = document.getElementById("warnIncompatible");
113
114 var disable = enabledPref.locked || !enabledPref.value || autoPref.locked ||
115 !autoPref.value || modePref.locked;
116 warnIncompatible.disabled = disable;
117 },
118
119 /**
120 * The Extensions checkbox and button are disabled only if the enable Addon
121 * update preference is locked.
122 */
updateAddonUpdateUI
123 updateAddonUpdateUI: function ()
124 {
125 var enabledPref = document.getElementById("extensions.update.enabled");
126 var enableAddonUpdate = document.getElementById("enableAddonUpdate");
127
128 enableAddonUpdate.disabled = enabledPref.locked;
129 },
130
131 /**
132 * app.update.mode is a three state integer preference, and we have to
133 * express all three values in a single checkbox:
134 * "Warn me if this will disable extensions or themes"
135 * Preference Value Checkbox State Meaning
136 * 0 Unchecked Do not warn
137 * 1 Checked Warn if there are incompatibilities
138 * 2 Checked Warn if there are incompatibilities,
139 * or the update is major.
140 */
141 _modePreference: -1,
addonWarnSyncFrom
142 addonWarnSyncFrom: function ()
143 {
144 var preference = document.getElementById("app.update.mode");
145 var doNotWarn = preference.value != 0;
146 gAdvancedPane._modePreference = doNotWarn ? preference.value : 1;
147 return doNotWarn;
148 },
149
addonWarnSyncTo
150 addonWarnSyncTo: function ()
151 {
152 var warnIncompatible = document.getElementById("warnIncompatible");
153 return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
154 },
155
showUpdates
156 showUpdates: function ()
157 {
158 var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
159 .createInstance(Components.interfaces.nsIUpdatePrompt);
160 prompter.showUpdateHistory(window);
161 },
162
updateMarkAsReadTextbox
163 updateMarkAsReadTextbox: function(aFocusTextBox)
164 {
165 var textbox = document.getElementById('markAsReadDelay');
166 textbox.disabled = !document.getElementById('markAsRead').checked;
167 if (!textbox.disabled && aFocusTextBox)
168 textbox.focus();
169 },
170
171 /**
172 * open the return receipts configuration dialog
173 */
showReturnReceipts
174 showReturnReceipts: function()
175 {
176 document.documentElement.openSubDialog("chrome://messenger/content/preferences/receipts.xul",
177 "", null);
178 },
179
180 /**
181 * open the connections dialog
182 */
showConnections
183 showConnections: function ()
184 {
185 document.documentElement
186 .openSubDialog("chrome://messenger/content/preferences/connection.xul",
187 "", null);
188 },
189
190 /**
191 * open the offline settings dialog
192 */
showOffline
193 showOffline: function()
194 {
195 document.documentElement
196 .openSubDialog("chrome://messenger/content/preferences/offline.xul",
197 "", null);
198 },
199
showCertificates
200 showCertificates: function ()
201 {
202 document.documentElement.openWindow("mozilla:certmanager", "chrome://pippki/content/certManager.xul",
203 "width=600,height=400", null);
204 },
205
showCRLs
206 showCRLs: function ()
207 {
208 document.documentElement.openWindow("Mozilla:CRLManager", "chrome://pippki/content/crlManager.xul",
209 "width=600,height=400", null);
210 },
211
showOCSP
212 showOCSP: function ()
213 {
214 document.documentElement.openSubDialog("chrome://mozapps/content/preferences/ocsp.xul",
215 "", null);
216 },
217
showSecurityDevices
218 showSecurityDevices: function ()
219 {
220 document.documentElement.openWindow("mozilla:devicemanager", "chrome://pippki/content/device_manager.xul",
221 "width=600,height=400", null);
222 }
223 };