[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10290: [darcs-to-svn @ remember previous "custom" proxy settings] O (in torbutton/trunk/src: . chrome/content defaults/preferences)



Author: squires
Date: 2007-05-22 01:29:10 -0400 (Tue, 22 May 2007)
New Revision: 10290

Modified:
   torbutton/trunk/src/CHANGELOG
   torbutton/trunk/src/chrome/content/preferences.js
   torbutton/trunk/src/defaults/preferences/preferences.js
Log:
[darcs-to-svn @ remember previous "custom" proxy settings]

Original author: squires@xxxxxxxxx
Date: 2006-11-20 06:24:48+00:00

Modified: torbutton/trunk/src/CHANGELOG
===================================================================
--- torbutton/trunk/src/CHANGELOG	2007-05-22 05:29:04 UTC (rev 10289)
+++ torbutton/trunk/src/CHANGELOG	2007-05-22 05:29:10 UTC (rev 10290)
@@ -5,6 +5,7 @@
             the toolbar (ff >= 1.5 only)
   * bugfix: clarify the wording of the one-liner extension description
   * bugfix: bypassing privoxy with Firefox <= 1.0 is not recommended
+  * bugfix: remember previous "custom" proxy settings
   * misc: new icons
   * misc: keyboard shortcut re-assigned to ctrl-2
   * new: previous proxy settings are restored after exiting tor mode

Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js	2007-05-22 05:29:04 UTC (rev 10289)
+++ torbutton/trunk/src/chrome/content/preferences.js	2007-05-22 05:29:10 UTC (rev 10290)
@@ -8,6 +8,8 @@
 function torbutton_prefs_set_field_attributes(doc)
 {
     torbutton_log(4, "called prefs_set_field_attributes()");
+    var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+    var o_customprefs = torbutton_get_prefbranch('extensions.torbutton.custom.');
 
     doc.getElementById('torbutton_panelStyle').setAttribute("disabled", !doc.getElementById('torbutton_displayStatusPanel').checked);
     doc.getElementById('torbutton_panelStyleText').setAttribute("disabled", !doc.getElementById('torbutton_displayStatusPanel').checked);
@@ -78,6 +80,16 @@
         doc.getElementById('torbutton_gopherPort').disabled = false;
         doc.getElementById('torbutton_socksHost').disabled = false;
         doc.getElementById('torbutton_socksPort').disabled = false;
+        doc.getElementById('torbutton_httpProxy').value    = o_customprefs.getCharPref('http_proxy');
+        doc.getElementById('torbutton_httpPort').value     = o_customprefs.getIntPref('http_port');
+        doc.getElementById('torbutton_httpsProxy').value   = o_customprefs.getCharPref('https_proxy');
+        doc.getElementById('torbutton_httpsPort').value    = o_customprefs.getIntPref('https_port');
+        doc.getElementById('torbutton_ftpProxy').value     = o_customprefs.getCharPref('ftp_proxy');
+        doc.getElementById('torbutton_ftpPort').value      = o_customprefs.getIntPref('ftp_port');
+        doc.getElementById('torbutton_gopherProxy').value  = o_customprefs.getCharPref('gopher_proxy');
+        doc.getElementById('torbutton_gopherPort').value   = o_customprefs.getIntPref('gopher_port');
+        doc.getElementById('torbutton_socksHost').value    = o_customprefs.getCharPref('socks_host');
+        doc.getElementById('torbutton_socksPort').value    = o_customprefs.getIntPref('socks_port');
     }
 }
 
@@ -127,6 +139,7 @@
 function torbutton_prefs_save(doc) {
     torbutton_log(4, "called prefs_save()");
     var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+    var o_customprefs = torbutton_get_prefbranch('extensions.torbutton.custom.');
 
     o_torprefs.setBoolPref('display_panel',   doc.getElementById('torbutton_displayStatusPanel').checked);
     o_torprefs.setCharPref('panel_style',     doc.getElementById('torbutton_panelStyle').value);
@@ -142,6 +155,20 @@
     o_torprefs.setIntPref('gopher_port',      doc.getElementById('torbutton_gopherPort').value);
     o_torprefs.setCharPref('socks_host',      doc.getElementById('torbutton_socksHost').value);
     o_torprefs.setIntPref('socks_port',       doc.getElementById('torbutton_socksPort').value);
+
+    if (doc.getElementById('torbutton_settingsMethod').value == 'custom')
+    {
+        o_customprefs.setCharPref('http_proxy',      doc.getElementById('torbutton_httpProxy').value);
+        o_customprefs.setIntPref('http_port',        doc.getElementById('torbutton_httpPort').value);
+        o_customprefs.setCharPref('https_proxy',     doc.getElementById('torbutton_httpsProxy').value);
+        o_customprefs.setIntPref('https_port',       doc.getElementById('torbutton_httpsPort').value);
+        o_customprefs.setCharPref('ftp_proxy',       doc.getElementById('torbutton_ftpProxy').value);
+        o_customprefs.setIntPref('ftp_port',         doc.getElementById('torbutton_ftpPort').value);
+        o_customprefs.setCharPref('gopher_proxy',    doc.getElementById('torbutton_gopherProxy').value);
+        o_customprefs.setIntPref('gopher_port',      doc.getElementById('torbutton_gopherPort').value);
+        o_customprefs.setCharPref('socks_host',      doc.getElementById('torbutton_socksHost').value);
+        o_customprefs.setIntPref('socks_port',       doc.getElementById('torbutton_socksPort').value);
+    }
     // o_torprefs.setBoolPref('prompt_before_visiting_excluded_sites', doc.getElementById('torbutton_warnUponExcludedSite').checked);
 
     // if tor settings were initially active, update the active settings to reflect any changes

Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js	2007-05-22 05:29:04 UTC (rev 10289)
+++ torbutton/trunk/src/defaults/preferences/preferences.js	2007-05-22 05:29:10 UTC (rev 10290)
@@ -14,6 +14,16 @@
 pref("extensions.torbutton.gopher_port",0);
 pref("extensions.torbutton.socks_host","");
 pref("extensions.torbutton.socks_port",0);
+pref("extensions.torbutton.custom.http_proxy","");
+pref("extensions.torbutton.custom.http_port",0);
+pref("extensions.torbutton.custom.https_proxy","");
+pref("extensions.torbutton.custom.https_port",0);
+pref("extensions.torbutton.custom.ftp_proxy","");
+pref("extensions.torbutton.custom.ftp_port",0);
+pref("extensions.torbutton.custom.gopher_proxy","");
+pref("extensions.torbutton.custom.gopher_port",0);
+pref("extensions.torbutton.custom.socks_host","");
+pref("extensions.torbutton.custom.socks_port",0);
 pref("extensions.torbutton.saved.type", 0);
 pref("extensions.torbutton.saved.http_proxy", "");
 pref("extensions.torbutton.saved.http_port",0);