[tor-commits] [torbirdy/master] Allow users to easily toggle checking for new messages
sukhbir at torproject.org
sukhbir at torproject.org
Sun Aug 25 23:50:10 UTC 2013
commit 8de0fd0fab25c2596ed0719ad40964b36d014634
Author: Sukhbir Singh <sukhbir at torproject.org>
Date: Sun Aug 25 19:50:10 2013 -0400
Allow users to easily toggle checking for new messages
---
chrome/content/preferences.js | 47 ++++++++++++++++++++++++++++++++++++++--
chrome/content/preferences.xul | 1 +
chrome/locale/en/torbirdy.dtd | 2 ++
defaults/preferences/prefs.js | 1 +
4 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index d138b96..0f667c3 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -101,6 +101,17 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
pub.prefs.clearUserPref(pub.customBranch + pref);
};
+ pub.fetchAllMessages = function() {
+ if (pub.fetchAll.checked) {
+ pub.idle.checked = true;
+ pub.startupFolder.checked = true;
+ }
+ else {
+ pub.idle.checked = false;
+ pub.startupFolder.checked = false;
+ }
+ };
+
pub.checkSetting = function() {
var index = pub.anonService.selectedIndex;
if (index === 2) {
@@ -344,6 +355,27 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
pub.strbundle.GetStringFromName("torbirdy.restart"));
}
+ // Fetch all messages for all accounts.
+ // default: false
+ // Only change the state if it is required.
+ if (pub.fetchAll.checked !== pub.prefs.getBoolPref(pub.prefBranch + 'fetchall')) {
+ var accounts = pub.getAccount();
+ if (pub.fetchAll.checked) {
+ pub.prefs.setBoolPref(pub.prefBranch + 'fetchall', true);
+ for (var i = 0; i < accounts.length; i++) {
+ accounts[i].loginAtStartUp = true;
+ accounts[i].doBiff = true;
+ }
+ }
+ else {
+ pub.prefs.setBoolPref(pub.prefBranch + 'fetchall', false);
+ for (var i = 0; i < accounts.length; i++) {
+ accounts[i].loginAtStartUp = false;
+ accounts[i].doBiff = false;
+ }
+ }
+ }
+
// Enigmail.
// --throw-keyids - default: true
var enigmail_throwkeyid = pub.enigmail.checked;
@@ -420,6 +452,7 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
pub.emailwizard = document.getElementById('torbirdy-email-wizard');
pub.renegotiation = document.getElementById('torbirdy-renegotiation');
pub.keyserver = document.getElementById('torbirdy-enigmail-keyserver');
+ pub.fetchAll = document.getElementById('torbirdy-email-automatic');
// Make sure the user really wants to change these settings.
var warnPrompt = pub.prefs.getBoolPref("extensions.torbirdy.warn");
@@ -510,6 +543,15 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
pub.timezone.checked = true;
}
+ // Fetch all messages for all accounts.
+ // default: false
+ var fetchAllMessages = pub.prefs.getBoolPref(pub.prefBranch + 'fetchall');
+ if (fetchAllMessages) {
+ pub.fetchAll.checked = true;
+ } else {
+ pub.fetchAll.checked = false;
+ }
+
// Enigmal settings
// --throw-keyids - default: true
var enigmail_throwkeyid = pub.prefs.getBoolPref(pub.prefBranch + 'enigmail.throwkeyid');
@@ -592,13 +634,14 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
pub.restoreDefaults = function() {
// Set the values to their default state.
pub.anonService.selectedIndex = 0;
- pub.idle.checked = false;
- pub.startupFolder.checked = false;
pub.timezone.checked = false;
pub.enigmail.checked = false;
pub.confirmemail.checked = false;
pub.emailwizard.checked = false;
pub.renegotiation.checked = false;
+ pub.idle.checked = false;
+ pub.startupFolder.checked = false;
+ pub.fetchAll.checked = false;
// Save the settings and close the window.
pub.checkSetting();
pub.onAccept();
diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul
index 523e344..cd38163 100644
--- a/chrome/content/preferences.xul
+++ b/chrome/content/preferences.xul
@@ -98,6 +98,7 @@
<checkbox accesskey="&torbirdy.prefs.startup_folder.key;" id="torbirdy-startup-folder" label="&torbirdy.prefs.startup_folder.label;"/>
<checkbox accesskey="&torbirdy.prefs.timezone.key;" id="torbirdy-timezone" label="&torbirdy.prefs.timezone.label;"/>
<checkbox accesskey="&torbirdy.prefs.emailwizard.key;" id="torbirdy-email-wizard" label="&torbirdy.prefs.emailwizard.label;"/>
+ <checkbox accesskey="&torbirdy.prefs.automatic.key;" id="torbirdy-email-automatic" label="&torbirdy.prefs.automatic.label;" oncommand="org.torbirdy.prefs.fetchAllMessages();"/>
</vbox>
</groupbox>
diff --git a/chrome/locale/en/torbirdy.dtd b/chrome/locale/en/torbirdy.dtd
index 2880b9a..2d8d268 100644
--- a/chrome/locale/en/torbirdy.dtd
+++ b/chrome/locale/en/torbirdy.dtd
@@ -45,6 +45,8 @@
<!ENTITY torbirdy.prefs.confirmemail.key "c">
<!ENTITY torbirdy.prefs.emailwizard.label "Enable Thunderbird's automatic email configuration wizard [default: disabled]">
<!ENTITY torbirdy.prefs.emailwizard.key "w">
+<!ENTITY torbirdy.prefs.automatic.label "Check for new messages automatically for all accounts [default: disabled]">
+<!ENTITY torbirdy.prefs.automatic.key "f">
<!ENTITY torbirdy.prefs.renegotiation.label "Allow connections to servers that do not support SSL/TLS with secure renegotiation [default: do not allow]">
<!ENTITY torbirdy.prefs.renegotiation.key "r">
<!ENTITY torbirdy.prefs.account_specific "Account-Specific">
diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js
index 673cc5b..e736745 100644
--- a/defaults/preferences/prefs.js
+++ b/defaults/preferences/prefs.js
@@ -9,3 +9,4 @@ pref("extensions.torbirdy.timezone", true);
pref("extensions.torbirdy.whonix_run", true);
pref("extensions.torbirdy.info_run", false);
pref("extensions.torbirdy.emailwizard", false);
+pref("extensions.torbirdy.fetchall", false);
More information about the tor-commits
mailing list