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

[vidalia-svn] r3276: Backport the 'reset your control password' and help topic st (in vidalia/branches/vidalia-0.1: . src/common src/vidalia src/vidalia/help/content/en src/vidalia/res src/vidalia/res/22x22 src/vidalia/res/48x48)



Author: edmanm
Date: 2008-11-02 19:08:59 -0500 (Sun, 02 Nov 2008)
New Revision: 3276

Added:
   vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.cpp
   vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.h
   vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.ui
   vidalia/branches/vidalia-0.1/src/vidalia/res/22x22/dialog-password.png
   vidalia/branches/vidalia-0.1/src/vidalia/res/48x48/dialog-password.png
Modified:
   vidalia/branches/vidalia-0.1/CHANGELOG
   vidalia/branches/vidalia-0.1/src/common/procutil.cpp
   vidalia/branches/vidalia-0.1/src/common/procutil.h
   vidalia/branches/vidalia-0.1/src/vidalia/CMakeLists.txt
   vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/contents.xml
   vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/troubleshooting.html
   vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.cpp
   vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.h
   vidalia/branches/vidalia-0.1/src/vidalia/res/vidalia.qrc
Log:
Backport the 'reset your control password' and help topic stuff to 0.1.x.


Modified: vidalia/branches/vidalia-0.1/CHANGELOG
===================================================================
--- vidalia/branches/vidalia-0.1/CHANGELOG	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/CHANGELOG	2008-11-03 00:08:59 UTC (rev 3276)
@@ -1,4 +1,7 @@
 0.1.10  xx-Nov-2008
+  o Add a prettier dialog for prompting people for their control port password
+    that also includes a checkbox for whether the user wants Vidalia to remember
+    the entered password, a Help button, and a Reset button (Windows only).
   o Fix a crash bug that occurred when the user clicks 'Clear' in the message
     log toolbar followed by 'Save All'. (Ticket #434)
   o Uncheck the Torbutton options by default in the Windows bundle installer

Modified: vidalia/branches/vidalia-0.1/src/common/procutil.cpp
===================================================================
--- vidalia/branches/vidalia-0.1/src/common/procutil.cpp	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/common/procutil.cpp	2008-11-03 00:08:59 UTC (rev 3276)
@@ -104,3 +104,31 @@
   return pid;
 }
 
+QHash<qint64, QString>
+process_list()
+{
+#if defined(Q_OS_WIN32)
+  return win32_process_list();
+#else
+  return QHash<qint64, QString>();
+#endif
+}
+
+bool
+process_kill(qint64 pid)
+{
+#if defined(Q_OS_WIN32)
+  HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE,
+                                static_cast<DWORD>(pid));
+  if (hProcess == NULL)
+    return false;
+
+  BOOL ret = TerminateProcess(hProcess, 0);
+  CloseHandle(hProcess);
+
+  return (ret != FALSE);
+#else
+  return false;
+#endif
+}
+

Modified: vidalia/branches/vidalia-0.1/src/common/procutil.h
===================================================================
--- vidalia/branches/vidalia-0.1/src/common/procutil.h	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/common/procutil.h	2008-11-03 00:08:59 UTC (rev 3276)
@@ -42,5 +42,13 @@
  * exist, -1 is returned. */
 qint64 read_pidfile(QString pidfile, QString *errmsg = 0);
 
+/** Return a list of all currently running PIDs and their associated process
+ * names. */
+QHash<qint64, QString> process_list();
+
+/** Attempt to kill process <b>pid</b>. Return true if the specified process
+ * was successfully terminated. Otherwise, return false. */
+bool process_kill(qint64 pid);
+
 #endif
 

Modified: vidalia/branches/vidalia-0.1/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/CMakeLists.txt	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/CMakeLists.txt	2008-11-03 00:08:59 UTC (rev 3276)
@@ -183,6 +183,7 @@
   vidaliawindow.cpp
   vmessagebox.cpp
   helperprocess.cpp
+  controlpasswordinputdialog.cpp
 )
 qt4_wrap_cpp(vidalia_SRCS
   vidalia.h
@@ -191,10 +192,12 @@
   vidaliawindow.h
   vmessagebox.h
   helperprocess.h
+  controlpasswordinputdialog.h
 )
 
 ## Specify all the Qt Designer .ui files
 qt4_wrap_ui(vidalia_SRCS
+  controlpasswordinputdialog.ui
   mainwindow.ui
   about/aboutdialog.ui
   bwgraph/bwgraph.ui

Copied: vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.cpp (from rev 3121, vidalia/trunk/src/vidalia/controlpasswordinputdialog.cpp)
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.cpp	                        (rev 0)
+++ vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.cpp	2008-11-03 00:08:59 UTC (rev 3276)
@@ -0,0 +1,104 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+/*
+** \file controlpasswordinputdialog.cpp
+** \version $Id$
+** \brief Prompts the user to enter their control port password, and gives
+** them the option to save or attempt to reset it.
+*/
+
+#include <QPushButton>
+
+#include "controlpasswordinputdialog.h"
+
+
+ControlPasswordInputDialog::ControlPasswordInputDialog(QWidget *parent)
+  : QDialog(parent)
+{
+  ui.setupUi(this);
+  setSizeGripEnabled(false);
+  setAttribute(Qt::WA_DeleteOnClose, false);
+
+  ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok
+                                     | QDialogButtonBox::Cancel
+                                     | QDialogButtonBox::Reset
+                                     | QDialogButtonBox::Help);
+
+  connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)),
+          this, SLOT(clicked(QAbstractButton*)));
+  connect(ui.linePassword, SIGNAL(textEdited(QString)),
+          this, SLOT(passwordEdited(QString)));
+
+  /* The dialog starts with an empty password field */
+  passwordEdited(QString());
+}
+
+void
+ControlPasswordInputDialog::setResetEnabled(bool enabled)
+{
+  if (enabled) {
+    ui.buttonBox->setStandardButtons(ui.buttonBox->standardButtons()
+                                      | QDialogButtonBox::Reset);
+  } else {
+    ui.buttonBox->setStandardButtons(ui.buttonBox->standardButtons()
+                                      & ~QDialogButtonBox::Reset);
+    
+  }
+}
+
+QString
+ControlPasswordInputDialog::password() const
+{
+  return ui.linePassword->text();
+}
+
+bool
+ControlPasswordInputDialog::isSavePasswordChecked() const
+{
+  return ui.chkSavePassword->isChecked();
+}
+
+void
+ControlPasswordInputDialog::passwordEdited(const QString &text)
+{
+  QPushButton *okButton = ui.buttonBox->button(QDialogButtonBox::Ok);
+  if (okButton)
+    okButton->setEnabled(! text.isEmpty());
+}
+
+void
+ControlPasswordInputDialog::clicked(QAbstractButton *button)
+{
+  QDialogButtonBox::StandardButton btn = ui.buttonBox->standardButton(button);
+  switch (btn) {
+    case QDialogButtonBox::Ok:
+    case QDialogButtonBox::Reset:
+    case QDialogButtonBox::Cancel:
+      done(btn);
+      break;
+
+    case QDialogButtonBox::Help:
+      emit helpRequested("troubleshooting.password");
+      break;
+
+    default:
+      break;
+  }
+}
+
+void
+ControlPasswordInputDialog::setVisible(bool visible)
+{
+  if (visible)
+    resize(minimumSizeHint());
+  QDialog::setVisible(visible);
+}
+

Copied: vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.h (from rev 3121, vidalia/trunk/src/vidalia/controlpasswordinputdialog.h)
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.h	                        (rev 0)
+++ vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.h	2008-11-03 00:08:59 UTC (rev 3276)
@@ -0,0 +1,78 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+/*
+** \file controlpasswordinputdialog.h
+** \version $Id$
+** \brief Prompts the user to enter their control port password, and gives
+** them the option to save or attempt to reset it.
+*/
+
+#ifndef _CONTROLPASSWORDINPUTDIALOG_H
+#define _CONTROLPASSWORDINPUTDIALOG_H
+
+#include <QDialog>
+#include <QString>
+
+#include "ui_controlpasswordinputdialog.h"
+
+
+class ControlPasswordInputDialog : public QDialog
+{
+  Q_OBJECT
+
+public:
+  /** Default constructor.
+   */
+  ControlPasswordInputDialog(QWidget *parent = 0);
+
+  /** Returns the password entered in the dialog. If the dialog was dismissed
+   * with the "Cancel" button, then the returned QString will be empty.
+   */
+  QString password() const;
+
+  /** Returns true if the "Remember my password" checkbox was checked at the
+   * time the dialog was dismissed.
+   */
+  bool isSavePasswordChecked() const;
+
+  /** If <b>enabled</b> is true, then the "Reset" button will be visible on
+   * the password input dialog. Otherwise, the "Reset" button will be hidden.
+   */
+  void setResetEnabled(bool enabled);
+
+signals:
+  /** Emitted when the user clicks on the "Help" dialog button.
+   */
+  void helpRequested(const QString &topic);
+
+protected slots:
+  /** Called when one of the QDialogButtonBox's buttons is clicked. The dialog
+   * is closed if <b>button</b> is the "Ok", "Cancel", or "Reset" button, and
+   * the clicked button's QDialogButtonBox::StandardButton enum value is
+   * returned as the dialog's result code.
+   */
+  void clicked(QAbstractButton *button);
+
+  /** Called when the user changes the password QLineEdit. If the password is
+   * empty, then the "Ok" button will be disabled. Otherwise, it is enabled.
+   */
+  void passwordEdited(const QString &text);
+
+protected:
+  /** Adjusts the size of the input dialog when it is displayed. */
+  virtual void setVisible(bool visible);
+
+private:
+    Ui::ControlPasswordInputDialog ui; /**< Qt Designer generated object. */
+};
+
+#endif
+

Copied: vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.ui (from rev 3121, vidalia/trunk/src/vidalia/controlpasswordinputdialog.ui)
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.ui	                        (rev 0)
+++ vidalia/branches/vidalia-0.1/src/vidalia/controlpasswordinputdialog.ui	2008-11-03 00:08:59 UTC (rev 3276)
@@ -0,0 +1,131 @@
+<ui version="4.0" >
+ <class>ControlPasswordInputDialog</class>
+ <widget class="QDialog" name="ControlPasswordInputDialog" >
+  <property name="windowModality" >
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>350</width>
+    <height>192</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>350</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Password Required</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset>
+    <normaloff>:/images/32x32/dialog-password.png</normaloff>:/images/32x32/dialog-password.png</iconset>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>false</bool>
+  </property>
+  <property name="modal" >
+   <bool>true</bool>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2" >
+   <item row="0" column="0" >
+    <layout class="QGridLayout" name="gridLayout" >
+     <property name="sizeConstraint" >
+      <enum>QLayout::SetDefaultConstraint</enum>
+     </property>
+     <property name="verticalSpacing" >
+      <number>12</number>
+     </property>
+     <item row="0" column="0" >
+      <widget class="QLabel" name="lblIcon" >
+       <property name="minimumSize" >
+        <size>
+         <width>48</width>
+         <height>48</height>
+        </size>
+       </property>
+       <property name="text" >
+        <string/>
+       </property>
+       <property name="pixmap" >
+        <pixmap resource="res/vidalia.qrc" >:/images/48x48/dialog-password.png</pixmap>
+       </property>
+       <property name="alignment" >
+        <set>Qt::AlignHCenter|Qt::AlignTop</set>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1" >
+      <widget class="QLabel" name="lblPrompt" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+         <horstretch>1</horstretch>
+         <verstretch>1</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize" >
+        <size>
+         <width>0</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="text" >
+        <string>Vidalia has connected to a running Tor process that requires a password. Please enter your control password: </string>
+       </property>
+       <property name="textFormat" >
+        <enum>Qt::PlainText</enum>
+       </property>
+       <property name="scaledContents" >
+        <bool>true</bool>
+       </property>
+       <property name="alignment" >
+        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+       </property>
+       <property name="wordWrap" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QCheckBox" name="chkSavePassword" >
+       <property name="text" >
+        <string>Remember my password</string>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="0" colspan="2" >
+      <widget class="QDialogButtonBox" name="buttonBox" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons" >
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1" >
+      <widget class="QLineEdit" name="linePassword" >
+       <property name="echoMode" >
+        <enum>QLineEdit::Password</enum>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="res/vidalia.qrc" />
+ </resources>
+ <connections/>
+</ui>

Modified: vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/contents.xml
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/contents.xml	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/contents.xml	2008-11-03 00:08:59 UTC (rev 3276)
@@ -55,6 +55,9 @@
   <Topic id="troubleshooting" name="Troubleshooting" html="troubleshooting.html">
     <Topic id="start" name="I Can't Start Tor" html="troubleshooting.html" section="start"/>
     <Topic id="connect" name="Vidalia Can't Connect to Tor" html="troubleshooting.html" section="connect"/>
+    <Topic id="password"
+           name="Why is Vidalia asking me for a &quot;control password&quot;?"
+           html="troubleshooting.html" section="password"/>
     <Topic id="torexited" name="Tor exited unexpectedly" html="troubleshooting.html" section="torexited"/>
     <Topic id="stop" name="Vidalia Can't Stop Tor" html="troubleshooting.html" section="stop"/>
   </Topic>

Modified: vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/troubleshooting.html
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/troubleshooting.html	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/help/content/en/troubleshooting.html	2008-11-03 00:08:59 UTC (rev 3276)
@@ -60,6 +60,58 @@
 settings</a>.
 </p>
 
+<a name="password"/>
+<h3>Why is Vidalia asking me for a "control password"?</h3>
+<p>
+Vidalia interacts with the Tor software via Tor's "control port". The control
+port lets Vidalia receive status updates from Tor, request a new identity,
+configure Tor's settings, etc. Each time Vidalia starts Tor, Vidalia
+sets a random password for Tor's control port to prevent other applications
+from also connecting to the control port and potentially compromising your
+anonymity.
+</p>
+
+<p>
+Usually this process of generating and setting a random control password
+happens in the background. There are two common situations, though, where
+Vidalia may prompt you for a password:
+</p>
+
+<ul>
+  <li>
+    <p>Vidalia crashed, but left Tor running with the last known random
+    password. After you restart Vidalia, it generates a new random password,
+    but Vidalia can't talk to Tor, because the random passwords are
+    different.</p>
+    
+    <p>If the dialog that prompts you for a control password has a <i>Reset</i>
+    button, you can click the button and Vidalia will restart Tor with a new
+    random control password.
+    </p>
+    
+    <p>If you do not see a <i>Reset</i> button, or if Vidalia is unable to
+    restart Tor for you, you can still fix the problem manually. Simply
+    go into your process or task manager, and terminate the Tor process. Then
+    use Vidalia to restart Tor and all will work again.</p>
+  </li>
+
+  <li>
+    <p>You had previously set Tor to run as a service. When Tor is set to run
+    as a service, it starts up when the system boots. If you configured Tor to
+    start as a service through Vidalia, a random password was set and saved in
+    Tor. When you reboot, Tor starts up and uses the random password it saved.
+    You login and start up Vidalia. Vidalia attempts to talk to the already
+    running Tor. Vidalia generates a random password, but it is different than
+    the saved password in the Tor service.</p>
+  
+    <p>You need to reconfigure Tor to not be a service. See the Tor wiki page on
+    running <a
+    href="https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#WinNTService";>
+    Tor as a service</a> for more information on how to remove the Tor service.</p>
+  </li>
+</ul>
+
+
 <a name="torexited"/> 
 <h3>Tor Exited Unexpectedly</h3> 
 <p> 

Modified: vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.cpp	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.cpp	2008-11-03 00:08:59 UTC (rev 3276)
@@ -28,8 +28,10 @@
 #include <clientstatusevent.h>
 #include <dangerousversionevent.h>
 #include <vmessagebox.h>
+#include <procutil.h>
 
 #include "mainwindow.h"
+#include "controlpasswordinputdialog.h"
 
 #define IMG_BWGRAPH        ":/images/16x16/utilities-system-monitor.png"
 #define IMG_CONTROL_PANEL  ":/images/16x16/system-run.png"
@@ -759,11 +761,10 @@
   QStringList args;
 
   updateTorStatus(Starting);
-  
+
   /* Check if Tor is already running separately */
   if (net_test_connect(settings.getControlAddress(),
                        settings.getControlPort())) {
-    _controlPassword = settings.getControlPassword();
     started();
     return;
   }
@@ -775,7 +776,7 @@
       touch_file(torrc, true);
     args << "-f" << torrc;
   }
-  
+
   /* Specify Tor's data directory, if different from the default */
   QString dataDirectory = settings.getDataDirectory();
   if (!dataDirectory.isEmpty())
@@ -789,10 +790,13 @@
   /* Add the control port authentication arguments */
   switch (settings.getAuthenticationMethod()) {
     case TorSettings::PasswordAuth:
-      if (settings.useRandomPassword())
+      if (settings.useRandomPassword()) {
         _controlPassword = TorSettings::randomPassword();
-      else
+        _useSavedPassword = false;
+      } else {
         _controlPassword = settings.getControlPassword();
+        _useSavedPassword = true;
+      }
       args << "HashedControlPassword"
            << TorSettings::hashPassword(_controlPassword)
            << "CookieAuthentication"  << "0";
@@ -805,7 +809,7 @@
       args << "CookieAuthentication"  << "0"
            << "HashedControlPassword" << "";
   }
-  
+
   /* Add custom user and group information (if specified) */
   QString user = settings.getUser();
   if (!user.isEmpty())
@@ -1077,6 +1081,10 @@
   } else if (authMethod == TorSettings::PasswordAuth) {
     /* Get the control password and send it to Tor */
     vNotice("Authenticating using 'hashed password' authentication.");
+    if (_useSavedPassword) {
+      TorSettings settings;
+      _controlPassword = settings.getControlPassword();
+    }
     return _torControl->authenticate(_controlPassword);
   }
   /* No authentication. Send an empty password. */
@@ -1148,19 +1156,49 @@
 
   /* Parsing log messages is evil, but we're left with little option */
   if (errmsg.contains("Password did not match")) {
-    /* Bad password, so prompt for a new one. */
-    QString password = QInputDialog::getText(this,
-                         tr("Password Authentication Required"),
-                         tr("Please enter your control password (not the hash):"),
-                         QLineEdit::Password);
-    if (!password.isEmpty()) {
-      /* XXX: We should ask the user if they really want to save the password
-       * they just typed in. */
-      TorSettings settings;
-      settings.setAuthenticationMethod(TorSettings::PasswordAuth);
-      settings.setControlPassword(password);
-      settings.setUseRandomPassword(false);
+    ControlPasswordInputDialog dlg;
+    connect(&dlg, SIGNAL(helpRequested(QString)),
+            this, SLOT(showHelpDialog(QString)));
+
+    qint64 torPid = 0;
+
+#if defined(Q_OS_WIN32)
+    QHash<qint64, QString> procs = process_list();
+    foreach (qint64 pid, procs.keys()) {
+      if (! procs.value(pid).compare("tor.exe", Qt::CaseInsensitive)) {
+        torPid = pid;
+        break;
+      }
+    }
+    dlg.setResetEnabled(torPid > 0);
+#else
+    dlg.setResetEnabled(false);
+#endif
+
+    int ret = dlg.exec();
+    if (ret == QDialogButtonBox::Ok) {
+      if (dlg.isSavePasswordChecked()) {
+        TorSettings settings;
+        settings.setAuthenticationMethod(TorSettings::PasswordAuth);
+        settings.setUseRandomPassword(false);
+        settings.setControlPassword(dlg.password());
+        _useSavedPassword = true;
+      } else {
+        _controlPassword = dlg.password();
+        _useSavedPassword = false;
+      }
       retry = true;
+    } else if (ret == QDialogButtonBox::Reset) {
+      if (! process_kill(torPid)) {
+        VMessageBox::warning(this,
+          tr("Password Reset Failed"),
+          p(tr("Vidalia tried to reset Tor's control password, but was not "
+               "able to restart the Tor software. Please check your Task "
+               "Manager to ensure there are no other Tor processes running.")),
+               VMessageBox::Ok|VMessageBox::Default);
+      } else {
+        retry = true;
+      }
     }
   } else {
     /* Something else went wrong */

Modified: vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.h
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.h	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/mainwindow.h	2008-11-03 00:08:59 UTC (rev 3276)
@@ -198,6 +198,9 @@
   /** Remembers the control password between when we start Tor with a hash of
    * the password and when we need to provide the password itself. */
   QString _controlPassword;
+  /** Set to true if we should use the control password saved in TorSettings
+   * when authenticating to Tor. */
+  bool _useSavedPassword;
   /** The Vidalia icon that sits in the tray. */
   TrayIcon _trayIcon;
  

Copied: vidalia/branches/vidalia-0.1/src/vidalia/res/22x22/dialog-password.png (from rev 3116, vidalia/trunk/src/vidalia/res/22x22/dialog-password.png)
===================================================================
(Binary files differ)

Copied: vidalia/branches/vidalia-0.1/src/vidalia/res/48x48/dialog-password.png (from rev 3116, vidalia/trunk/src/vidalia/res/48x48/dialog-password.png)
===================================================================
(Binary files differ)

Modified: vidalia/branches/vidalia-0.1/src/vidalia/res/vidalia.qrc
===================================================================
--- vidalia/branches/vidalia-0.1/src/vidalia/res/vidalia.qrc	2008-11-02 23:34:57 UTC (rev 3275)
+++ vidalia/branches/vidalia-0.1/src/vidalia/res/vidalia.qrc	2008-11-03 00:08:59 UTC (rev 3276)
@@ -30,6 +30,7 @@
     </qresource>
     <qresource prefix="/images">
         <file>22x22/application-exit.png</file>
+        <file>22x22/dialog-password.png</file>
         <file>22x22/edit-copy.png</file>
         <file>22x22/edit-delete.png</file>
         <file>22x22/folder.png</file>
@@ -85,6 +86,7 @@
     </qresource>
     <qresource prefix="/images">
         <file>48x48/applications-internet.png</file>
+        <file>48x48/dialog-password.png</file>
         <file>48x48/media-playback-start.png</file>
         <file>48x48/media-playback-stop.png</file>
         <file>48x48/modem.png</file>