[tor-commits] [torbirdy/master] Allow users to restore the default (recommended) settings
sukhbir at torproject.org
sukhbir at torproject.org
Tue Aug 20 22:57:07 UTC 2013
commit d01aad87c6e5867179850048504f2122ae672b13
Author: Sukhbir Singh <sukhbir at torproject.org>
Date: Tue Aug 20 18:57:05 2013 -0400
Allow users to restore the default (recommended) settings
---
ChangeLog | 1 +
chrome/content/preferences.js | 16 ++++++++++++++++
chrome/content/preferences.xul | 5 ++++-
chrome/locale/en/torbirdy.dtd | 2 ++
components/torbirdy.js | 2 +-
5 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b67de27..2e1432f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
0.1.2,
+ Add an option for restoring default TorBirdy settings
Add Persian translation (thanks to Nima)
Add Czech translation (thanks to dope)
Add Esperanto translation (thanks to Michael Moroni)
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index d7f4aad..d138b96 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -589,5 +589,21 @@ 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;
+ // Save the settings and close the window.
+ pub.checkSetting();
+ pub.onAccept();
+ window.close();
+ };
+
return pub;
};
diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul
index 9218cd8..523e344 100644
--- a/chrome/content/preferences.xul
+++ b/chrome/content/preferences.xul
@@ -8,13 +8,16 @@
xmlns:html="http://www.w3.org/1999/xhtml"
title="&torbirdy.prefs.title;"
persist="screenX screenY width height"
- buttons="accept,cancel,extra2"
+ buttons="accept,cancel,extra1,extra2"
buttonlabelaccept="&torbirdy.prefs.save.button;"
buttonaccesskeyaccept="&torbirdy.prefs.save.key;"
buttonlabelcancel="&torbirdy.prefs.cancel.button;"
+ buttonlabelextra1="&torbirdy.prefs.extra1.button;"
buttonlabelextra2="&torbirdy.prefs.extra2.button;"
+ buttonaccesskeyextra1="&torbirdy.prefs.extra1.key;"
buttonaccesskeyextra2="&torbirdy.prefs.extra2.key;"
+ ondialogextra1="return org.torbirdy.prefs.restoreDefaults();"
ondialogextra2="return org.torbirdy.prefs.testSettings();"
ondialogaccept="return org.torbirdy.prefs.onAccept();"
onload="return org.torbirdy.prefs.onLoad();">
diff --git a/chrome/locale/en/torbirdy.dtd b/chrome/locale/en/torbirdy.dtd
index 071a07c..aae7b89 100644
--- a/chrome/locale/en/torbirdy.dtd
+++ b/chrome/locale/en/torbirdy.dtd
@@ -12,6 +12,8 @@
<!ENTITY torbirdy.prefs.save.button "Save">
<!ENTITY torbirdy.prefs.save.key "s">
<!ENTITY torbirdy.prefs.cancel.button "Cancel">
+<!ENTITY torbirdy.prefs.extra1.button "Restore Defaults">
+<!ENTITY torbirdy.prefs.extra1.key "d">
<!ENTITY torbirdy.prefs.extra2.button "Test Settings">
<!ENTITY torbirdy.prefs.extra2.key "n">
<!ENTITY torbirdy.prefs.proxy.label "Proxy Settings">
diff --git a/components/torbirdy.js b/components/torbirdy.js
index 46053c0..5794448 100644
--- a/components/torbirdy.js
+++ b/components/torbirdy.js
@@ -417,7 +417,7 @@ TorBirdy.prototype = {
// Now clear all TorBirdy preferences.
var clearPrefs = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(TORBIRDY_BRANCH).getChildList("", {});
+ .getService(Ci.nsIPrefService).getBranch(kTorBirdyBranch).getChildList("", {});
for (var i = 0; i < clearPrefs.length; i++) {
this.prefs.clearUserPref(kTorBirdyBranch + clearPrefs[i]);
}
More information about the tor-commits
mailing list