Merge pull request #1451 from hifi/feature/sshagent-select-key

SSH Agent: Always use freshly selected key
This commit is contained in:
Janek Bevendorff 2018-02-03 11:22:32 +01:00 committed by GitHub
commit af9e1e79cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();