[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/alpha] Adds new controlpassword approach
commit 20188bbd30299098a5f071d8aee3e6b4c736c3db
Author: Tomas Touceda <chiiph@xxxxxxxxxx>
Date: Sat Apr 9 16:28:00 2011 -0300
Adds new controlpassword approach
---
src/vidalia/ControlPasswordInputDialog.cpp | 32 +-----
src/vidalia/ControlPasswordInputDialog.h | 15 ---
src/vidalia/ControlPasswordInputDialog.ui | 149 +++++++++++++++------------
src/vidalia/MainWindow.cpp | 33 +------
4 files changed, 92 insertions(+), 137 deletions(-)
diff --git a/src/vidalia/ControlPasswordInputDialog.cpp b/src/vidalia/ControlPasswordInputDialog.cpp
index 5cc4dec..dfa2a53 100644
--- a/src/vidalia/ControlPasswordInputDialog.cpp
+++ b/src/vidalia/ControlPasswordInputDialog.cpp
@@ -27,17 +27,11 @@ ControlPasswordInputDialog::ControlPasswordInputDialog(QWidget *parent)
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
@@ -46,32 +40,16 @@ ControlPasswordInputDialog::setResetEnabled(bool enabled)
if (enabled) {
ui.buttonBox->setStandardButtons(ui.buttonBox->standardButtons()
| QDialogButtonBox::Reset);
+ ui.lblOptionOne->setVisible(false);
+ ui.lblOptionTwo->setVisible(true);
} else {
ui.buttonBox->setStandardButtons(ui.buttonBox->standardButtons()
& ~QDialogButtonBox::Reset);
+ ui.lblOptionOne->setVisible(true);
+ ui.lblOptionTwo->setVisible(false);
}
}
-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)
{
@@ -96,7 +74,7 @@ void
ControlPasswordInputDialog::setVisible(bool visible)
{
if (visible)
- resize(minimumSizeHint());
+ adjustSize();
QDialog::setVisible(visible);
}
diff --git a/src/vidalia/ControlPasswordInputDialog.h b/src/vidalia/ControlPasswordInputDialog.h
index 9722062..47b24b0 100644
--- a/src/vidalia/ControlPasswordInputDialog.h
+++ b/src/vidalia/ControlPasswordInputDialog.h
@@ -32,16 +32,6 @@ public:
*/
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.
*/
@@ -60,11 +50,6 @@ protected slots:
*/
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);
diff --git a/src/vidalia/ControlPasswordInputDialog.ui b/src/vidalia/ControlPasswordInputDialog.ui
index 00b5002..0b51081 100644
--- a/src/vidalia/ControlPasswordInputDialog.ui
+++ b/src/vidalia/ControlPasswordInputDialog.ui
@@ -1,119 +1,136 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>ControlPasswordInputDialog</class>
- <widget class="QDialog" name="ControlPasswordInputDialog" >
- <property name="windowModality" >
+ <widget class="QDialog" name="ControlPasswordInputDialog">
+ <property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
- <property name="geometry" >
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>350</width>
- <height>192</height>
+ <width>356</width>
+ <height>189</height>
</rect>
</property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
- <property name="windowTitle" >
- <string>Password Required</string>
+ <property name="windowTitle">
+ <string>Problem connecting to Tor</string>
</property>
- <property name="windowIcon" >
+ <property name="windowIcon">
<iconset>
<normaloff>:/images/32x32/dialog-password.png</normaloff>:/images/32x32/dialog-password.png</iconset>
</property>
- <property name="sizeGripEnabled" >
+ <property name="sizeGripEnabled">
<bool>false</bool>
</property>
- <property name="modal" >
+ <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" >
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</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" >
+ <item row="0" column="1">
+ <widget class="QLabel" name="lblPrompt">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <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 name="text">
+ <string>Vidalia has detected that there is a Tor running, probably launched by another Vidalia instance.</string>
</property>
- <property name="textFormat" >
+ <property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
- <property name="scaledContents" >
+ <property name="scaledContents">
<bool>true</bool>
</property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
- <property name="wordWrap" >
+ <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>
+ <item row="6" 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="3" column="0" colspan="2" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
+ <item row="1" column="1">
+ <widget class="QLabel" name="lblOptionOne">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
</property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string>Vidalia is unable to connect to it.
+You could:
+* Exit Vidalia, and try to kill the running Tor instance.</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::AutoText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="openExternalLinks">
+ <bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="linePassword" >
- <property name="echoMode" >
- <enum>QLineEdit::Password</enum>
+ <item row="2" column="1">
+ <widget class="QLabel" name="lblOptionTwo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Vidalia is unable to connect to it.
+You could:
+* Exit Vidalia, or
+* Press Reset to try to restart Tor.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
</property>
</widget>
</item>
@@ -122,7 +139,7 @@
</layout>
</widget>
<resources>
- <include location="res/vidalia.qrc" />
+ <include location="res/vidalia.qrc"/>
</resources>
<connections/>
</ui>
diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index d61b5e8..84849b6 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -865,43 +865,18 @@ MainWindow::authenticationFailed(QString errmsg)
#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 (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.")),
+ p(tr("Vidalia tried to restart Tor, but was not "
+ "able to. 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 */
- int ret = VMessageBox::warning(this,
- tr("Authentication Error"),
- p(tr("Vidalia was unable to authenticate to the Tor software. "
- "(%1)").arg(errmsg)) +
- p(tr("Please check your control port authentication "
- "settings.")),
- VMessageBox::ShowSettings|VMessageBox::Default,
- VMessageBox::Cancel|VMessageBox::Escape);
-
- if (ret == VMessageBox::ShowSettings)
- showConfigDialog(ConfigDialog::Advanced);
}
if (_torControl->isRunning())
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits