Automatically check password checkbox and make toggle password button work.

This commit is contained in:
Felix Geyer 2011-11-16 18:46:09 +01:00
parent c7ed5f8421
commit 0ba03920df
3 changed files with 26 additions and 2 deletions

View File

@ -26,6 +26,8 @@ KeyOpenDialog::KeyOpenDialog(QWidget* parent)
{
m_ui->setupUi(this);
connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
connect(m_ui->editPassword, SIGNAL(textChanged(QString)), SLOT(activatePassword()));
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(createKey()));
}
@ -48,3 +50,13 @@ void KeyOpenDialog::createKey()
// TODO read key file
}
}
void KeyOpenDialog::togglePassword(bool checked)
{
m_ui->editPassword->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal);
}
void KeyOpenDialog::activatePassword()
{
m_ui->checkPassword->setChecked(true);
}

View File

@ -38,6 +38,8 @@ public:
private Q_SLOTS:
void createKey();
void togglePassword(bool checked);
void activatePassword();
private:
QScopedPointer<Ui::KeyOpenDialog> m_ui;

View File

@ -24,13 +24,23 @@
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="editPassword"/>
<widget class="QLineEdit" name="editPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonTogglePassword">
<widget class="QToolButton" name="buttonTogglePassword">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>