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

[vidalia-svn] r1805: Fix a bug reported by Roger: When I run Vidalia, then click (trunk/src/gui)



Author: edmanm
Date: 2007-07-19 11:30:18 -0400 (Thu, 19 Jul 2007)
New Revision: 1805

Modified:
   trunk/src/gui/mainwindow.cpp
   trunk/src/gui/mainwindow.h
   trunk/src/gui/mainwindow.ui
Log:
Fix a bug reported by Roger: When I run Vidalia, then click 'stop Tor', then
run Tor manually, then click 'start Tor', Vidalia puts up a little warning box
that says "Vidalia was unable to stop Tor."

Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp	2007-07-17 03:21:01 UTC (rev 1804)
+++ trunk/src/gui/mainwindow.cpp	2007-07-19 15:30:18 UTC (rev 1805)
@@ -238,7 +238,7 @@
 MainWindow::createActions()
 {
   _startStopAct = new QAction(QIcon(IMG_START_TOR_16), tr("Start Tor"), this);
-  connect(_startStopAct, SIGNAL(triggered()), this, SLOT(toggleTor()));
+  connect(_startStopAct, SIGNAL(triggered()), this, SLOT(start()));
 
   _exitAct = new QAction(QIcon(IMG_EXIT), tr("Exit"), this);
   connect(_exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -396,6 +396,11 @@
       ui.lblStartStopTor->setText(actionText);
       ui.lblStartStopTor->setPixmap(QPixmap(IMG_START_TOR_48));
       ui.lblStartStopTor->setStatusTip(actionText);
+
+      disconnect(_startStopAct, SIGNAL(triggered()), this, SLOT(stop()));
+      disconnect(ui.lblStartStopTor, SIGNAL(clicked()), this, SLOT(stop()));
+      connect(_startStopAct, SIGNAL(triggered()), this, SLOT(start()));
+      connect(ui.lblStartStopTor, SIGNAL(clicked()), this, SLOT(start()));
   } else if (status == Stopping) {
       if (_delayedShutdownStarted) {
         statusText = tr("Your Tor server is shutting down.\r\n" 
@@ -421,6 +426,11 @@
       ui.lblStartStopTor->setStatusTip(actionText);
       _newIdentityAct->setEnabled(true);
       ui.lblNewIdentity->setEnabled(true);
+      
+      disconnect(_startStopAct, SIGNAL(triggered()), this, SLOT(start()));
+      disconnect(ui.lblStartStopTor, SIGNAL(clicked()), this, SLOT(start()));
+      connect(_startStopAct, SIGNAL(triggered()), this, SLOT(stop()));
+      connect(ui.lblStartStopTor, SIGNAL(clicked()), this, SLOT(stop()));
   } else { /* status == Starting */
       statusText = tr("Tor is starting up");
       trayIconFile = IMG_TOR_STARTING;
@@ -462,17 +472,6 @@
   settings.setShowMainWindowAtStart(checked);
 }
 
-/** Starts Tor if it is not currently running, or stops Tor if it is already
- * running. */
-void
-MainWindow::toggleTor()
-{
-  if (_torControl->isRunning())
-    stop();
-  else
-    start();
-}
-
 /** Attempts to start Tor. If Tor fails to start, then startFailed() will be
  * called with an error message containing the reason. */
 void 

Modified: trunk/src/gui/mainwindow.h
===================================================================
--- trunk/src/gui/mainwindow.h	2007-07-17 03:21:01 UTC (rev 1804)
+++ trunk/src/gui/mainwindow.h	2007-07-19 15:30:18 UTC (rev 1805)
@@ -63,9 +63,6 @@
   ~MainWindow();
 
 private slots:
-  /** Starts Tor if it is not currently running, or stops Tor if it is already
-   * running. */
-  void toggleTor();
   /** Called when the user selects "Start" from the menu. */
   void start();
   /** Called when the Tor process fails to start. */

Modified: trunk/src/gui/mainwindow.ui
===================================================================
--- trunk/src/gui/mainwindow.ui	2007-07-17 03:21:01 UTC (rev 1804)
+++ trunk/src/gui/mainwindow.ui	2007-07-19 15:30:18 UTC (rev 1805)
@@ -810,7 +810,7 @@
    <sender>lblStartStopTor</sender>
    <signal>clicked()</signal>
    <receiver>MainWindow</receiver>
-   <slot>toggleTor()</slot>
+   <slot>start()</slot>
   </connection>
   <connection>
    <sender>lblNewIdentity</sender>