
commit 47f3c488ed92c76994ae11c09fb6c4f9baebf9fa Author: Kathy Brade <brade@torproject.org> Date: Thu Apr 18 13:28:13 2013 -0400 Add "Open Settings" button to the progress dialog. --- src/chrome/content/progress.js | 19 +++++++++++++++++-- src/chrome/content/progress.xul | 4 +++- src/chrome/locale/en/progress.dtd | 1 + src/components/tl-process.js | 7 +++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/chrome/content/progress.js b/src/chrome/content/progress.js index 3be7aac..803399f 100644 --- a/src/chrome/content/progress.js +++ b/src/chrome/content/progress.js @@ -38,9 +38,15 @@ function initDialog() gOpenerCallbackFunc = window.arguments[1]; } - // If this dialog was not opened from network settings, change Cancel to Quit. - if (!gOpenerCallbackFunc) + if (gOpenerCallbackFunc) + { + // Dialog was opened from network settings: hide Open Settings button. + var extraBtn = document.documentElement.getButton("extra1"); + extraBtn.setAttribute("hidden", true); + } + else { + // Dialog was not opened from network settings: change Cancel to Quit. var cancelBtn = document.documentElement.getButton("cancel"); var quitKey = (TorLauncherUtil.isWindows) ? "quit_win" : "quit"; cancelBtn.label = TorLauncherUtil.getLocalizedString(quitKey); @@ -97,12 +103,21 @@ function onCancel() } +function onOpenSettings() +{ + cleanup(); + window.close(); +} + + var gObserver = { // nsIObserver implementation. observe: function(aSubject, aTopic, aParam) { if (kTorProcessExitedTopic == aTopic) { + // TODO: provide a way to access tor log e.g., leave this dialog open + // and display the open settings button. onCancel(); window.close(); } diff --git a/src/chrome/content/progress.xul b/src/chrome/content/progress.xul index 2e59ebb..198f20f 100644 --- a/src/chrome/content/progress.xul +++ b/src/chrome/content/progress.xul @@ -16,8 +16,10 @@ title="&torprogress.dialog.title;" windowtype="TorLauncher:Progress" persist="screenX screenY" - buttons="cancel" + buttons="cancel,extra1" + buttonlabelextra1="&torprogress.openSettings;" ondialogcancel="return onCancel();" + ondialogextra1="onOpenSettings();" onload="initDialog();"> <script type="application/x-javascript" diff --git a/src/chrome/locale/en/progress.dtd b/src/chrome/locale/en/progress.dtd index ce247a4..f390a2b 100644 --- a/src/chrome/locale/en/progress.dtd +++ b/src/chrome/locale/en/progress.dtd @@ -1,3 +1,4 @@ <!ENTITY torprogress.dialog.title "Tor Status"> +<!ENTITY torprogress.openSettings "Open Settings"> <!ENTITY torprogress.heading "Connecting to the Tor network"> <!ENTITY torprogress.pleaseWait "Your browser will open after you are connected."> diff --git a/src/components/tl-process.js b/src/components/tl-process.js index fcfbf89..4eec340 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -318,8 +318,15 @@ TorProcessService.prototype = this._openNetworkSettings(true); // Blocks until dialog is closed. } else + { this._openProgressDialog(); + // Assume that the "Open Settings" button was pressed if Quit was + // not pressed and bootstrapping did not finish. + if (!this.mQuitSoon && !this.TorIsBootstrapDone) + this._openNetworkSettings(true); + } + // If the user pressed "Quit" within settings/progress, exit. if (this.mQuitSoon) try {