[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3478: Rather than hard-coding "tbb-firefox.exe", allow the basenam (in vidalia/branches/alt-launcher/src/vidalia: . config)
Author: sjmurdoch
Date: 2009-01-29 13:23:53 -0500 (Thu, 29 Jan 2009)
New Revision: 3478
Modified:
vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.cpp
vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.h
vidalia/branches/alt-launcher/src/vidalia/mainwindow.cpp
vidalia/branches/alt-launcher/src/vidalia/mainwindow.h
Log:
Rather than hard-coding "tbb-firefox.exe", allow the basename of the Firefox executable to be set through the browserDirectoryFilename configuration option
Modified: vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.cpp
===================================================================
--- vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.cpp 2009-01-29 03:36:47 UTC (rev 3477)
+++ vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.cpp 2009-01-29 18:23:53 UTC (rev 3478)
@@ -33,6 +33,7 @@
#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart"
#define SETTING_BROWSER_EXECUTABLE "BrowserExecutable"
#define SETTING_BROWSER_DIRECTORY "BrowserDirectory"
+#define SETTING_BROWSER_DIRECTORY_FILENAME "BrowserDirectoryFilename"
#define SETTING_IM_EXECUTABLE "IMExecutable"
#define SETTING_RUN_PROXY_AT_START "RunProxyAtStart"
#define SETTING_PROXY_EXECUTABLE "ProxyExecutable"
@@ -207,6 +208,20 @@
setValue(SETTING_BROWSER_DIRECTORY, browserDirectory);
}
+/** Returns the basename of the the web browser to execute */
+QString
+VidaliaSettings::getBrowserDirectoryFilename() const
+{
+ return value(SETTING_BROWSER_DIRECTORY_FILENAME).toString();
+}
+
+/** Sets the basename of the the web browser to execute. */
+void
+VidaliaSettings::setBrowserDirectoryFilename(const QString &browserDirectoryFilename)
+{
+ setValue(SETTING_BROWSER_DIRECTORY_FILENAME, browserDirectoryFilename);
+}
+
/** Returns a fully-qualified path to the IM client, including the
* executable name. */
QString
Modified: vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.h
===================================================================
--- vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.h 2009-01-29 03:36:47 UTC (rev 3477)
+++ vidalia/branches/alt-launcher/src/vidalia/config/vidaliasettings.h 2009-01-29 18:23:53 UTC (rev 3478)
@@ -75,6 +75,11 @@
* If set to the empty string, the browser will not be started. */
void setBrowserDirectory(const QString &browserDirectory);
+ /** Returns the basename of the the web browser to execute */
+ QString getBrowserDirectoryFilename() const;
+ /** Sets the basename of the the web browser to execute. */
+ void setBrowserDirectoryFilename(const QString &browserDirectoryFilename);
+
/** Returns a fully-qualified path to the IM client, including the
* executable name. */
QString getIMExecutable() const;
Modified: vidalia/branches/alt-launcher/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/alt-launcher/src/vidalia/mainwindow.cpp 2009-01-29 03:36:47 UTC (rev 3477)
+++ vidalia/branches/alt-launcher/src/vidalia/mainwindow.cpp 2009-01-29 18:23:53 UTC (rev 3478)
@@ -546,8 +546,13 @@
/** Start a web browser when given the directory containing the executable and profile */
void
-MainWindow::launchBrowserFromDirectory(const QString &browserDirectory)
+MainWindow::launchBrowserFromDirectory()
{
+ VidaliaSettings settings;
+
+ QString browserDirectory = settings.getBrowserDirectory();
+ QString browserDirectoryFilename = settings.getBrowserDirectoryFilename();
+
/* Set TZ=UTC (to stop leaking timezone information) and
* MOZ_NO_REMOTE=1 (to allow multiple instances of Firefox */
QStringList env = QProcess::systemEnvironment();
@@ -555,10 +560,10 @@
env << "MOZ_NO_REMOTE=1";
_browserProcess->setEnvironment(env);
- /* The browser is in DIR/App/Firefox/tbb-firefox.exe */
+ /* The browser is in <browserDirectory>/App/Firefox/<browserDirectoryFilename> */
QString browserExecutable =
- QDir::toNativeSeparators(browserDirectory + "/App/Firefox/tbb-firefox.exe");
- /* The profile is in DIR/Data/profile */
+ QDir::toNativeSeparators(browserDirectory + "/App/Firefox/" + browserDirectoryFilename);
+ /* The profile is in <browserDirectory>/Data/profile */
QString profileDir =
QDir::toNativeSeparators(browserDirectory + "/Data/profile");
@@ -598,7 +603,7 @@
/* Launch the web browser */
if (!(subprocess = settings.getBrowserDirectory()).isEmpty()) {
/* The user has set BrowserDirectory; use this */
- launchBrowserFromDirectory(subprocess);
+ launchBrowserFromDirectory();
} else if (!(subprocess = settings.getBrowserExecutable()).isEmpty()) {
/* BrowserDirectory is not set, but BrowserExecutable is; use this */
_browserProcess->setEnvironment(QProcess::systemEnvironment() << "TZ=UTC");
@@ -651,6 +656,9 @@
/* This only works on Windows for now */
#if defined(Q_OS_WIN)
+ VidaliaSettings settings;
+ QString browserDirectoryFilename = settings.getBrowserDirectoryFilename();
+
/* Get list of running processes */
QHash<qint64, QString> procList = win32_process_list();
@@ -660,11 +668,11 @@
return;
}
- /* Loop over all processes or until we find tbb-firefox.exe */
+ /* Loop over all processes or until we find <browserDirectoryFilename> */
QHashIterator<qint64, QString> i(procList);
while (i.hasNext()) {
i.next();
- if (i.value().toLower() == "tbb-firefox.exe") {
+ if (i.value().toLower() == browserDirectoryFilename) {
/* The browser is still running, so Vidalia should keep running too */
return;
}
Modified: vidalia/branches/alt-launcher/src/vidalia/mainwindow.h
===================================================================
--- vidalia/branches/alt-launcher/src/vidalia/mainwindow.h 2009-01-29 03:36:47 UTC (rev 3477)
+++ vidalia/branches/alt-launcher/src/vidalia/mainwindow.h 2009-01-29 18:23:53 UTC (rev 3478)
@@ -172,7 +172,7 @@
* previously set TorStatus value. */
TorStatus updateTorStatus(TorStatus status);
/** Start a web browser when given the directory containing the executable and profile */
- void launchBrowserFromDirectory(const QString &browserDirectory);
+ void launchBrowserFromDirectory();
/** Starts the web browser, if appropriately configured */
void startSubprocesses();
/** Starts the proxy server, if appropriately configured */