Add checkbox to show password to password dialog.

This commit is contained in:
Kovid Goyal 2008-01-10 04:23:50 +00:00
parent 532476d249
commit adfab8b01a
2 changed files with 17 additions and 3 deletions

View File

@ -13,8 +13,8 @@
## with this program; if not, write to the Free Software Foundation, Inc., ## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from PyQt4.QtGui import QDialog from PyQt4.QtGui import QDialog, QLineEdit
from PyQt4.QtCore import QSettings, QVariant from PyQt4.QtCore import QSettings, QVariant, SIGNAL, Qt
from libprs500.gui2.dialogs.password_ui import Ui_Dialog from libprs500.gui2.dialogs.password_ui import Ui_Dialog
from libprs500.gui2 import qstring_to_unicode from libprs500.gui2 import qstring_to_unicode
@ -33,7 +33,14 @@ class PasswordDialog(QDialog, Ui_Dialog):
self.gui_password.setText(pw) self.gui_password.setText(pw)
self.sname = name self.sname = name
self.msg.setText(msg) self.msg.setText(msg)
self.connect(self.show_password, SIGNAL('stateChanged(int)'), self.toggle_password)
def toggle_password(self, state):
if state == Qt.Unchecked:
self.gui_password.setEchoMode(QLineEdit.Password)
else:
self.gui_password.setEchoMode(QLineEdit.Normal)
def username(self): def username(self):
return qstring_to_unicode(self.gui_username.text()) return qstring_to_unicode(self.gui_username.text())

View File

@ -56,7 +56,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" > <item row="4" column="1" >
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -66,6 +66,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" >
<widget class="QCheckBox" name="show_password" >
<property name="text" >
<string>&amp;Show password</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>