From e987479d041a28d2f3ba24982af3c1d44d2ee006 Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Sat, 3 Feb 2018 08:17:38 +0200 Subject: [PATCH] SSH Agent: Always use freshly selected key --- src/gui/entry/EditEntryWidget.cpp | 10 +++++++++- src/gui/entry/EditEntryWidget.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 707d2f6d2..eef1b5ed8 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -271,7 +271,7 @@ void EditEntryWidget::setupSSHAgent() m_sshAgentUi->publicKeyEdit->setFont(fixedFont); connect(m_sshAgentUi->attachmentRadioButton, SIGNAL(clicked(bool)), SLOT(updateSSHAgentKeyInfo())); - connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateSSHAgentKeyInfo())); + connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateSSHAgentAttachment())); connect(m_sshAgentUi->externalFileRadioButton, SIGNAL(clicked(bool)), SLOT(updateSSHAgentKeyInfo())); connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(QString)), SLOT(updateSSHAgentKeyInfo())); connect(m_sshAgentUi->browseButton, SIGNAL(clicked()), SLOT(browsePrivateKey())); @@ -323,6 +323,12 @@ void EditEntryWidget::updateSSHAgent() updateSSHAgentKeyInfo(); } +void EditEntryWidget::updateSSHAgentAttachment() +{ + m_sshAgentUi->attachmentRadioButton->setChecked(true); + updateSSHAgentKeyInfo(); +} + void EditEntryWidget::updateSSHAgentKeyInfo() { m_sshAgentUi->addToAgentButton->setEnabled(false); @@ -398,6 +404,8 @@ void EditEntryWidget::browsePrivateKey() QString fileName = QFileDialog::getOpenFileName(this, tr("Select private key"), ""); if (!fileName.isEmpty()) { m_sshAgentUi->externalFileEdit->setText(fileName); + m_sshAgentUi->externalFileRadioButton->setChecked(true); + updateSSHAgentKeyInfo(); } } diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h index b23f7b658..bd9f5cd0f 100644 --- a/src/gui/entry/EditEntryWidget.h +++ b/src/gui/entry/EditEntryWidget.h @@ -101,6 +101,7 @@ private slots: void toggleHideNotes(bool visible); #ifdef WITH_XC_SSHAGENT void updateSSHAgent(); + void updateSSHAgentAttachment(); void updateSSHAgentKeyInfo(); void browsePrivateKey(); void addKeyToAgent();