!import
1 //@line 38 "/home/visbrero/mnt/roisin/rev_control/hg/mozilla/mail/components/preferences/privacy.js"
2
3 var gPrivacyPane = {
4 mPane: null,
5 mInitialized: false,
6
init
7 init: function ()
8 {
9 this.mPane = document.getElementById("panePrivacy");
10
11 this.updateManualMarkMode(document.getElementById('manualMark').checked);
12 this.updateJunkLogButton(document.getElementById('enableJunkLogging').checked);
13
14 // Update the MP buttons
15 this.updateMasterPasswordButton();
16
17 // update the checkbox for downloading phishing url tables
18 // this.updateDownloadedPhishingListState();
19
20 var preference = document.getElementById("mail.preferences.privacy.selectedTabIndex");
21 if (preference.value)
22 document.getElementById("privacyPrefs").selectedIndex = preference.value;
23 this.mInitialized = true;
24 },
25
tabSelectionChanged
26 tabSelectionChanged: function ()
27 {
28 if (this.mInitialized)
29 document.getElementById("mail.preferences.privacy.selectedTabIndex")
30 .valueFromPreferences = document.getElementById("privacyPrefs").selectedIndex;
31 },
32
updateManualMarkMode
33 updateManualMarkMode: function(aEnableRadioGroup)
34 {
35 document.getElementById('manualMarkMode').disabled = !aEnableRadioGroup;
36 },
37
updateJunkLogButton
38 updateJunkLogButton: function(aEnableButton)
39 {
40 document.getElementById('openJunkLogButton').disabled = !aEnableButton;
41 },
42
openJunkLog
43 openJunkLog: function()
44 {
45 document.documentElement.openWindow("mailnews:junklog", "chrome://messenger/content/preferences/junkLog.xul",
46 "", null);
47 },
48
resetTrainingData
49 resetTrainingData: function()
50 {
51 // make sure the user really wants to do this
52 var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
53 .getService(Components.interfaces.nsIPromptService);
54 var bundle = document.getElementById("bundlePreferences");
55 var title = bundle.getString("confirmResetJunkTrainingTitle");
56 var text = bundle.getString("confirmResetJunkTrainingText");
57
58 // if the user says no, then just fall out
59 if (!promptService.confirm(window, title, text))
60 return;
61
62 // otherwise go ahead and remove the training data
63 var junkmailPlugin = Components.classes["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
64 .getService(Components.interfaces.nsIJunkMailPlugin);
65
66 if (junkmailPlugin)
67 junkmailPlugin.resetTrainingData();
68 },
69
initReencryptCallback
70 initReencryptCallback: function()
71 {
72 var wallet = Components.classes['@mozilla.org/wallet/wallet-service;1'];
73 wallet = wallet.getService().QueryInterface(Components.interfaces.nsIWalletService);
74 wallet.WALLET_InitReencryptCallback(window);
75 },
76
viewPasswords
77 viewPasswords: function()
78 {
79 document.documentElement.openWindow("Toolkit:PasswordManager", "chrome://messenger/content/preferences/viewpasswords.xul",
80 "", null);
81 },
82
changeMasterPassword
83 changeMasterPassword: function ()
84 {
85 document.documentElement.openSubDialog("chrome://mozapps/content/preferences/changemp.xul",
86 "", null);
87 this.updateMasterPasswordButton();
88 },
89
updateMasterPasswordButton
90 updateMasterPasswordButton: function ()
91 {
92 // See if there's a master password and set the button label accordingly
93 var secmodDB = Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
94 .getService(Components.interfaces.nsIPKCS11ModuleDB);
95 var slot = secmodDB.findSlotByName("");
96 if (slot) {
97 const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
98 var status = slot.status;
99 var noMP = status == nsIPKCS11Slot.SLOT_UNINITIALIZED ||
100 status == nsIPKCS11Slot.SLOT_READY;
101
102 var bundle = document.getElementById("bundlePreferences");
103 document.getElementById("setMasterPassword").label =
104 bundle.getString(noMP ? "setMasterPassword" : "changeMasterPassword");
105
106 document.getElementById("removeMasterPassword").disabled = noMP;
107 }
108 },
109
removeMasterPassword
110 removeMasterPassword: function ()
111 {
112 var secmodDB = Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
113 .getService(Components.interfaces.nsIPKCS11ModuleDB);
114 if (secmodDB.isFIPSEnabled)
115 {
116 var bundle = document.getElementById("bundlePreferences");
117 promptService.alert(window,
118 bundle.getString("pw_change_failed_title"),
119 bundle.getString("pw_change2empty_in_fips_mode"));
120 }
121 else
122 {
123 document.documentElement.openSubDialog("chrome://mozapps/content/preferences/removemp.xul",
124 "", null);
125 this.updateMasterPasswordButton();
126 document.getElementById("setMasterPassword").focus();
127 }
128 },
129
updateDownloadedPhishingListState
130 updateDownloadedPhishingListState: function()
131 {
132 document.getElementById('useDownloadedList').disabled = !document.getElementById('enablePhishingDetector').checked;
133 }
134 };