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

[or-cvs] r12744: Make location of web browser a configurable parameter (torpedo/trunk/build-scripts)



Author: sjm217
Date: 2007-12-09 12:56:27 -0500 (Sun, 09 Dec 2007)
New Revision: 12744

Modified:
   torpedo/trunk/build-scripts/vidalia-startbrowser.patch
Log:
Make location of web browser a configurable parameter

Modified: torpedo/trunk/build-scripts/vidalia-startbrowser.patch
===================================================================
--- torpedo/trunk/build-scripts/vidalia-startbrowser.patch	2007-12-09 17:43:43 UTC (rev 12743)
+++ torpedo/trunk/build-scripts/vidalia-startbrowser.patch	2007-12-09 17:56:27 UTC (rev 12744)
@@ -91,6 +91,64 @@
  )
  
  ## Specify all the Qt Designer .ui files
+Index: src/vidalia/config/vidaliasettings.cpp
+===================================================================
+--- src/vidalia/config/vidaliasettings.cpp	(revision 2205)
++++ src/vidalia/config/vidaliasettings.cpp	(working copy)
+@@ -42,6 +42,7 @@
+ #define SETTING_RUN_TOR_AT_START    "RunTorAtStart"
+ #define SETTING_DATA_DIRECTORY      "DataDirectory"
+ #define SETTING_SHOW_MAINWINDOW_AT_START  "ShowMainWindowAtStart"
++#define SETTING_BROWSER_EXECUTABLE  "BrowserExecutable"
+ 
+ #if defined(Q_OS_WIN32)
+ #define STARTUP_REG_KEY        "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
+@@ -72,6 +73,7 @@
+   setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
+   setDefault(SETTING_RUN_TOR_AT_START, true);
+   setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
++  setDefault(SETTING_BROWSER_EXECUTABLE, "");
+ }
+ 
+ /** Gets the currently preferred language code for Vidalia. */
+@@ -168,3 +170,19 @@
+ #endif
+ }
+ 
++/** Returns a fully-qualified path to the web browser, including the
++ * executable name. */
++QString
++VidaliaSettings::getBrowserExecutable() const
++{
++  return QDir::convertSeparators(value(SETTING_BROWSER_EXECUTABLE).toString());
++}
++
++/** Sets the location and name of the web browser executable to the given string.
++ * If set to the empty string, the browser will not be started. */
++void
++VidaliaSettings::setBrowserExecutable(const QString &browserExecutable)
++{
++  setValue(SETTING_BROWSER_EXECUTABLE, browserExecutable);
++}
++
+Index: src/vidalia/config/vidaliasettings.h
+===================================================================
+--- src/vidalia/config/vidaliasettings.h	(revision 2205)
++++ src/vidalia/config/vidaliasettings.h	(working copy)
+@@ -71,6 +71,13 @@
+   bool runVidaliaOnBoot();
+   /** Set whether to run Vidalia on system boot. */
+   void setRunVidaliaOnBoot(bool run);
++
++  /** Returns a fully-qualified path to the web browser, including the
++   * executable name. */
++  QString getBrowserExecutable() const;
++  /** Sets the location and name of the web browser executable to the given string.
++   * If set to the empty string, the browser will not be started. */
++  void setBrowserExecutable(const QString &browserExecutable);
+ };
+ 
+ #endif
 Index: src/vidalia/mainwindow.cpp
 ===================================================================
 --- src/vidalia/mainwindow.cpp	(revision 2205)
@@ -107,14 +165,18 @@
    /* Catch signals when the application is running or shutting down */
    connect(vApp, SIGNAL(running()), this, SLOT(running()));
    connect(vApp, SIGNAL(shutdown()), this, SLOT(shutdown()));
-@@ -427,6 +432,18 @@
+@@ -427,6 +432,22 @@
  #endif
  }
  
 +/** Starts the web browser, if appropriately configured */
 +void MainWindow::startBrowser(TorStatus status)
 +{
-+  _browserProcess->start("C:/build/FirefoxPortable/FirefoxPortable.exe", QStringList());
++  VidaliaSettings settings;
++  QString executable = settings.getBrowserExecutable();
++  
++  if (!executable.isEmpty())
++    _browserProcess->start(executable, QStringList());
 +}
 +
 +/** Called when browser has exited */
@@ -126,7 +188,7 @@
  /** Updates the UI to reflect Tor's current <b>status</b>. Returns the
   * previously set TorStatus value.*/
  MainWindow::TorStatus
-@@ -1006,6 +1023,7 @@
+@@ -1006,6 +1027,7 @@
  MainWindow::circuitEstablished()
  {
    updateTorStatus(CircuitEstablished);