diff --git a/src/gui/ChangeMasterKeyWidget.cpp b/src/gui/ChangeMasterKeyWidget.cpp index d75776c7d..4349f729b 100644 --- a/src/gui/ChangeMasterKeyWidget.cpp +++ b/src/gui/ChangeMasterKeyWidget.cpp @@ -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(); diff --git a/src/gui/ChangeMasterKeyWidget.h b/src/gui/ChangeMasterKeyWidget.h index ef9ab18d4..4342a933f 100644 --- a/src/gui/ChangeMasterKeyWidget.h +++ b/src/gui/ChangeMasterKeyWidget.h @@ -47,6 +47,7 @@ private Q_SLOTS: void reject(); void togglePassword(bool checked); void createKeyFile(); + void browseKeyFile(); private: const QScopedPointer m_ui;