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

[or-cvs] r14896: Patch to Vidalia to add IM client option (not used yet) (torbrowser/branches/pidgin/src/current-patches)



Author: sjm217
Date: 2008-06-02 10:47:59 -0400 (Mon, 02 Jun 2008)
New Revision: 14896

Added:
   torbrowser/branches/pidgin/src/current-patches/vidalia-startim.patch
Log:
Patch to Vidalia to add IM client option (not used yet)

Added: torbrowser/branches/pidgin/src/current-patches/vidalia-startim.patch
===================================================================
--- torbrowser/branches/pidgin/src/current-patches/vidalia-startim.patch	                        (rev 0)
+++ torbrowser/branches/pidgin/src/current-patches/vidalia-startim.patch	2008-06-02 14:47:59 UTC (rev 14896)
@@ -0,0 +1,152 @@
+Index: src/vidalia/config/vidaliasettings.cpp
+===================================================================
+--- src/vidalia/config/vidaliasettings.cpp	(revision 2643)
++++ src/vidalia/config/vidaliasettings.cpp	(working copy)
+@@ -32,6 +32,7 @@
+ #define SETTING_DATA_DIRECTORY      "DataDirectory"
+ #define SETTING_SHOW_MAINWINDOW_AT_START  "ShowMainWindowAtStart"
+ #define SETTING_BROWSER_EXECUTABLE  "BrowserExecutable"
++#define SETTING_IM_EXECUTABLE       "IMExecutable"
+ #define SETTING_RUN_PROXY_AT_START  "RunProxyAtStart"
+ #define SETTING_PROXY_EXECUTABLE    "ProxyExecutable"
+ #define SETTING_PROXY_EXECUTABLE_ARGUMENTS  "ProxyExecutableArguments"
+@@ -66,6 +67,7 @@
+   setDefault(SETTING_RUN_TOR_AT_START, true);
+   setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
+   setDefault(SETTING_BROWSER_EXECUTABLE, "");
++  setDefault(SETTING_IM_EXECUTABLE, "");
+   setDefault(SETTING_RUN_PROXY_AT_START, false);
+   setDefault(SETTING_PROXY_EXECUTABLE, "");
+   setDefault(SETTING_PROXY_EXECUTABLE_ARGUMENTS, QStringList());
+@@ -181,6 +183,22 @@
+   setValue(SETTING_BROWSER_EXECUTABLE, browserExecutable);
+ }
+ 
++/** Returns a fully-qualified path to the IM client, including the
++ * executable name. */
++QString
++VidaliaSettings::getIMExecutable() const
++{
++  return QDir::convertSeparators(value(SETTING_IM_EXECUTABLE).toString());
++}
++
++/** Sets the location and name of the IM client executable to the given string.
++ * If set to the empty string, the browser will not be started. */
++void
++VidaliaSettings::setIMExecutable(const QString &IMExecutable)
++{
++  setValue(SETTING_IM_EXECUTABLE, IMExecutable);
++}
++
+ /** Returns true if Vidalia should start a proxy application when it
+  * starts. */
+ bool
+Index: src/vidalia/config/vidaliasettings.h
+===================================================================
+--- src/vidalia/config/vidaliasettings.h	(revision 2643)
++++ src/vidalia/config/vidaliasettings.h	(working copy)
+@@ -68,6 +68,13 @@
+    * string. If set to the empty string, the browser will not be started. */
+   void setBrowserExecutable(const QString &browserExecutable);
+ 
++  /** Returns a fully-qualified path to the IM client, including the
++   * executable name. */
++  QString getIMExecutable() const;
++  /** Sets the location and name of the IM client executable to the given
++   * string. If set to the empty string, the client will not be started. */
++  void setIMExecutable(const QString &IMExecutable);
++
+   /** Returns true if Vidalia should start a proxy application when it
+    * starts. */
+   bool runProxyAtStart();
+Index: src/vidalia/mainwindow.cpp
+===================================================================
+--- src/vidalia/mainwindow.cpp	(revision 2643)
++++ src/vidalia/mainwindow.cpp	(working copy)
+@@ -128,10 +128,17 @@
+   /* Create a new HelperProcess object, used to start the web browser */
+   _browserProcess = new HelperProcess(this);
+   connect(_browserProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
+-           this, SLOT(onBrowserFinished(int, QProcess::ExitStatus)));
++           this, SLOT(onSubprocessFinished(int, QProcess::ExitStatus)));
+   connect(_browserProcess, SIGNAL(startFailed(QString)),
+            this, SLOT(onBrowserFailed(QString)));
+ 
++  /* Create a new HelperProcess object, used to start the web browser */
++  _imProcess = new HelperProcess(this);
++  connect(_imProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
++           this, SLOT(onSubprocessFinished(int, QProcess::ExitStatus)));
++  connect(_imProcess, SIGNAL(startFailed(QString)),
++           this, SLOT(onIMFailed(QString)));
++
+   /* Create a new HelperProcess object, used to start the proxy server */
+   _proxyProcess = new HelperProcess(this);
+   connect(_proxyProcess, SIGNAL(startFailed(QString)),
+@@ -419,8 +426,8 @@
+     _browserProcess->start(executable, QStringList());
+ }
+ 
+-/** Called when browser has exited */
+-void MainWindow::onBrowserFinished(int exitCode, QProcess::ExitStatus exitStatus)
++/** Called when browser or IM client have exited */
++void MainWindow::onSubprocessFinished(int exitCode, QProcess::ExitStatus exitStatus)
+ {
+   Q_UNUSED(exitCode)
+   Q_UNUSED(exitStatus)
+@@ -428,7 +435,7 @@
+   shutdown();
+ }
+ 
+-/** Called when the web browser, for example, because the path
++/** Called when the web browser failed to start, for example, because the path
+  * specified to the web browser executable didn't lead to an executable. */
+ void
+ MainWindow::onBrowserFailed(QString errmsg)
+@@ -441,6 +448,19 @@
+               VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape);
+ }
+ 
++/** Called when the IM client failed to start, for example, because the path
++ * specified to the IM client executable didn't lead to an executable. */
++void
++MainWindow::onIMFailed(QString errmsg)
++{
++  Q_UNUSED(errmsg);
++ 
++  /* Display an error message and see if the user wants some help */
++  VMessageBox::warning(this, tr("Error starting IM client"),
++              tr("Vidalia was unable to start the configured IM client"),
++              VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape);
++}
++
+ /** Starts the proxy server, if appropriately configured */
+ void MainWindow::startProxy()
+ {
+Index: src/vidalia/mainwindow.h
+===================================================================
+--- src/vidalia/mainwindow.h	(revision 2643)
++++ src/vidalia/mainwindow.h	(working copy)
+@@ -101,10 +101,12 @@
+   void showServerConfigDialog();
+   /** Called when the "show on startup" checkbox is toggled. */
+   void toggleShowOnStartup(bool checked);
+-  /** Called when the web browser has stopped */
+-  void onBrowserFinished(int exitCode, QProcess::ExitStatus exitStatus);
++  /** Called when the web browser or IM client have stopped */
++  void onSubprocessFinished(int exitCode, QProcess::ExitStatus exitStatus);
+   /** Called web the web browser failed to start */
+   void onBrowserFailed(QString errmsg);
++  /** Called web the IM client failed to start */
++  void onIMFailed(QString errmsg);
+   /** Called when the proxy server fails to start */
+   void onProxyFailed(QString errmsg);
+ 
+@@ -179,6 +181,8 @@
+   TorControl* _torControl;
+   /** A HelperProcess object that manages the web browser */
+   HelperProcess* _browserProcess;
++  /** A HelperProcess object that manages the IM client */
++  HelperProcess* _imProcess;
+   /** A HelperProcess object that manages the proxy server */
+   HelperProcess* _proxyProcess;
+   /** Remembers the control password between when we start Tor with a hash of