Implement browse key file in ChangeMasterKeyWidget

This commit is contained in:
Thom Troy 2012-06-10 17:40:05 +01:00 committed by Florian Geyer
parent 5217199d0a
commit a5f7d0277f
2 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,7 @@ ChangeMasterKeyWidget::ChangeMasterKeyWidget(QWidget* parent)
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
connect(m_ui->createKeyFileButton, SIGNAL(clicked()), SLOT(createKeyFile()));
connect(m_ui->browseKeyFileButton, SIGNAL(clicked()), SLOT(browseKeyFile()));
}
ChangeMasterKeyWidget::~ChangeMasterKeyWidget()
@ -69,6 +70,20 @@ void ChangeMasterKeyWidget::createKeyFile()
}
}
void ChangeMasterKeyWidget::browseKeyFile()
{
QString fileName = fileDialog()->getOpenFileName(this, tr("Select a key file"), QString(),
tr("Key Files") + " (*.key);;" + tr("All files (*)"));
if(!fileName.isEmpty())
{
if(m_ui->keyFileGroup->isEnabled())
{
m_ui->keyFileCombo->setEditText(fileName);
}
}
}
void ChangeMasterKeyWidget::clearForms()
{
m_key.clear();

View File

@ -47,6 +47,7 @@ private Q_SLOTS:
void reject();
void togglePassword(bool checked);
void createKeyFile();
void browseKeyFile();
private:
const QScopedPointer<Ui::ChangeMasterKeyWidget> m_ui;