Commit 56a7e930 authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Add bridge relay help button to network settings dialog.

parent 47f3c488
......@@ -46,6 +46,8 @@ var gTorProcessService = null;
var gObsService = null;
var gIsInitialBootstrap = false;
var gIsBootstrapComplete = false;
var gRestoreAfterHelpPanelID = null;
var gRestoreAfterCancelBtnLabel = null;
function initDialog()
......@@ -85,14 +87,14 @@ function initDialog()
if (TorLauncherUtil.shouldStartAndOwnTor &&
!gTorProcessService.TorIsProcessReady)
{
showOrHideSettings(false, true); // Show "Waiting for tor to start"
showPanel("startingTor");
gObsService.addObserver(gObserver, kTorProcessReadyTopic, false);
gObsService.addObserver(gObserver, kTorProcessExitedTopic, false);
gObsService.addObserver(gObserver, kTorProcessDidNotStartTopic, false);
}
else
{
showOrHideSettings(true, false);
showPanel("settings");
readTorSettings();
}
......@@ -109,11 +111,11 @@ var gObserver = {
if (kTorProcessReadyTopic == aTopic)
{
showOrHideSettings(true, false);
showPanel("settings");
readTorSettings();
}
else if (kTorProcessDidNotStartTopic == aTopic)
showOrHideSettings(false, false);
showPanel("errorPanel");
else
close();
}
......@@ -137,7 +139,7 @@ function readTorSettings()
if (!didSucceed)
{
// Unable to communicate with tor. Hide settings and display an error.
showOrHideSettings(false, false);
showPanel("errorPanel");
setTimeout(function()
{
......@@ -153,42 +155,45 @@ function readTorSettings()
}
function showOrHideSettings(aShow, aIsStartingTor)
function showPanel(aPanelID)
{
showOrHideElem("settings", aShow);
showOrHideElem("startingTor", !aShow && aIsStartingTor);
var deckElem = document.getElementById("deck");
if (deckElem)
deckElem.selectedPanel = document.getElementById(aPanelID);
var okBtn = document.documentElement.getButton("accept");
if (okBtn)
{
if (aShow)
{
okBtn.removeAttribute("hidden");
okBtn.focus();
}
else
okBtn.setAttribute("hidden", true);
}
showOrHideButton("accept", (aPanelID == "settings"), true);
showOrHideButton("extra1", (aPanelID != "bridgeHelp"), false);
}
function showOrHideElem(aID, aShow)
function showOrHideButton(aID, aShow, aFocus)
{
if (!aID)
return;
var e = document.getElementById(aID);
if (e)
var btn = document.documentElement.getButton(aID);
if (btn)
{
if (aShow)
e.removeAttribute("hidden");
{
btn.removeAttribute("hidden");
if (aFocus)
btn.focus()
}
else
e.setAttribute("hidden", true);
btn.setAttribute("hidden", true);
}
}
function onCancel()
{
if (gRestoreAfterHelpPanelID) // Is help open?
{
closeHelp();
return false;
}
if (gIsInitialBootstrap) try
{
var obsSvc = Cc["@mozilla.org/observer-service;1"]
......@@ -208,6 +213,44 @@ function onCopyLog()
}
function onOpenHelp()
{
if (gRestoreAfterHelpPanelID) // Already open?
return;
var deckElem = document.getElementById("deck");
if (!deckElem)
return;
gRestoreAfterHelpPanelID = deckElem.selectedPanel.id;
var cancelBtn = document.documentElement.getButton("cancel");
if (cancelBtn)
{
gRestoreAfterCancelBtnLabel = cancelBtn.label;
cancelBtn.label = TorLauncherUtil.getLocalizedString("done");
}
else
gRestoreAfterCancelBtnLabel = null;
showPanel("bridgeHelp");
}
function closeHelp()
{
if (!gRestoreAfterHelpPanelID) // Already closed?
return;
var cancelBtn = document.documentElement.getButton("cancel");
if (cancelBtn && gRestoreAfterCancelBtnLabel)
cancelBtn.label = gRestoreAfterCancelBtnLabel;
gRestoreAfterCancelBtnLabel = null;
showPanel(gRestoreAfterHelpPanelID);
gRestoreAfterHelpPanelID = null;
}
// Returns true if successful.
function initProxySettings()
{
......
......@@ -16,19 +16,20 @@
title="&torsettings.dialog.title;"
windowtype="TorLauncher:NetworkSettings"
persist="screenX screenY"
buttons="accept,cancel,extra1"
buttons="accept,cancel,extra1,help"
buttonlabelextra1="&torsettings.copyLog;"
ondialogaccept="return applySettings();"
ondialogcancel="return onCancel();"
ondialogextra1="onCopyLog();"
ondialoghelp="onOpenHelp();"
onload="initDialog();">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
<stack>
<deck id="deck">
<vbox id="settings">
<vbox flex="1">
<vbox>
<hbox id="tbb-header">
<vbox>
<spacer flex="1" />
......@@ -95,7 +96,7 @@
</groupbox>
</vbox>
<vbox flex="1">
<vbox>
<checkbox id="useFirewallPorts" groupboxID="firewallSpecificSettings"
label="&torsettings.firewall.checkbox;"
oncommand="toggleElemUI(this)"/>
......@@ -108,14 +109,17 @@
</groupbox>
</vbox>
<vbox flex="1">
<vbox>
<checkbox id="useBridges" groupboxID="bridgeSpecificSettings"
label="&torsettings.useBridges.checkbox;"
oncommand="toggleElemUI(this);" />
<groupbox id="bridgeSpecificSettings">
<hbox>
<vbox flex="1">
<label value="&torsettings.useBridges.label;" control="bridgeList"/>
<hbox align="center">
<button dlgtype="help"/>
<label value="&torsettings.useBridges.label;" control="bridgeList"/>
</hbox>
<textbox id="bridgeList" multiline="true" rows="4" />
</vbox>
<!--
......@@ -132,7 +136,7 @@
</groupbox>
</vbox>
</vbox>
<vbox id="startingTor" flex="1">
<vbox id="startingTor">
<spring flex="1" />
<hbox>
<spring flex="1" />
......@@ -141,6 +145,13 @@
</hbox>
<spring flex="1" />
</vbox>
</stack>
<vbox id="bridgeHelp">
<hbox align="middle"><label>&torsettings.bridgeHelpTitle;</label></hbox>
<description>&torsettings.bridgeHelp1;</description>
<description>&torsettings.bridgeHelp2;</description>
<description>&torsettings.bridgeHelp3;</description>
</vbox>
<vbox id="errorPanel"/>
</deck>
<spring />
</dialog>
......@@ -21,3 +21,8 @@
<!ENTITY torsettings.useBridges.checkbox "My ISP blocks connections to the Tor network">
<!ENTITY torsettings.useBridges.label "Enter one or more bridge relays in the form address:port.">
<!ENTITY torsettings.copyLog "Copy Tor Log To Clipboard">
<!ENTITY torsettings.bridgeHelpTitle "Bridge Relay Help">
<!ENTITY torsettings.bridgeHelp1 "Bridge relays (or 'bridges' for short) are Tor relays that aren't listed in the main directory. Since there is no complete public list of them, even if your ISP is filtering connections to all the known Tor relays they probably won't be able to block all the bridges.">
<!ENTITY torsettings.bridgeHelp2 "To obtain some bridge relays, use a web browser to visit the following page: https://bridges.torproject.org">
<!ENTITY torsettings.bridgeHelp3 "Another way to find public bridge addresses is to send mail to bridges@torproject.org with the line 'get bridges' by itself in the body of the message. However, so we can make it harder for an attacker to learn lots of bridge addresses, you must send this request from an email address at one of the following domains: gmail.com or yahoo.com.">
......@@ -25,3 +25,4 @@ torlauncher.error_bridges_missing=You must specify one or more bridges.
torlauncher.connect=Connect
torlauncher.quit=Quit
torlauncher.quit_win=Exit
torlauncher.done=Done
......@@ -41,3 +41,17 @@ dialog.initialBootstrap #tbb-header {
font-size: 120%;
font-weight: bold;
}
#bridgeHelp {
margin: 30px;
}
#bridgeHelp label {
font-size: 120%;
font-weight: bold;
margin: 0px 0px 20px 0px;
}
#bridgeHelp description {
margin-bottom: 15px;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment