SSH Agent: Always use freshly selected key

This commit is contained in:
Toni Spets 2018-02-03 08:17:38 +02:00
parent ba04ad8603
commit e987479d04
2 changed files with 10 additions and 1 deletions

View File

@ -271,7 +271,7 @@ void EditEntryWidget::setupSSHAgent()
m_sshAgentUi->publicKeyEdit->setFont(fixedFont); m_sshAgentUi->publicKeyEdit->setFont(fixedFont);
connect(m_sshAgentUi->attachmentRadioButton, SIGNAL(clicked(bool)), SLOT(updateSSHAgentKeyInfo())); 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->externalFileRadioButton, SIGNAL(clicked(bool)), SLOT(updateSSHAgentKeyInfo()));
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(QString)), SLOT(updateSSHAgentKeyInfo())); connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(QString)), SLOT(updateSSHAgentKeyInfo()));
connect(m_sshAgentUi->browseButton, SIGNAL(clicked()), SLOT(browsePrivateKey())); connect(m_sshAgentUi->browseButton, SIGNAL(clicked()), SLOT(browsePrivateKey()));
@ -323,6 +323,12 @@ void EditEntryWidget::updateSSHAgent()
updateSSHAgentKeyInfo(); updateSSHAgentKeyInfo();
} }
void EditEntryWidget::updateSSHAgentAttachment()
{
m_sshAgentUi->attachmentRadioButton->setChecked(true);
updateSSHAgentKeyInfo();
}
void EditEntryWidget::updateSSHAgentKeyInfo() void EditEntryWidget::updateSSHAgentKeyInfo()
{ {
m_sshAgentUi->addToAgentButton->setEnabled(false); m_sshAgentUi->addToAgentButton->setEnabled(false);
@ -398,6 +404,8 @@ void EditEntryWidget::browsePrivateKey()
QString fileName = QFileDialog::getOpenFileName(this, tr("Select private key"), ""); QString fileName = QFileDialog::getOpenFileName(this, tr("Select private key"), "");
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
m_sshAgentUi->externalFileEdit->setText(fileName); m_sshAgentUi->externalFileEdit->setText(fileName);
m_sshAgentUi->externalFileRadioButton->setChecked(true);
updateSSHAgentKeyInfo();
} }
} }

View File

@ -101,6 +101,7 @@ private slots:
void toggleHideNotes(bool visible); void toggleHideNotes(bool visible);
#ifdef WITH_XC_SSHAGENT #ifdef WITH_XC_SSHAGENT
void updateSSHAgent(); void updateSSHAgent();
void updateSSHAgentAttachment();
void updateSSHAgentKeyInfo(); void updateSSHAgentKeyInfo();
void browsePrivateKey(); void browsePrivateKey();
void addKeyToAgent(); void addKeyToAgent();